introduce TI reset controller for MT8192 SoC
Subsystems (3)
v6 cover introduce TI reset controller for MT8192 SoC
v6:
fix the format error of mediatek-syscon-reset.yaml
v5:
1. revert ti-syscon-reset.txt, and add a new mediatek reset binding.
2. split the patch [v4, 3/4] with the change to force write and the change to integrate assert and deassert together.
3. separate the dts patch from this patch sets
v4:
fix typos on v3 commit message.
v3:
1. revert v2 changes.
2. add 'reset-duration-us' property to declare a minimum delay, which needs to be waited between assert and deassert.
3. add 'mediatek,infra-reset' to compatible.
v2 changes:
https://patchwork.kernel.org/patch/11697371/
1. add 'assert-deassert-together' property to introduce a new reset handler, which allows device to do serialized assert and deassert operations in a single step by 'reset' method.
2. add 'update-force' property to introduce force-update method, which forces the write operation in case the read already happens to return the correct value.
3. add 'generic-reset' to compatible
v1 changes:
https://patchwork.kernel.org/patch/11690523/
https://patchwork.kernel.org/patch/11690527/
Crystal Guo (3):
dt-binding: reset-controller: mediatek: add YAML schemas
reset-controller: ti: introduce a new reset handler
reset-controller: ti: force the write operation when assert or
deassert
.../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ drivers/reset/reset-ti-syscon.c | 44 ++++++++++++++-- 2 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml
PATCH v6 1/3 dt-binding: reset-controller: mediatek: add YAML schemas
Add a YAML documentation for Mediatek, which uses ti reset-controller driver directly. The TI reset controller provides a common reset management, and is suitable for Mediatek SoCs.
--- .../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml
Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +51 -0
@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/mediatek-syscon-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek Reset Controller + +maintainers: + - Crystal Guo <[email protected]> + +description: + The bindings describe the reset-controller for Mediatek SoCs, + which is based on TI reset controller. For more detail, please + visit Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +properties: + compatible: + const: mediatek,syscon-reset + + '#reset-cells': + const: 1 + + mediatek,reset-bits: + description: > + Contains the reset control register information, please refer to + Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +required: + - compatible + - '#reset-cells' + - mediatek,reset-bits + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/ti-syscon.h> + infracfg: infracfg@10001000 { + compatible = "mediatek,mt8192-infracfg", "syscon", "simple-mfd"; + reg = <0 0x10001000>; + #clock-cells = <1>; + + infracfg_rst: reset-controller { + compatible = "mediatek,syscon-reset"; + #reset-cells = <1>; + mediatek,reset-bits = < + 0x140 15 0x144 15 0 0 (ASSERT_SET | DEASSERT_SET | STATUS_NONE) + >; + }; + };
Signature · 1 line
2.18.0
Re: [v6,1/3] dt-binding: reset-controller: mediatek: add YAML schemas
Hi Maintainers,
Gentle ping for this patch set.
Many thanks
Crystal
Quoted 67 lines · Crystal Guo
Add a YAML documentation for Mediatek, which uses ti reset-controller driver directly. The TI reset controller provides a common reset management, and is suitable for Mediatek SoCs.
Signed-off-by Crystal Guo <[email protected]>--- .../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yamlDocumentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +51
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/mediatek-syscon-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek Reset Controller + +maintainers: + - Crystal Guo <[email protected]> + +description: + The bindings describe the reset-controller for Mediatek SoCs, + which is based on TI reset controller. For more detail, please + visit Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +properties: + compatible: + const: mediatek,syscon-reset + + '#reset-cells': + const: 1 + + mediatek,reset-bits: + description: > + Contains the reset control register information, please refer to + Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +required: + - compatible + - '#reset-cells' + - mediatek,reset-bits + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/ti-syscon.h> + infracfg: infracfg@10001000 { + compatible = "mediatek,mt8192-infracfg", "syscon", "simple-mfd"; + reg = <0 0x10001000>; + #clock-cells = <1>; + + infracfg_rst: reset-controller { + compatible = "mediatek,syscon-reset"; + #reset-cells = <1>; + mediatek,reset-bits = < + 0x140 15 0x144 15 0 0 (ASSERT_SET | DEASSERT_SET | STATUS_NONE) + >; + }; + };
Re: [v6,1/3] dt-binding: reset-controller: mediatek: add YAML schemas
Hi Matthias, Philipp, Suman,
Since almost one month pending with this patch series, just a gentle ping that would you have further suggestions on this series?
We are looking for this series being merged soon.
Thanks
Quoted 77 lines · Crystal Guo
Hi Maintainers,
Gentle ping for this patch set.
Many thanks
CrystalQuoted 67 lines · Crystal Guo
Add a YAML documentation for Mediatek, which uses ti reset-controller driver directly. The TI reset controller provides a common reset management, and is suitable for Mediatek SoCs.
Signed-off-by Crystal Guo <[email protected]>--- .../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yamlDocumentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +51
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/mediatek-syscon-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek Reset Controller + +maintainers: + - Crystal Guo <[email protected]> + +description: + The bindings describe the reset-controller for Mediatek SoCs, + which is based on TI reset controller. For more detail, please + visit Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +properties: + compatible: + const: mediatek,syscon-reset + + '#reset-cells': + const: 1 + + mediatek,reset-bits: + description: > + Contains the reset control register information, please refer to + Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +required: + - compatible + - '#reset-cells' + - mediatek,reset-bits + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/ti-syscon.h> + infracfg: infracfg@10001000 { + compatible = "mediatek,mt8192-infracfg", "syscon", "simple-mfd"; + reg = <0 0x10001000>; + #clock-cells = <1>; + + infracfg_rst: reset-controller { + compatible = "mediatek,syscon-reset"; + #reset-cells = <1>; + mediatek,reset-bits = < + 0x140 15 0x144 15 0 0 (ASSERT_SET | DEASSERT_SET | STATUS_NONE) + >; + }; + };
Philipp Zabel
maintainerRe: [v6,1/3] dt-binding: reset-controller: mediatek: add YAML schemas
In reply to Crystal GuoHi,
Quoted 33 lines · Crystal Guo
Add a YAML documentation for Mediatek, which uses ti reset-controller driver directly. The TI reset controller provides a common reset management, and is suitable for Mediatek SoCs.
Signed-off-by Crystal Guo <[email protected]>--- .../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yamlDocumentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +17
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/mediatek-syscon-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek Reset Controller + +maintainers: + - Crystal Guo <[email protected]> + +description: + The bindings describe the reset-controller for Mediatek SoCs, + which is based on TI reset controller. For more detail, please + visit Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +properties:
Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml line 27
Quoted 10 lines
Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +10
-0+ compatible: + const: mediatek,syscon-reset + + '#reset-cells': + const: 1 + + mediatek,reset-bits: + description: > + Contains the reset control register information, please refer to + Documentation/devicetree/bindings/reset/ti-syscon-reset.txt.
I would really like some input from Rob on this, in v4 he asked not to repeat 'ti,reset-bits'.
regards
Philipp
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [v6,1/3] dt-binding: reset-controller: mediatek: add YAML schemas
Quoted 50 lines · Philipp Zabel
Hi,
Quoted 33 lines · Crystal Guo
Add a YAML documentation for Mediatek, which uses ti reset-controller driver directly. The TI reset controller provides a common reset management, and is suitable for Mediatek SoCs.
Signed-off-by Crystal Guo <[email protected]>--- .../bindings/reset/mediatek-syscon-reset.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yamlDocumentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +17
-0@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/mediatek-syscon-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek Reset Controller + +maintainers: + - Crystal Guo <[email protected]> + +description: + The bindings describe the reset-controller for Mediatek SoCs, + which is based on TI reset controller. For more detail, please + visit Documentation/devicetree/bindings/reset/ti-syscon-reset.txt. + +properties:Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml line 27
Quoted 10 lines
Documentation/devicetree/bindings/reset/mediatek-syscon-reset.yaml new file +10
-0+ compatible: + const: mediatek,syscon-reset + + '#reset-cells': + const: 1 + + mediatek,reset-bits: + description: > + Contains the reset control register information, please refer to + Documentation/devicetree/bindings/reset/ti-syscon-reset.txt.I would really like some input from Rob on this, in v4 he asked not to repeat 'ti,reset-bits'.
Quoted 2 lines
regards
Philipp
Hi Rob,
Can you give some suggestions on this document
"mediatek-syscon-reset.yaml", many thanks~
regards
Crystal Guo
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v6 2/3 reset-controller: ti: introduce a new reset handler
In reply to Crystal GuoIntroduce ti_syscon_reset() to integrate assert and deassert together. If some modules need do serialized assert and deassert operations to reset itself, reset_control_reset can be called for convenience.
Such as reset-qcom-aoss.c, it integrates assert and deassert together by 'reset' method. MTK Socs also need this method to perform reset.
--- drivers/reset/reset-ti-syscon.c | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
drivers/reset/reset-ti-syscon.c +39 -1
@@ -15,15 +15,22 @@* GNU General Public License for more details. */ +#include <linux/delay.h> #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/reset-controller.h> #include <dt-bindings/reset/ti-syscon.h> +struct mediatek_reset_data { +unsigned char *reset_bits; +unsigned int reset_duration_us; +}; +/** * struct ti_syscon_reset_control - reset control structure * @assert_offset: reset assert control register offset from syscon base
@@ -56,6 +63,7 @@ struct ti_syscon_reset_data {struct regmap *regmap;struct ti_syscon_reset_control *controls;unsigned int nr_controls; +const struct mediatek_reset_data *reset_data; };#define to_ti_syscon_reset_data (rcdev) \
@@ -158,9 +166,29 @@ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, !(control->flags &STATUS_SET ); } +static int ti_syscon_reset (struct reset_controller_dev *rcdev, +unsigned long id) +{ +struct ti_syscon_reset_data *data =to_ti_syscon_reset_data (rcdev); +int ret; + +if (data->reset_data) { + ret =ti_syscon_reset_assert (rcdev, id); +if (ret) +return ret; +usleep_range (data->reset_data->reset_duration_us, + data->reset_data->reset_duration_us *2 ); + +return ti_syscon_reset_deassert (rcdev, id); + }else { +return -ENOTSUPP ; + } +} +static const struct reset_control_ops ti_syscon_reset_ops = { .assert = ti_syscon_reset_assert, .deassert = ti_syscon_reset_deassert, + .reset = ti_syscon_reset, .status = ti_syscon_reset_status, };
@@ -182,7 +210,11 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); - list =of_get_property (np,"ti,reset-bits" , &size); + data->reset_data =of_device_get_match_data (&pdev->dev); +if (data->reset_data) + list =of_get_property (np, data->reset_data->reset_bits, &size); +else + list =of_get_property (np,"ti,reset-bits" , &size);if (!list || (size /sizeof (*list)) %7 !=0 ) {dev_err (dev,"invalid DT reset description\n" );return -EINVAL ;
@@ -217,8 +249,14 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)return devm_reset_controller_register (dev, &data->rcdev); } +static const struct mediatek_reset_data mtk_reset_data = { + .reset_bits ="mediatek,reset-bits" , + .reset_duration_us =10 , +}; +static const struct of_device_id ti_syscon_reset_of_match[] = { { .compatible ="ti,syscon-reset" , }, + { .compatible ="mediatek,syscon-reset" , .data = &mtk_reset_data}, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, ti_syscon_reset_of_match);
Signature · 1 line
2.18.0
Re: [v6,2/3] reset-controller: ti: introduce a new reset handler
Quoted 8 lines · Crystal Guo
Introduce
ti_syscon_reset()to integrate assert and deassert together. If some modules need do serialized assert and deassert operations to reset itself,reset_control_resetcan be called for convenience.Such as
reset-qcom-aoss.c, it integrates assert and deassert together by 'reset' method. MTK Socs also need this method to perform reset.Signed-off-by Crystal Guo <[email protected]>
Quoted 46 lines
--- drivers/reset/reset-ti-syscon.c | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)drivers/reset/reset-ti-syscon.c +11
-0@@ -15,15 +15,22 @@* GNU General Public License for more details. */ +#include <linux/delay.h> #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/reset-controller.h> #include <dt-bindings/reset/ti-syscon.h> +struct mediatek_reset_data { +unsigned char *reset_bits; +unsigned int reset_duration_us; +}; +/** * struct ti_syscon_reset_control - reset control structure * @assert_offset: reset assert control register offset from syscon base @@ -56,6 +63,7 @@ struct ti_syscon_reset_data {struct regmap *regmap;struct ti_syscon_reset_control *controls;unsigned int nr_controls; +const struct mediatek_reset_data *reset_data; };#define to_ti_syscon_reset_data (rcdev) \@@ -158,9 +166,29 @@ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, !(control->flags &STATUS_SET ); } +static int ti_syscon_reset (struct reset_controller_dev *rcdev, +unsigned long id) +{
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, · line 181
Quoted 10 lines
drivers/reset/reset-ti-syscon.c +10
-0+struct ti_syscon_reset_data *data =to_ti_syscon_reset_data (rcdev); +int ret; + +if (data->reset_data) { + ret =ti_syscon_reset_assert (rcdev, id); +if (ret) +return ret; +usleep_range (data->reset_data->reset_duration_us, + data->reset_data->reset_duration_us *2 ); +
There are many users using assert() and deassert() seperately without any delay between them.
If there's a timing requirement between assertion and deassertion, shouldn't there be a same amount of delay in assert?
Quoted 31 lines
drivers/reset/reset-ti-syscon.c +13
-1+return ti_syscon_reset_deassert (rcdev, id); + }else { +return -ENOTSUPP ; + } +} +static const struct reset_control_ops ti_syscon_reset_ops = { .assert = ti_syscon_reset_assert, .deassert = ti_syscon_reset_deassert, + .reset = ti_syscon_reset, .status = ti_syscon_reset_status, };@@ -182,7 +210,11 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); - list =of_get_property (np,"ti,reset-bits" , &size); + data->reset_data =of_device_get_match_data (&pdev->dev); +if (data->reset_data) + list =of_get_property (np, data->reset_data->reset_bits, &size); +else + list =of_get_property (np,"ti,reset-bits" , &size);if (!list || (size /sizeof (*list)) %7 !=0 ) {dev_err (dev,"invalid DT reset description\n" );return -EINVAL ;@@ -217,8 +249,14 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)return devm_reset_controller_register (dev, &data->rcdev); } +static const struct mediatek_reset_data mtk_reset_data = {
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_probe(struct platform_device *pdev) · line 262
Quoted 10 lines
drivers/reset/reset-ti-syscon.c +5
-0+ .reset_bits = "mediatek,reset-bits", + .reset_duration_us = 10, +}; +static const struct of_device_id ti_syscon_reset_of_match[] = { { .compatible ="ti,syscon-reset" , }, + { .compatible ="mediatek,syscon-reset" , .data = &mtk_reset_data}, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, ti_syscon_reset_of_match);
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [v6,2/3] reset-controller: ti: introduce a new reset handler
Quoted 72 lines · Ikjoon Jang
Quoted 8 lines · Crystal Guo
Introduce
ti_syscon_reset()to integrate assert and deassert together. If some modules need do serialized assert and deassert operations to reset itself,reset_control_resetcan be called for convenience.Such as
reset-qcom-aoss.c, it integrates assert and deassert together by 'reset' method. MTK Socs also need this method to perform reset.Signed-off-by Crystal Guo <[email protected]>Reviewed-by Ikjoon Jang <[email protected]>Quoted 46 lines
--- drivers/reset/reset-ti-syscon.c | 40 ++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)drivers/reset/reset-ti-syscon.c +11
-0@@ -15,15 +15,22 @@* GNU General Public License for more details. */ +#include <linux/delay.h> #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/reset-controller.h> #include <dt-bindings/reset/ti-syscon.h> +struct mediatek_reset_data { +unsigned char *reset_bits; +unsigned int reset_duration_us; +}; +/** * struct ti_syscon_reset_control - reset control structure * @assert_offset: reset assert control register offset from syscon base @@ -56,6 +63,7 @@ struct ti_syscon_reset_data {struct regmap *regmap;struct ti_syscon_reset_control *controls;unsigned int nr_controls; +const struct mediatek_reset_data *reset_data; };#define to_ti_syscon_reset_data (rcdev) \@@ -158,9 +166,29 @@ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, !(control->flags &STATUS_SET ); } +static int ti_syscon_reset (struct reset_controller_dev *rcdev, +unsigned long id) +{drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, · line 181
Quoted 10 lines
drivers/reset/reset-ti-syscon.c +10
-0+struct ti_syscon_reset_data *data =to_ti_syscon_reset_data (rcdev); +int ret; + +if (data->reset_data) { + ret =ti_syscon_reset_assert (rcdev, id); +if (ret) +return ret; +usleep_range (data->reset_data->reset_duration_us, + data->reset_data->reset_duration_us *2 ); +There are many users using
assert()anddeassert()seperately without any delay between them.
Quoted 2 lines
If there's a timing requirement between assertion and deassertion, shouldn't there be a same amount of delay in assert?
The "reset_duration_us" is an optional configuration to make the reset operation more generic, which was added based on Philipp's comment in [v2,4/6].
Thanks,
Crystal
Quoted 31 lines
Quoted 31 lines
drivers/reset/reset-ti-syscon.c +12
-1+return ti_syscon_reset_deassert (rcdev, id); + }else { +return -ENOTSUPP ; + } +} +static const struct reset_control_ops ti_syscon_reset_ops = { .assert = ti_syscon_reset_assert, .deassert = ti_syscon_reset_deassert, + .reset = ti_syscon_reset, .status = ti_syscon_reset_status, };@@ -182,7 +210,11 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); - list =of_get_property (np,"ti,reset-bits" , &size); + data->reset_data =of_device_get_match_data (&pdev->dev); +if (data->reset_data) + list =of_get_property (np, data->reset_data->reset_bits, &size); +else + list =of_get_property (np,"ti,reset-bits" , &size);if (!list || (size /sizeof (*list)) %7 !=0 ) {dev_err (dev,"invalid DT reset description\n" );return -EINVAL ;@@ -217,8 +249,14 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)return devm_reset_controller_register (dev, &data->rcdev); }
Quoted 11 lines
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_probe(struct platform_device *pdev) · line 262
Quoted 11 lines
drivers/reset/reset-ti-syscon.c +6
-0+static const struct mediatek_reset_data mtk_reset_data = { + .reset_bits ="mediatek,reset-bits" , + .reset_duration_us =10 , +}; +static const struct of_device_id ti_syscon_reset_of_match[] = { { .compatible ="ti,syscon-reset" , }, + { .compatible ="mediatek,syscon-reset" , .data = &mtk_reset_data}, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, ti_syscon_reset_of_match);
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v6 3/3 reset-controller: ti: force the write operation when assert or deassert
In reply to Crystal GuoForce the write operation in case the read already happens to return the correct value.
--- drivers/reset/reset-ti-syscon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/reset/reset-ti-syscon.c +2 -2
@@ -97,7 +97,7 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, mask =BIT (control->assert_bit); value = (control->flags &ASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->assert_offset, mask, value); +return regmap_write_bits (data->regmap, control->assert_offset, mask, value); }/**
@@ -128,7 +128,7 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, mask =BIT (control->deassert_bit); value = (control->flags &DEASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->deassert_offset, mask, value); +return regmap_write_bits (data->regmap, control->deassert_offset, mask, value); }/**
Signature · 1 line
2.18.0
Re: [v6, 3/3] reset-controller: ti: force the write operation when assert or deassert
Quoted 13 lines · Crystal Guo
Force the write operation in case the read already happens to return the correct value.
Signed-off-by Crystal Guo <[email protected]>--- drivers/reset/reset-ti-syscon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/reset/reset-ti-syscon.c +0
-0
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, · line 101
Quoted 6 lines
drivers/reset/reset-ti-syscon.c +1
-1@@ -97,7 +97,7 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, mask =BIT (control->assert_bit); value = (control->flags &ASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->assert_offset, mask, value); +return regmap_write_bits (data->regmap, control->assert_offset, mask, value); }
I don't think there are no reset controllers with cached regmap, thus I don't think this is needed.
Are there any specific reasons behind this, what I've missed here?
We need to be sure that all other devices using this driver should have no side effects on write.
I can think of a weird controller doing unwanted things internally on every write disregarding the current state. (or is this overly paranoid?)
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, · line 134
Quoted 11 lines
drivers/reset/reset-ti-syscon.c +1
-1/** @@ -128,7 +128,7 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, mask =BIT (control->deassert_bit); value = (control->flags &DEASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->deassert_offset, mask, value); +return regmap_write_bits (data->regmap, control->deassert_offset, mask, value); }/**
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [v6, 3/3] reset-controller: ti: force the write operation when assert or deassert
Quoted 25 lines · Ikjoon Jang
Quoted 13 lines · Crystal Guo
Force the write operation in case the read already happens to return the correct value.
Signed-off-by Crystal Guo <[email protected]>--- drivers/reset/reset-ti-syscon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/reset/reset-ti-syscon.c +0
-0drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, · line 101
Quoted 6 lines
drivers/reset/reset-ti-syscon.c +1
-1@@ -97,7 +97,7 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, mask =BIT (control->assert_bit); value = (control->flags &ASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->assert_offset, mask, value); +return regmap_write_bits (data->regmap, control->assert_offset, mask, value); }I don't think there are no reset controllers with cached regmap, thus I don't think this is needed.
Are there any specific reasons behind this, what I've missed here?
Quoted 7 lines
We need to be sure that all other devices using this driver should have no side effects on write.
I can think of a weird controller doing unwanted things internally on every write disregarding the current state. (or is this overly paranoid?)
The specific reason is that, the clear bit may keep the same value with the set bit, but the clear operation can be only be completed by writing 1 to the clear bit, not just with the current fake state "1".
Quoted 11 lines
Quoted 11 lines
drivers/reset/reset-ti-syscon.c +1
-1/** @@ -128,7 +128,7 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, mask =BIT (control->deassert_bit); value = (control->flags &DEASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->deassert_offset, mask, value); +return regmap_write_bits (data->regmap, control->deassert_offset, mask, value); }/**
Re: [v6, 3/3] reset-controller: ti: force the write operation when assert or deassert
Quoted 30 lines · Crystal Guo
Quoted 28 lines · Ikjoon Jang
Quoted 13 lines · Crystal Guo
Force the write operation in case the read already happens to return the correct value.
Signed-off-by Crystal Guo <[email protected]>--- drivers/reset/reset-ti-syscon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/reset/reset-ti-syscon.c +0
-0drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, · line 101
Quoted 6 lines
drivers/reset/reset-ti-syscon.c +1
-1@@ -97,7 +97,7 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, mask =BIT (control->assert_bit); value = (control->flags &ASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->assert_offset, mask, value); +return regmap_write_bits (data->regmap, control->assert_offset, mask, value); }I don't think there are no reset controllers with cached regmap, thus I don't think this is needed.
Are there any specific reasons behind this, what I've missed here?We need to be sure that all other devices using this driver should have no side effects on write.
Quoted 8 lines
Quoted 4 lines
I can think of a weird controller doing unwanted things internally on every write disregarding the current state. (or is this overly paranoid?)
The specific reason is that, the clear bit may keep the same value with the set bit, but the clear operation can be only be completed by writing 1 to the clear bit, not just with the current fake state "1".
sorry. I didn't think of that case,
then I think this patch must be applied. 8-)
I've thought that the bit automatically flipped to the current reset state after the internal operation is done.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/reset/reset-ti-syscon.c +0
-0/** @@ -128,7 +128,7 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, mask =BIT (control->deassert_bit); value = (control->flags &DEASSERT_SET ) ? mask :0x0 ;
Quoted 6 lines
Quoted 5 lines
drivers/reset/reset-ti-syscon.c static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, · line 134
Quoted 5 lines
drivers/reset/reset-ti-syscon.c +1
-1-return regmap_update_bits (data->regmap, control->deassert_offset, mask, value); +return regmap_write_bits (data->regmap, control->deassert_offset, mask, value); }/**
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Philipp Zabel
maintainerRe: [v6,3/3] reset-controller: ti: force the write operation when assert or deassert
In reply to Crystal GuoQuoted 32 lines · Crystal Guo
Force the write operation in case the read already happens to return the correct value.
Signed-off-by Crystal Guo <[email protected]>--- drivers/reset/reset-ti-syscon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/reset/reset-ti-syscon.c +2
-2@@ -97,7 +97,7 @@ static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, mask =BIT (control->assert_bit); value = (control->flags &ASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->assert_offset, mask, value); +return regmap_write_bits (data->regmap, control->assert_offset, mask, value); }/** @@ -128,7 +128,7 @@ static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, mask =BIT (control->deassert_bit); value = (control->flags &DEASSERT_SET ) ? mask :0x0 ; -return regmap_update_bits (data->regmap, control->deassert_offset, mask, value); +return regmap_write_bits (data->regmap, control->deassert_offset, mask, value); }/** Signature · 1 line
2.18.0
Thank you. Since Suman tested v4, this should be safe. Applied to reset/next.
regards
Philipp
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek