reset: meson-audio-arb: add sm1 support
Jerome Brunet
reviewercover reset: meson-audio-arb: add sm1 support
This patchset adds the new arb reset lines for the sm1 SoC family
Jerome Brunet (2):
reset: dt-bindings: meson: update arb bindings for sm1
reset: meson-audio-arb: add sm1 support
.../reset/amlogic,meson-axg-audio-arb.txt | 3 +- drivers/reset/reset-meson-audio-arb.c | 28 +++++++++++++++++-- .../reset/amlogic,meson-axg-audio-arb.h | 2 ++ 3 files changed, 29 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.0
Jerome Brunet
reviewerPATCH 1/2 reset: dt-bindings: meson: update arb bindings for sm1
SM1 SoC family adds two new audio FIFOs with the related arb reset lines
--- .../devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt | 3 ++- include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt +2 -1
@@ -4,7 +4,8 @@ The Amlogic Audio ARB is a simple device which enables or disables the access of Audio FIFOs to DDR on AXG based SoC. Required properties: -- compatible: 'amlogic,meson-axg-audio-arb' +- compatible: 'amlogic,meson-axg-audio-arb' or + 'amlogic,meson-sm1-audio-arb' - reg: physical base address of the controller and length of memory mapped region. - clocks: phandle to the fifo peripheral clock provided by the audio
include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h +2 -0
@@ -13,5 +13,7 @@#define AXG_ARB_FRDDR_A 3#define AXG_ARB_FRDDR_B 4#define AXG_ARB_FRDDR_C 5 +#define AXG_ARB_TODDR_D 6 +#define AXG_ARB_FRDDR_D 7#endif /* _DT_BINDINGS_AMLOGIC_MESON_AXG_AUDIO_ARB_H */
Signature · 1 line
2.21.0
Re: [PATCH 1/2] reset: dt-bindings: meson: update arb bindings for sm1
Quoted 8 lines · Jerome Brunet
SM1 SoC family adds two new audio FIFOs with the related arb reset lines
Signed-off-by Jerome Brunet <[email protected]>--- .../devicetree/bindings/reset/amlogic,meson-axg-audio-arb.txt | 3 ++- include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
Jerome Brunet
reviewerPATCH 2/2 reset: meson-audio-arb: add sm1 support
In reply to Jerome BrunetAdd the new arb reset lines of the SM1 SoC family
--- drivers/reset/reset-meson-audio-arb.c | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/reset/reset-meson-audio-arb.c +25 -3
@@ -30,6 +30,17 @@ static const unsigned int axg_audio_arb_reset_bits[] = { [AXG_ARB_FRDDR_C] = 6, }; +static const unsigned int sm1_audio_arb_reset_bits[] = { + [AXG_ARB_TODDR_A ] =0 , + [AXG_ARB_TODDR_B ] =1 , + [AXG_ARB_TODDR_C ] =2 , + [AXG_ARB_FRDDR_A ] =4 , + [AXG_ARB_FRDDR_B ] =5 , + [AXG_ARB_FRDDR_C ] =6 , + [AXG_ARB_TODDR_D ] =3 , + [AXG_ARB_FRDDR_D ] =7 , +}; +static int meson_audio_arb_update (struct reset_controller_dev *rcdev,unsigned long id,bool assert) {
@@ -82,8 +93,14 @@ static const struct reset_control_ops meson_audio_arb_rstc_ops = { };static const struct of_device_id meson_audio_arb_of_match[] = { - { .compatible ="amlogic,meson-axg-audio-arb" , }, - {} + { + .compatible ="amlogic,meson-axg-audio-arb" , + .data = axg_audio_arb_reset_bits, + }, + { + .compatible ="amlogic,meson-sm1-audio-arb" , + .data = sm1_audio_arb_reset_bits + }, {} };MODULE_DEVICE_TABLE (of, meson_audio_arb_of_match);
@@ -104,10 +121,15 @@ static int meson_audio_arb_remove(struct platform_device *pdev)static int meson_audio_arb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +const unsigned int *data;struct meson_audio_arb_data *arb;struct resource *res;int ret; + data =of_device_get_match_data (dev); +if (!data) +return -EINVAL ; + arb =devm_kzalloc (dev,sizeof (*arb),GFP_KERNEL );if (!arb)return -ENOMEM ;
@@ -126,7 +148,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev)return PTR_ERR (arb->regs);spin_lock_init (&arb->lock); - arb->reset_bits = axg_audio_arb_reset_bits; + arb->reset_bits = data; arb->rstc.nr_resets =ARRAY_SIZE (axg_audio_arb_reset_bits); arb->rstc.ops = &meson_audio_arb_rstc_ops; arb->rstc.of_node = dev->of_node;
Signature · 1 line
2.21.0
Philipp Zabel
maintainerHi Jerome,
thank you for the patch. Just one nitpick and one real issue below:
Quoted 33 lines · Jerome Brunet
Add the new arb reset lines of the SM1 SoC family
Signed-off-by Jerome Brunet <[email protected]>--- drivers/reset/reset-meson-audio-arb.c | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)drivers/reset/reset-meson-audio-arb.c +11
-0@@ -30,6 +30,17 @@ static const unsigned int axg_audio_arb_reset_bits[] = { [AXG_ARB_FRDDR_C] = 6, }; +static const unsigned int sm1_audio_arb_reset_bits[] = { + [AXG_ARB_TODDR_A ] =0 , + [AXG_ARB_TODDR_B ] =1 , + [AXG_ARB_TODDR_C ] =2 , + [AXG_ARB_FRDDR_A ] =4 , + [AXG_ARB_FRDDR_B ] =5 , + [AXG_ARB_FRDDR_C ] =6 , + [AXG_ARB_TODDR_D ] =3 , + [AXG_ARB_FRDDR_D ] =7 , +}; +static int meson_audio_arb_update (struct reset_controller_dev *rcdev,unsigned long id,bool assert) {@@ -82,8 +93,14 @@ static const struct reset_control_ops meson_audio_arb_rstc_ops = { };static const struct of_device_id meson_audio_arb_of_match[] = {
drivers/reset/reset-meson-audio-arb.c static const struct reset_control_ops meson_audio_arb_rstc_ops = { · line 103
Quoted 10 lines
drivers/reset/reset-meson-audio-arb.c +8
-2- { .compatible = "amlogic,meson-axg-audio-arb", }, - {} + { + .compatible = "amlogic,meson-axg-audio-arb", + .data = axg_audio_arb_reset_bits, + }, + { + .compatible = "amlogic,meson-sm1-audio-arb", + .data = sm1_audio_arb_reset_bits + }, {}
Only slight preference, I would keep the sentinel on a separate line. Your choice.
Quoted 20 lines
drivers/reset/reset-meson-audio-arb.c +5
-0};MODULE_DEVICE_TABLE (of, meson_audio_arb_of_match);@@ -104,10 +121,15 @@ static int meson_audio_arb_remove(struct platform_device *pdev)static int meson_audio_arb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +const unsigned int *data;struct meson_audio_arb_data *arb;struct resource *res;int ret; + data =of_device_get_match_data (dev); +if (!data) +return -EINVAL ; + arb =devm_kzalloc (dev,sizeof (*arb),GFP_KERNEL );if (!arb)return -ENOMEM ;
drivers/reset/reset-meson-audio-arb.c static int meson_audio_arb_probe(struct platform_device *pdev) · line 152
Quoted 6 lines
drivers/reset/reset-meson-audio-arb.c +1
-1@@ -126,7 +148,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev)return PTR_ERR (arb->regs);spin_lock_init (&arb->lock); - arb->reset_bits = axg_audio_arb_reset_bits; + arb->reset_bits = data; arb->rstc.nr_resets =ARRAY_SIZE (axg_audio_arb_reset_bits);
Since SM1 has two more resets, this needs to come from device match data as well, or the last two resets will be unusable.
drivers/reset/reset-meson-audio-arb.c static int meson_audio_arb_probe(struct platform_device *pdev) · line 154
Quoted 2 lines
drivers/reset/reset-meson-audio-arb.c +0
-0arb->rstc.ops = &meson_audio_arb_rstc_ops; arb->rstc.of_node = dev->of_node;
regards
Philipp
Jerome Brunet
reviewerQuoted 37 lines · Philipp Zabel
Hi Jerome,
thank you for the patch. Just one nitpick and one real issue below:
Quoted 32 lines · Jerome Brunet
Add the new arb reset lines of the SM1 SoC family
Signed-off-by Jerome Brunet <[email protected]>--- drivers/reset/reset-meson-audio-arb.c | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)drivers/reset/reset-meson-audio-arb.c +11
-0@@ -30,6 +30,17 @@ static const unsigned int axg_audio_arb_reset_bits[] = { [AXG_ARB_FRDDR_C] = 6, }; +static const unsigned int sm1_audio_arb_reset_bits[] = { + [AXG_ARB_TODDR_A ] =0 , + [AXG_ARB_TODDR_B ] =1 , + [AXG_ARB_TODDR_C ] =2 , + [AXG_ARB_FRDDR_A ] =4 , + [AXG_ARB_FRDDR_B ] =5 , + [AXG_ARB_FRDDR_C ] =6 , + [AXG_ARB_TODDR_D ] =3 , + [AXG_ARB_FRDDR_D ] =7 , +}; +static int meson_audio_arb_update (struct reset_controller_dev *rcdev,unsigned long id,bool assert) {@@ -82,8 +93,14 @@ static const struct reset_control_ops meson_audio_arb_rstc_ops = { };
Quoted 14 lines
drivers/reset/reset-meson-audio-arb.c static const struct reset_control_ops meson_audio_arb_rstc_ops = { · line 103
Quoted 11 lines
drivers/reset/reset-meson-audio-arb.c +8
-2static const struct of_device_id meson_audio_arb_of_match[] = { - { .compatible ="amlogic,meson-axg-audio-arb" , }, - {} + { + .compatible ="amlogic,meson-axg-audio-arb" , + .data = axg_audio_arb_reset_bits, + }, + { + .compatible ="amlogic,meson-sm1-audio-arb" , + .data = sm1_audio_arb_reset_bits + }, {}Only slight preference, I would keep the sentinel on a separate line. Your choice.
Agreed.
Quoted 23 lines
Quoted 23 lines
drivers/reset/reset-meson-audio-arb.c +5
-0};MODULE_DEVICE_TABLE (of, meson_audio_arb_of_match);@@ -104,10 +121,15 @@ static int meson_audio_arb_remove(struct platform_device *pdev)static int meson_audio_arb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +const unsigned int *data;struct meson_audio_arb_data *arb;struct resource *res;int ret; + data =of_device_get_match_data (dev); +if (!data) +return -EINVAL ; + arb =devm_kzalloc (dev,sizeof (*arb),GFP_KERNEL );if (!arb)return -ENOMEM ;@@ -126,7 +148,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev)return PTR_ERR (arb->regs);
Quoted 7 lines
drivers/reset/reset-meson-audio-arb.c static int meson_audio_arb_probe(struct platform_device *pdev) · line 152
Quoted 4 lines
drivers/reset/reset-meson-audio-arb.c +1
-1spin_lock_init (&arb->lock); - arb->reset_bits = axg_audio_arb_reset_bits; + arb->reset_bits = data; arb->rstc.nr_resets =ARRAY_SIZE (axg_audio_arb_reset_bits);Since SM1 has two more resets, this needs to come from device match data as well, or the last two resets will be unusable.
Absolutely. Sorry about that.
We are still a bit early in process of adding the support for this SoC.
I'll wait until I can do more complete tests to send a v2.
Quoted 6 lines
drivers/reset/reset-meson-audio-arb.c static int meson_audio_arb_probe(struct platform_device *pdev) · line 154
Quoted 3 lines
drivers/reset/reset-meson-audio-arb.c +0
-0arb->rstc.ops = &meson_audio_arb_rstc_ops; arb->rstc.of_node = dev->of_node;regards
Philipp