This patchset adds support for Meson-A1 SoC Reset Controller. A new struct meson_reset_param is introduced to describe the register differences between Meson-A1 and previous SoCs. This patchset is based on A1 DTBv4[0]. Changes since v1 at [1]: - rebase on linux-next - add Neil's Reviewed-by [0] https://lore.kernel.org/linux-amlogic/1568276370-54181-1-git-send-email-jianxin.pan@amlogic.com [1] https://lore.kernel.org/linux-amlogic/1568808746-1153-1-git-send-email-xingyu.chen@amlogic.com Xingyu Chen (3): arm64: dts: meson: add reset controller for Meson-A1 SoC dt-bindings: reset: add bindings for the Meson-A1 SoC Reset Controller reset: add support for the Meson-A1 SoC Reset Controller .../bindings/reset/amlogic,meson-reset.yaml | 1 + arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 +++ drivers/reset/reset-meson.c | 35 ++++++++++--- include/dt-bindings/reset/amlogic,meson-a1-reset.h | 59 ++++++++++++++++++++++ 4 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 include/dt-bindings/reset/amlogic,meson-a1-reset.h -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Add the reset controller device of Meson-A1 SoC family Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> --- arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi index 7210ad0..1c588ab 100644 --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi @@ -74,6 +74,12 @@ #size-cells = <2>; ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x1000000>; + reset: reset-controller@0 { + compatible = "amlogic,meson-a1-reset"; + reg = <0x0 0x0 0x0 0x8c>; + #reset-cells = <1>; + }; + uart_AO: serial@1c00 { compatible = "amlogic,meson-gx-uart", "amlogic,meson-ao-uart"; -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Add DT bindings for the Meson-A1 SoC Reset Controller include file, and also slightly update documentation. Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> --- .../bindings/reset/amlogic,meson-reset.yaml | 1 + include/dt-bindings/reset/amlogic,meson-a1-reset.h | 59 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 include/dt-bindings/reset/amlogic,meson-a1-reset.h diff --git a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml index 00917d8..b3f57d8 100644 --- a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml +++ b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml @@ -16,6 +16,7 @@ properties: - amlogic,meson8b-reset # Reset Controller on Meson8b and compatible SoCs - amlogic,meson-gxbb-reset # Reset Controller on GXBB and compatible SoCs - amlogic,meson-axg-reset # Reset Controller on AXG and compatible SoCs + - amlogic,meson-a1-reset # Reset Controller on A1 and compatible SoCs reg: maxItems: 1 diff --git a/include/dt-bindings/reset/amlogic,meson-a1-reset.h b/include/dt-bindings/reset/amlogic,meson-a1-reset.h new file mode 100644 index 00000000..8d76a47 --- /dev/null +++ b/include/dt-bindings/reset/amlogic,meson-a1-reset.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) + * + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. + * Author: Xingyu Chen <xingyu.chen@amlogic.com> + * + */ + +#ifndef _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H +#define _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H + +/* RESET0 */ +#define RESET_AM2AXI_VAD 1 +#define RESET_PSRAM 4 +#define RESET_PAD_CTRL 5 +#define RESET_TEMP_SENSOR 7 +#define RESET_AM2AXI_DEV 8 +#define RESET_SPICC_A 10 +#define RESET_MSR_CLK 11 +#define RESET_AUDIO 12 +#define RESET_ANALOG_CTRL 13 +#define RESET_SAR_ADC 14 +#define RESET_AUDIO_VAD 15 +#define RESET_CEC 16 +#define RESET_PWM_EF 17 +#define RESET_PWM_CD 18 +#define RESET_PWM_AB 19 +#define RESET_IR_CTRL 21 +#define RESET_I2C_S_A 22 +#define RESET_I2C_M_D 24 +#define RESET_I2C_M_C 25 +#define RESET_I2C_M_B 26 +#define RESET_I2C_M_A 27 +#define RESET_I2C_PROD_AHB 28 +#define RESET_I2C_PROD 29 + +/* RESET1 */ +#define RESET_ACODEC 32 +#define RESET_DMA 33 +#define RESET_SD_EMMC_A 34 +#define RESET_USBCTRL 36 +#define RESET_USBPHY 38 +#define RESET_RSA 42 +#define RESET_DMC 43 +#define RESET_IRQ_CTRL 45 +#define RESET_NIC_VAD 47 +#define RESET_NIC_AXI 48 +#define RESET_RAMA 49 +#define RESET_RAMB 50 +#define RESET_ROM 53 +#define RESET_SPIFC 54 +#define RESET_GIC 55 +#define RESET_UART_C 56 +#define RESET_UART_B 57 +#define RESET_UART_A 58 +#define RESET_OSC_RING 59 + +/* RESET2 Reserved */ + +#endif -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
The number of RESET registers and offset of RESET_LEVEL register for Meson-A1 are different from previous SoCs, In order to describe these differences, we introduce the struct meson_reset_param. Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> --- drivers/reset/reset-meson.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 7d05d76..94d7ba8 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -15,12 +15,16 @@ #include <linux/types.h> #include <linux/of_device.h> -#define REG_COUNT 8 #define BITS_PER_REG 32 -#define LEVEL_OFFSET 0x7c + +struct meson_reset_param { + int reg_count; + int level_offset; +}; struct meson_reset { void __iomem *reg_base; + const struct meson_reset_param *param; struct reset_controller_dev rcdev; spinlock_t lock; }; @@ -46,10 +50,12 @@ static int meson_reset_level(struct reset_controller_dev *rcdev, container_of(rcdev, struct meson_reset, rcdev); unsigned int bank = id / BITS_PER_REG; unsigned int offset = id % BITS_PER_REG; - void __iomem *reg_addr = data->reg_base + LEVEL_OFFSET + (bank << 2); + void __iomem *reg_addr; unsigned long flags; u32 reg; + reg_addr = data->reg_base + data->param->level_offset + (bank << 2); + spin_lock_irqsave(&data->lock, flags); reg = readl(reg_addr); @@ -81,10 +87,21 @@ static const struct reset_control_ops meson_reset_ops = { .deassert = meson_reset_deassert, }; +static const struct meson_reset_param meson8b_param = { + .reg_count = 8, + .level_offset = 0x7c, +}; + +static const struct meson_reset_param meson_a1_param = { + .reg_count = 3, + .level_offset = 0x40, +}; + static const struct of_device_id meson_reset_dt_ids[] = { - { .compatible = "amlogic,meson8b-reset" }, - { .compatible = "amlogic,meson-gxbb-reset" }, - { .compatible = "amlogic,meson-axg-reset" }, + { .compatible = "amlogic,meson8b-reset", .data = &meson8b_param}, + { .compatible = "amlogic,meson-gxbb-reset", .data = &meson8b_param}, + { .compatible = "amlogic,meson-axg-reset", .data = &meson8b_param}, + { .compatible = "amlogic,meson-a1-reset", .data = &meson_a1_param}, { /* sentinel */ }, }; @@ -102,12 +119,16 @@ static int meson_reset_probe(struct platform_device *pdev) if (IS_ERR(data->reg_base)) return PTR_ERR(data->reg_base); + data->param = of_device_get_match_data(&pdev->dev); + if (!data->param) + return -ENODEV; + platform_set_drvdata(pdev, data); spin_lock_init(&data->lock); data->rcdev.owner = THIS_MODULE; - data->rcdev.nr_resets = REG_COUNT * BITS_PER_REG; + data->rcdev.nr_resets = data->param->reg_count * BITS_PER_REG; data->rcdev.ops = &meson_reset_ops; data->rcdev.of_node = pdev->dev.of_node; -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Xingyu Chen <xingyu.chen@amlogic.com> writes: > Add DT bindings for the Meson-A1 SoC Reset Controller include file, > and also slightly update documentation. > > Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> > Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> The order here doesn't look right. As the sender, your sign-off should be last. Is Jianxin the author or are you? If Jianxin, there should be a "From:" line at the beginning of the changelog to indicate authorship that's different from the sender. > --- > .../bindings/reset/amlogic,meson-reset.yaml | 1 + > include/dt-bindings/reset/amlogic,meson-a1-reset.h | 59 ++++++++++++++++++++++ > 2 files changed, 60 insertions(+) > create mode 100644 include/dt-bindings/reset/amlogic,meson-a1-reset.h > > diff --git a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml > index 00917d8..b3f57d8 100644 > --- a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml > +++ b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml > @@ -16,6 +16,7 @@ properties: > - amlogic,meson8b-reset # Reset Controller on Meson8b and compatible SoCs > - amlogic,meson-gxbb-reset # Reset Controller on GXBB and compatible SoCs > - amlogic,meson-axg-reset # Reset Controller on AXG and compatible SoCs > + - amlogic,meson-a1-reset # Reset Controller on A1 and compatible SoCs > > reg: > maxItems: 1 > diff --git a/include/dt-bindings/reset/amlogic,meson-a1-reset.h b/include/dt-bindings/reset/amlogic,meson-a1-reset.h > new file mode 100644 > index 00000000..8d76a47 > --- /dev/null > +++ b/include/dt-bindings/reset/amlogic,meson-a1-reset.h > @@ -0,0 +1,59 @@ > +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) > + * > + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. > + * Author: Xingyu Chen <xingyu.chen@amlogic.com> > + * > + */ > + > +#ifndef _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H > +#define _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H > + > +/* RESET0 */ > +#define RESET_AM2AXI_VAD 1 minor nit: can you use comments/whitespace here to indicate holes? Please see the other amlogic files in this dir for examples. Kevin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi Xingyu, Xingyu Chen <xingyu.chen@amlogic.com> writes: > The number of RESET registers and offset of RESET_LEVEL register for > Meson-A1 are different from previous SoCs, In order to describe these > differences, we introduce the struct meson_reset_param. > > Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> > Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> > Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Again, order here isn't quite right. Add the reviewed-by tags first, and the sender should be the last sign-off. Other than that, driver looks good. Reviewed-by: Kevin Hilman <khilman@baylibre.com> Kevin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi, Kevin Thanks for your review On 2019/9/26 6:55, Kevin Hilman wrote: > Xingyu Chen <xingyu.chen@amlogic.com> writes: > >> Add DT bindings for the Meson-A1 SoC Reset Controller include file, >> and also slightly update documentation. >> >> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> >> Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> > > The order here doesn't look right. As the sender, your sign-off should > be last. Is Jianxin the author or are you? If Jianxin, there should be > a "From:" line at the beginning of the changelog to indicate authorship > that's different from the sender. I am an author for this patchset, i will reorder Signed-off in next version. > >> --- >> .../bindings/reset/amlogic,meson-reset.yaml | 1 + >> include/dt-bindings/reset/amlogic,meson-a1-reset.h | 59 ++++++++++++++++++++++ >> 2 files changed, 60 insertions(+) >> create mode 100644 include/dt-bindings/reset/amlogic,meson-a1-reset.h >> >> diff --git a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml >> index 00917d8..b3f57d8 100644 >> --- a/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml >> +++ b/Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml >> @@ -16,6 +16,7 @@ properties: >> - amlogic,meson8b-reset # Reset Controller on Meson8b and compatible SoCs >> - amlogic,meson-gxbb-reset # Reset Controller on GXBB and compatible SoCs >> - amlogic,meson-axg-reset # Reset Controller on AXG and compatible SoCs >> + - amlogic,meson-a1-reset # Reset Controller on A1 and compatible SoCs >> >> reg: >> maxItems: 1 >> diff --git a/include/dt-bindings/reset/amlogic,meson-a1-reset.h b/include/dt-bindings/reset/amlogic,meson-a1-reset.h >> new file mode 100644 >> index 00000000..8d76a47 >> --- /dev/null >> +++ b/include/dt-bindings/reset/amlogic,meson-a1-reset.h >> @@ -0,0 +1,59 @@ >> +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) >> + * >> + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. >> + * Author: Xingyu Chen <xingyu.chen@amlogic.com> >> + * >> + */ >> + >> +#ifndef _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H >> +#define _DT_BINDINGS_AMLOGIC_MESON_A1_RESET_H >> + >> +/* RESET0 */ >> +#define RESET_AM2AXI_VAD 1 > > minor nit: can you use comments/whitespace here to indicate holes? > Please see the other amlogic files in this dir for examples. I will fix it in next version. > > Kevin > > . > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi, Kevin Thanks for your reminder On 2019/9/26 6:57, Kevin Hilman wrote: > Hi Xingyu, > > Xingyu Chen <xingyu.chen@amlogic.com> writes: > >> The number of RESET registers and offset of RESET_LEVEL register for >> Meson-A1 are different from previous SoCs, In order to describe these >> differences, we introduce the struct meson_reset_param. >> >> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> >> Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com> >> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> > > Again, order here isn't quite right. Add the reviewed-by tags first, > and the sender should be the last sign-off. I will reorder Signed-off and Reviewed in next version > > Other than that, driver looks good. > > Reviewed-by: Kevin Hilman <khilman@baylibre.com > > Kevin > > . > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic