devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: a1: add saradc controller
@ 2019-12-03  7:32 Xingyu Chen
  2019-12-09 22:56 ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Xingyu Chen @ 2019-12-03  7:32 UTC (permalink / raw)
  To: Kevin Hilman, Neil Armstrong, Martin Blumenstingl
  Cc: Xingyu Chen, Rob Herring, Jonathan Cameron, Jerome Brunet,
	Qianggui Song, Jianxin Pan, Jian Hu, linux-iio, linux-amlogic,
	linux-arm-kernel, linux-kernel, devicetree

The saradc controller in Meson-A1 is the same as the Meson-G12 series SoCs,
so we use the same compatible string.

Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>

---
This patch is based on A1 clock patchset at [0].

[0] https://lore.kernel.org/linux-amlogic/20191129144605.182774-1-jian.hu@amlogic.com
---
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
index 7210ad0..cad1756 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
@@ -93,6 +93,21 @@
 				clock-names = "xtal", "pclk", "baud";
 				status = "disabled";
 			};
+
+			saradc: adc@2c00 {
+				compatible = "amlogic,meson-g12a-saradc",
+					     "amlogic,meson-saradc";
+				reg = <0x0 0x2c00 0x0 0x48>;
+				#io-channel-cells = <1>;
+				interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&xtal>,
+					 <&clkc_periphs CLKID_SARADC>,
+					 <&clkc_periphs CLKID_SARADC_CLK>,
+					 <&clkc_periphs CLKID_SARADC_SEL>;
+				clock-names = "clkin", "core", "adc_clk",
+					      "adc_sel";
+				status = "disabled";
+			};
 		};
 
 		gic: interrupt-controller@ff901000 {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: a1: add saradc controller
  2019-12-03  7:32 [PATCH] arm64: dts: a1: add saradc controller Xingyu Chen
@ 2019-12-09 22:56 ` Kevin Hilman
  2019-12-10  3:57   ` Xingyu Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2019-12-09 22:56 UTC (permalink / raw)
  To: Xingyu Chen, Neil Armstrong, Martin Blumenstingl
  Cc: Xingyu Chen, Rob Herring, Jonathan Cameron, Jerome Brunet,
	Qianggui Song, Jianxin Pan, Jian Hu, linux-iio, linux-amlogic,
	linux-arm-kernel, linux-kernel, devicetree

Xingyu Chen <xingyu.chen@amlogic.com> writes:

> The saradc controller in Meson-A1 is the same as the Meson-G12 series SoCs,
> so we use the same compatible string.
>
> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
>
> ---
> This patch is based on A1 clock patchset at [0].
>
> [0] https://lore.kernel.org/linux-amlogic/20191129144605.182774-1-jian.hu@amlogic.com
> ---
>  arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> index 7210ad0..cad1756 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
> @@ -93,6 +93,21 @@
>  				clock-names = "xtal", "pclk", "baud";
>  				status = "disabled";
>  			};
> +
> +			saradc: adc@2c00 {
> +				compatible = "amlogic,meson-g12a-saradc",
> +					     "amlogic,meson-saradc";
> +				reg = <0x0 0x2c00 0x0 0x48>;

Why 0x48 here?  AXG uses 0x38 and you're not adding any more registers
to this driver.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: a1: add saradc controller
  2019-12-09 22:56 ` Kevin Hilman
@ 2019-12-10  3:57   ` Xingyu Chen
  2019-12-10 18:41     ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Xingyu Chen @ 2019-12-10  3:57 UTC (permalink / raw)
  To: Kevin Hilman, Neil Armstrong, Martin Blumenstingl
  Cc: Rob Herring, Jonathan Cameron, Jerome Brunet, Qianggui Song,
	Jianxin Pan, Jian Hu, linux-iio, linux-amlogic, linux-arm-kernel,
	linux-kernel, devicetree

Hi, Kevin

On 2019/12/10 6:56, Kevin Hilman wrote:
> Xingyu Chen <xingyu.chen@amlogic.com> writes:
>
>> The saradc controller in Meson-A1 is the same as the Meson-G12 series SoCs,
>> so we use the same compatible string.
>>
>> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
>>
>> ---
>> This patch is based on A1 clock patchset at [0].
>>
>> [0] https://lore.kernel.org/linux-amlogic/20191129144605.182774-1-jian.hu@amlogic.com
>> ---
>>   arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>> index 7210ad0..cad1756 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>> @@ -93,6 +93,21 @@
>>   				clock-names = "xtal", "pclk", "baud";
>>   				status = "disabled";
>>   			};
>> +
>> +			saradc: adc@2c00 {
>> +				compatible = "amlogic,meson-g12a-saradc",
>> +					     "amlogic,meson-saradc";
>> +				reg = <0x0 0x2c00 0x0 0x48>;
> Why 0x48 here?  AXG uses 0x38 and you're not adding any more registers
> to this driver.

Thanks for you review.

The saradc introduces 4 new registers (as shown below) begin with g12a 
platform, and these registers are used
to save the sampling value of corresponding channel. In other words, we 
can choose fifo or new registers to save
sampling value, but it is not supported by the current driver.

dout register  |---> fifo
                          |---> channel regs -|
                                                            |--- channel-0
                                                            |--- channel-1
                                                            | ...
                                                            | --- channel-7

AO_SAR_ADC_CHNL01:saving sampling data of channel 0/1
AO_SAR_ADC_CHNL23:   saving sampling data of channel 2/3
AO_SAR_ADC_CHNL45:   saving sampling data of channel 4/5
AO_SAR_ADC_CHNL67:   saving sampling data of channel 6/7


This patch use the 0x48 to describe the registers length just follow the 
file meson-g12-common.dtsi. and it doesn't
affect the driver because of the mapped regiter length is limited by 
max_register member in struct regmap_config.

I can replace 0x48 with 0x38 in next patch if necessary.

> Kevin
>
> .
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: a1: add saradc controller
  2019-12-10  3:57   ` Xingyu Chen
@ 2019-12-10 18:41     ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2019-12-10 18:41 UTC (permalink / raw)
  To: Xingyu Chen, Neil Armstrong, Martin Blumenstingl
  Cc: Rob Herring, Jonathan Cameron, Jerome Brunet, Qianggui Song,
	Jianxin Pan, Jian Hu, linux-iio, linux-amlogic, linux-arm-kernel,
	linux-kernel, devicetree

Xingyu Chen <xingyu.chen@amlogic.com> writes:

> Hi, Kevin
>
> On 2019/12/10 6:56, Kevin Hilman wrote:
>> Xingyu Chen <xingyu.chen@amlogic.com> writes:
>>
>>> The saradc controller in Meson-A1 is the same as the Meson-G12 series SoCs,
>>> so we use the same compatible string.
>>>
>>> Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
>>>
>>> ---
>>> This patch is based on A1 clock patchset at [0].
>>>
>>> [0] https://lore.kernel.org/linux-amlogic/20191129144605.182774-1-jian.hu@amlogic.com
>>> ---
>>>   arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 15 +++++++++++++++
>>>   1 file changed, 15 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>>> index 7210ad0..cad1756 100644
>>> --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>>> +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
>>> @@ -93,6 +93,21 @@
>>>   				clock-names = "xtal", "pclk", "baud";
>>>   				status = "disabled";
>>>   			};
>>> +
>>> +			saradc: adc@2c00 {
>>> +				compatible = "amlogic,meson-g12a-saradc",
>>> +					     "amlogic,meson-saradc";
>>> +				reg = <0x0 0x2c00 0x0 0x48>;
>> Why 0x48 here?  AXG uses 0x38 and you're not adding any more registers
>> to this driver.
>
> Thanks for you review.
>
> The saradc introduces 4 new registers (as shown below) begin with g12a 
> platform, and these registers are used
> to save the sampling value of corresponding channel. In other words, we 
> can choose fifo or new registers to save
> sampling value, but it is not supported by the current driver.
>
> dout register  |---> fifo
>                           |---> channel regs -|
>                                                             |--- channel-0
>                                                             |--- channel-1
>                                                             | ...
>                                                             | --- channel-7
>
> AO_SAR_ADC_CHNL01:saving sampling data of channel 0/1
> AO_SAR_ADC_CHNL23:   saving sampling data of channel 2/3
> AO_SAR_ADC_CHNL45:   saving sampling data of channel 4/5
> AO_SAR_ADC_CHNL67:   saving sampling data of channel 6/7

I understand there are new registers in the hardware, but I don't think
the current driver is using those.  Please correct me if I'm wrong.

> This patch use the 0x48 to describe the registers length just follow the 
> file meson-g12-common.dtsi.

OK, my fault. I was comparing with AXG instead of G12A.  But still, if
the driver is not using those registers, then g12 DT files are wrong too.

That being said, I'm not going to be too picky about that.  

> and it doesn't affect the driver because of the mapped regiter length
> is limited by max_register member in struct regmap_config.
>
> I can replace 0x48 with 0x38 in next patch if necessary.

Since G12 is already using 0x48 and this device is compatible with G12,
I'm fine leaving it at 0x48.

Thanks,

Kevin


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-10 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  7:32 [PATCH] arm64: dts: a1: add saradc controller Xingyu Chen
2019-12-09 22:56 ` Kevin Hilman
2019-12-10  3:57   ` Xingyu Chen
2019-12-10 18:41     ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).