add reset-hi3660
Subsystems (2)
cover add reset-hi3660
Considering Arnd and Philipp suggestions,
move reset register to dts as table instead of dts header in case of ABI issue
Zhangfei Gao (2):
dt-bindings: Document the hi3660 reset bindings
reset: hisilicon: add reset-hi3660
.../bindings/reset/hisilicon,hi3660-reset.txt | 51 ++++++++ drivers/reset/hisilicon/Kconfig | 7 + drivers/reset/hisilicon/Makefile | 1 + drivers/reset/hisilicon/reset-hi3660.c | 144 +++++++++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt create mode 100644 drivers/reset/hisilicon/reset-hi3660.c
Signature · 1 line
2.7.4
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Add DT bindings documentation for hi3660 SoC reset controller.
--- .../bindings/reset/hisilicon,hi3660-reset.txt | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +51 -0
@@ -0,0 +1,51 @@ +Hisilicon System Reset Controller +====================================== + +Please also refer to reset.txt in this directory for common reset +controller binding usage. + +The reset controller registers are part of the system-ctl block on +hi3660 SoC. + +Required properties: +- compatible: should be + "hisilicon,hi3660-reset" +- #reset-cells: 1, see below +- hisi,rst-syscon: phandle of the reset's syscon. +- hisi,reset-bits: Contains the reset control register information + Should contain 2 cells for each reset exposed to + consumers, defined as: + Cell #1 : offset from the syscon register base + Cell #2 : bits position of the control register + +Example: + iomcu: iomcu at ffd7e000 { + compatible = "hisilicon,hi3660-iomcu", "syscon"; + reg = <0x0 0xffd7e000 0x0 0x1000>; + }; + + iomcu_rst: iomcu_rst_controller { + compatible = "hisilicon,hi3660-reset"; + #reset-cells = <1>; + hisi,rst-syscon = <&iomcu>; + hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: + + i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + }; + + i2c1: i2c at ..... { + ... + resets = <&iomcu_rst 1>; + ... + };
Signature · 1 line
2.7.4
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Quoted 5 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + };
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 10 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ +Specifying reset lines connected to IP modules +============================================== +example: + + i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };
I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Also the format seems a little too close to the actual register layout and could be a little more abstract, using bit numbers instead of a bitmask and register numbers instead of offsets.
Arnd
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Hi, Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +
Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Any example, still not understand.
They are consumer and provider.
Quoted 4 lines
Also the format seems a little too close to the actual register layout and could be a little more abstract, using bit numbers instead of a bitmask and register numbers instead of offsets.
We use bit numbers first.
But in the developing process, we found several bits may be required for one driver.
And they may not be continuous as the bits may already be occupied. Directly using offset, we can set several bits together for simple, to give more flexibility.
So after discussion, we directly use offset.
Thanks
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Quoted 22 lines · CET zhangfei
Hi, Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.
I mean in the i2c node, have
i2c0: i2c at ..... {
...
resets = <&iomcu_rst 0x20 0x8>;
...
}Quoted 10 lines
Quoted 3 lines
Also the format seems a little too close to the actual register layout and could be a little more abstract, using bit numbers instead of a bitmask and register numbers instead of offsets.
We use bit numbers first.
But in the developing process, we found several bits may be required for one driver.
And they may not be continuous as the bits may already be occupied. Directly using offset, we can set several bits together for simple, to give more flexibility.
So after discussion, we directly use offset.
Can you give an example for why this is needed? Is this different from a device that has multiple reset lines?
Arnd
Philipp Zabel
maintainerPATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Am Freitag, den 02.12.2016, 13:32 +0100 schrieb Arnd Bergmann:
Quoted 24 lines · CET zhangfei
Quoted 22 lines
Hi, Arnd
Quoted 19 lines · Arnd Bergmann
Quoted 5 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + };Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 10 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ +Specifying reset lines connected to IP modules +============================================== +example: + + i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 1 line
From my point of view, with the binding above, all reset controller
register/bit layout information is in a single place and can be easily compared to a list in the reference manual, whereas with your suggestion the description of the reset controller register layout is spread throughout one or even several dtsi files.
Also, since no two reset controllers are exactly the same, we get a proliferation of different slightly phandle argument meanings.
Quoted 10 lines
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
There already are a few drivers that use this, and I fear people having to change their bindings because new flags are needed that have not been previously thought of.
regards
Philipp
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Quoted 23 lines · CET Philipp Zabel
Am Freitag, den 02.12.2016, 13:32 +0100 schrieb Arnd Bergmann:
Quoted 13 lines · CET zhangfei
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · CET Zhangfei Gao
Quoted 10 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 7 lines
From my point of view, with the binding above, all reset controller register/bit layout information is in a single place and can be easily compared to a list in the reference manual, whereas with your suggestion the description of the reset controller register layout is spread throughout one or even several dtsi files.
Also, since no two reset controllers are exactly the same, we get a proliferation of different slightly phandle argument meanings.
There is no reason for this to be any different from other subsystems that all do it the same way: interrupts, gpios, dma, clk, ... all define #foo-cells to be used for addressing uniform things, and the data is only in the reference, so that the node that describes the controller needs no knowledge of what it's being used for.
One exception is the case (often on clk bindings) where the register layout is anything but uniform and every input line has a completely different behavior. For that case, we define our own numbering system in the driver and hardcode those tables there.
This reset driver does not seem to belong into that category though. Even if it did, we putting information about the controller into its own node is redundant as the driver already identifies the register layout by the compatible string.
Quoted 11 lines
Quoted 10 lines
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
Quoted 3 lines
There already are a few drivers that use this, and I fear people having to change their bindings because new flags are needed that have not been previously thought of.
It rarely happens on other subsystems, and the binding can always specify different behavior depending on #reset-cells.
Arnd
Philipp Zabel
maintainerPATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Am Freitag, den 02.12.2016, 23:11 +0100 schrieb Arnd Bergmann:
Quoted 32 lines · CET Philipp Zabel
Quoted 23 lines
Am Freitag, den 02.12.2016, 13:32 +0100 schrieb Arnd Bergmann:
Quoted 13 lines · CET zhangfei
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · CET Zhangfei Gao
Quoted 10 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 7 lines
From my point of view, with the binding above, all reset controller register/bit layout information is in a single place and can be easily compared to a list in the reference manual, whereas with your suggestion the description of the reset controller register layout is spread throughout one or even several dtsi files.
Also, since no two reset controllers are exactly the same, we get a proliferation of different slightly phandle argument meanings.
Quoted 6 lines
There is no reason for this to be any different from other subsystems that all do it the same way: interrupts, gpios, dma, clk, ... all define #foo-cells to be used for addressing uniform things, and the data is only in the reference, so that the node that describes the controller needs no knowledge of what it's being used for.
For most of those bindings the knowledge about which register and bit position(s) correspond to the handles resides in the driver.
Quoted 2 lines
One exception is the case (often on clk bindings) where the register layout is anything but uniform
The register layout is very non-uniform for many reset controllers. Some share the same register space with some of those clock controllers.
Quoted 1 line
and every input line has a completely different behavior.
I can't argue that the behavior is non-uniform for the sane reset controllers though, most of them have just a single bit, for most of them all reset lines behave the same.
Quoted 4 lines
For that case, we define our own numbering
system in the driver and hardcode those tables there.This reset driver does not seem to belong into that category though.
Yes. From what has been shown so far, it seems that in this case, while the resets are distributed sparsely, the relative layout (set/clear registers right next to each other) is uniform.
Quoted 3 lines
Even if it did, we putting information about the controller into its own node is redundant as the driver already identifies the register layout by the compatible string.
Indeed I would prefer the driver to carry the register layout tables instead of putting this information into the device tree at all.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
Quoted 6 lines
Quoted 3 lines
There already are a few drivers that use this, and I fear people having to change their bindings because new flags are needed that have not been previously thought of.
It rarely happens on other subsystems, and the binding can always specify different behavior depending on #reset-cells.
I recognize I am biased here. So feel free to ignore this point.
What I'd like to make sure is that we have thought about and are happy to spread (partial) information about the reset controller register layout throughout the device tree like this.
regards
Philipp
Rob Herring
maintainerPATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
In reply to Philipp ZabelQuoted 25 lines · Philipp Zabel
Am Freitag, den 02.12.2016, 13:32 +0100 schrieb Arnd Bergmann:
Quoted 15 lines · CET zhangfei
Quoted 14 lines
Hi, Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 5 lines
From my point of view, with the binding above, all reset controller register/bit layout information is in a single place and can be easily compared to a list in the reference manual, whereas with your suggestion the description of the reset controller register layout is spread throughout one or even several dtsi files.
Which can be solved by tools.
Quoted 2 lines
Also, since no two reset controllers are exactly the same, we get a proliferation of different slightly phandle argument meanings.
phandle args are supposed to be specific to the phandle it points to. Otherwise, we'd never need more than 1 cell and everything could be a lookup table.
Quoted 12 lines
Quoted 11 lines
Quoted 3 lines
Any example, still not understand.
They are consumer and provider.I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
Quoted 4 lines
There already are a few drivers that use this, and I fear people having to change their bindings because new flags are needed that have not been previously thought of.
Drivers that use what?
Rob
Philipp Zabel
maintainerPATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
Am Montag, den 05.12.2016, 17:40 -0600 schrieb Rob Herring:
Quoted 26 lines · Philipp Zabel
Quoted 25 lines
Am Freitag, den 02.12.2016, 13:32 +0100 schrieb Arnd Bergmann:
Quoted 23 lines · CET zhangfei
Quoted 22 lines
Hi, Arnd
Quoted 19 lines · Arnd Bergmann
Quoted 5 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + };Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 10 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ +Specifying reset lines connected to IP modules +============================================== +example: + + i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 7 lines
Quoted 5 lines
From my point of view, with the binding above, all reset controller register/bit layout information is in a single place and can be easily compared to a list in the reference manual, whereas with your suggestion the description of the reset controller register layout is spread throughout one or even several dtsi files.
Which can be solved by tools.
True.
Quoted 6 lines
Quoted 2 lines
Also, since no two reset controllers are exactly the same, we get a proliferation of different slightly phandle argument meanings.
phandle args are supposed to be specific to the phandle it points to. Otherwise, we'd never need more than 1 cell and everything could be a lookup table.
What I mean is that the clk bindings mostly use <&label index> or <&label type index> phandles, not <&label register-offset bit-offset> phandles. Usually the bindings don't spread information about the register layout of the clock controller throughout the device tree, because that is contained in the driver, as determined by the compatible property. I assumed the same should be true for reset controllers, if possible.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
Quoted 5 lines
Quoted 3 lines
There already are a few drivers that use this, and I fear people having to change their bindings because new flags are needed that have not been previously thought of.
Drivers that use what?
Drivers that use <&label register-offset bit-offset> phandles instead of <&label index> phandles.
regards
Philipp
PATCH RESEND v2 1/2 dt-bindings: Document the hi3660 reset bindings
In reply to Arnd BergmannHi, Arnd
Quoted 25 lines · Arnd Bergmann
Quoted 22 lines · CET zhangfei
Hi, Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · CET Zhangfei Gao
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +10
-0+ hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */ + 0x20 0x10 /* 1: i2c1 */ + 0x20 0x20 /* 2: i2c2 */ + 0x20 0x8000000>; /* 3: i2c6 */ + }; + +Specifying reset lines connected to IP modules +============================================== +example: +Quoted 8 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt line 45
Quoted 5 lines
Documentation/devicetree/bindings/reset/hisilicon,hi3660-reset.txt new file +5
-0+ i2c0: i2c at ..... { + ... + resets = <&iomcu_rst 0>; + ... + };I don't really like this approach, since now the information is in two places. Why not put the data into the reset specifier directly when it is used?
Quoted 2 lines
Any example, still not understand.
They are consumer and provider.
Quoted 7 lines
I mean in the i2c node, have
i2c0: i2c at ..... { ... resets = <&iomcu_rst 0x20 0x8>; ... }
Got it.
There is function of_xlate in reset_controller_dev can parse the dts when devm_reset_control_get
* @of_xlate: translation function to translate from specifier as found in the
* device tree to id as given to the reset control ops
Will use this instead.
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Also the format seems a little too close to the actual register layout and could be a little more abstract, using bit numbers instead of a bitmask and register numbers instead of offsets.
We use bit numbers first.
But in the developing process, we found several bits may be required for one driver.
And they may not be continuous as the bits may already be occupied. Directly using offset, we can set several bits together for simple, to give more flexibility.
So after discussion, we directly use offset.
Quoted 2 lines
Can you give an example for why this is needed? Is this different from a device that has multiple reset lines?
Yes, we can use multiple reset lines, which is also our original method. But it may have too many reset lines, like pcie driver will have 5 resets. So just thinking it can be optimized.
However, when using of_xlate, parsing offset & bit to rstc->id (unsigned int),
It only support u32, so will use bit numbers again.rstc_id = rcdev->of_xlate(rcdev, &args);
Will update v3 patch, help take a look.
Thanks
PATCH RESEND v2 2/2 reset: hisilicon: add reset-hi3660
In reply to Zhangfei GaoAdd hi3660 reset driver
Reset offset & bits should be listed in dts
Like:
iomcu_rst: iomcu_rst_controller {
compatible = "hisilicon,hi3660-reset";
#reset-cells = <1>;
hisi,rst-syscon = <&iomcu>;
hisi,reset-bits = <0x20 0x8 /* 0: i2c0 */
0x20 0x10 /* 1: i2c1 */
0x20 0x20 /* 2: i2c2 */
0x20 0x8000000>; /* 3: i2c6 */
};--- drivers/reset/hisilicon/Kconfig | 7 ++ drivers/reset/hisilicon/Makefile | 1 + drivers/reset/hisilicon/reset-hi3660.c | 144 +++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 drivers/reset/hisilicon/reset-hi3660.c
drivers/reset/hisilicon/Kconfig +7 -0
@@ -1,3 +1,10 @@ +config COMMON_RESET_HI3660 + tristate "Hi3660 Reset Driver" + depends on ARCH_HISI || COMPILE_TEST + default ARCH_HISI + help + Build the Hisilicon Hi3660 reset driver. + config COMMON_RESET_HI6220 tristate "Hi6220 Reset Driver" depends on ARCH_HISI || COMPILE_TEST
drivers/reset/hisilicon/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_COMMON_RESET_HI6220) += hi6220_reset.o +obj-$(CONFIG_COMMON_RESET_HI3660) += reset-hi3660.o
drivers/reset/hisilicon/reset-hi3660.c new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
2.7.4