diff mbox

[1/3] ARM: at91/soc: add basic support for new sama5d2 SoC

Message ID fe6d862c640a3708e80c0cc4c694ab5d9079060b.1434632966.git.nicolas.ferre@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Ferre June 18, 2015, 1:18 p.m. UTC
Add Kconfig entries, header file changes and addition to the documentation.
The early debug infrastructure is also added for easy development.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 Documentation/arm/Atmel/README                       |  6 ++++++
 Documentation/devicetree/bindings/arm/atmel-at91.txt |  2 ++
 arch/arm/Kconfig.debug                               |  6 ++++++
 arch/arm/include/debug/at91.S                        |  5 ++++-
 arch/arm/mach-at91/Kconfig                           | 12 ++++++++++++
 arch/arm/mach-at91/sama5.c                           |  3 +++
 arch/arm/mach-at91/soc.h                             |  3 +++
 7 files changed, 36 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni June 18, 2015, 3:21 p.m. UTC | #1
Hi,

On 18/06/2015 at 15:18:28 +0200, Nicolas Ferre wrote :
> diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
> index c53a19b4aab2..6650a8ffaa64 100644
> --- a/Documentation/arm/Atmel/README
> +++ b/Documentation/arm/Atmel/README
> @@ -90,6 +90,12 @@ the Atmel website: http://www.atmel.com.
>          + Datasheet
>            http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>  
> +    * ARM Cortex-A5 + NEON based SoCs
> +      - sama5d2 family
> +        - sama5d27
> +        + Datasheet
> +          Coming soon

Shouldn't that go directly before or after the sama5d4 family ?

> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> index f1b157971366..140228d033c2 100644
> --- a/arch/arm/Kconfig.debug
> +++ b/arch/arm/Kconfig.debug
> @@ -141,6 +141,12 @@ choice
>  		depends on ARCH_AT91
>  		depends on SOC_SAMA5
>  
> +	config AT91_DEBUG_LL_DBGU3
> +		bool "Kernel low-level debugging on sama5d2"
> +		select DEBUG_AT91_UART
> +		depends on ARCH_AT91
> +		depends on SOC_SAMA5
> +

I think that at some point we'll have to kill those AT91_DEBUG_LL_*
which are actually board specific and not soc specific. I already have a
patch for that that I need to rebase.

> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 43ec794d1057..e53780a28605 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -8,6 +8,18 @@ menuconfig ARCH_AT91
>  	select SOC_BUS
>  
>  if ARCH_AT91
> +config SOC_SAMA5D2
> +	bool "SAMA5D2 family" if ARCH_MULTI_V7
> +	select SOC_SAMA5
> +	select CACHE_L2X0
> +	select HAVE_FB_ATMEL
> +	select HAVE_AT91_UTMI
> +	select HAVE_AT91_USB_CLK
> +	select HAVE_AT91_H32MX
> +	select HAVE_AT91_GENERATED

Seeing that, I think HAVE_AT91_GENERATED should include CLK somewhere in
the name as this is only related to clocks.
Nicolas Ferre June 29, 2015, 12:46 p.m. UTC | #2
Le 18/06/2015 17:21, Alexandre Belloni a écrit :
> Hi,
> 
> On 18/06/2015 at 15:18:28 +0200, Nicolas Ferre wrote :
>> diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
>> index c53a19b4aab2..6650a8ffaa64 100644
>> --- a/Documentation/arm/Atmel/README
>> +++ b/Documentation/arm/Atmel/README
>> @@ -90,6 +90,12 @@ the Atmel website: http://www.atmel.com.
>>          + Datasheet
>>            http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>>  
>> +    * ARM Cortex-A5 + NEON based SoCs
>> +      - sama5d2 family
>> +        - sama5d27
>> +        + Datasheet
>> +          Coming soon
> 
> Shouldn't that go directly before or after the sama5d4 family ?

This is "after" sama5d4: I sorted this file according to SoC release
date whereas I sorted the other entries in alpa-numerial order (sama5d2
placed before sama5d3).

Is it what you answered?

>> diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
>> index f1b157971366..140228d033c2 100644
>> --- a/arch/arm/Kconfig.debug
>> +++ b/arch/arm/Kconfig.debug
>> @@ -141,6 +141,12 @@ choice
>>  		depends on ARCH_AT91
>>  		depends on SOC_SAMA5
>>  
>> +	config AT91_DEBUG_LL_DBGU3
>> +		bool "Kernel low-level debugging on sama5d2"
>> +		select DEBUG_AT91_UART
>> +		depends on ARCH_AT91
>> +		depends on SOC_SAMA5
>> +
> 
> I think that at some point we'll have to kill those AT91_DEBUG_LL_*
> which are actually board specific and not soc specific. I already have a
> patch for that that I need to rebase.

Ok, it could definitively simplify the last weird bits of our
sub-architecture ;-)


>> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
>> index 43ec794d1057..e53780a28605 100644
>> --- a/arch/arm/mach-at91/Kconfig
>> +++ b/arch/arm/mach-at91/Kconfig
>> @@ -8,6 +8,18 @@ menuconfig ARCH_AT91
>>  	select SOC_BUS
>>  
>>  if ARCH_AT91
>> +config SOC_SAMA5D2
>> +	bool "SAMA5D2 family" if ARCH_MULTI_V7
>> +	select SOC_SAMA5
>> +	select CACHE_L2X0
>> +	select HAVE_FB_ATMEL
>> +	select HAVE_AT91_UTMI
>> +	select HAVE_AT91_USB_CLK
>> +	select HAVE_AT91_H32MX
>> +	select HAVE_AT91_GENERATED
> 
> Seeing that, I think HAVE_AT91_GENERATED should include CLK somewhere in
> the name as this is only related to clocks.

Absolutely, I changed it to HAVE_AT91_GENERATED_CLK which is somehow
better. Also changed in my "generated clock" series sent to Boris.

Thanks for your review. Bye,
Alexandre Belloni June 29, 2015, 3:04 p.m. UTC | #3
On 29/06/2015 at 14:46:51 +0200, Nicolas Ferre wrote :
> Le 18/06/2015 17:21, Alexandre Belloni a écrit :
> > Hi,
> > 
> > On 18/06/2015 at 15:18:28 +0200, Nicolas Ferre wrote :
> >> diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
> >> index c53a19b4aab2..6650a8ffaa64 100644
> >> --- a/Documentation/arm/Atmel/README
> >> +++ b/Documentation/arm/Atmel/README
> >> @@ -90,6 +90,12 @@ the Atmel website: http://www.atmel.com.
> >>          + Datasheet
> >>            http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
> >>  
> >> +    * ARM Cortex-A5 + NEON based SoCs
> >> +      - sama5d2 family
> >> +        - sama5d27
> >> +        + Datasheet
> >> +          Coming soon
> > 
> > Shouldn't that go directly before or after the sama5d4 family ?
> 
> This is "after" sama5d4: I sorted this file according to SoC release
> date whereas I sorted the other entries in alpa-numerial order (sama5d2
> placed before sama5d3).
> 
> Is it what you answered?
> 

No, I meant doing something like:

    * ARM Cortex-A5 + NEON based SoCs
      - sama5d4 family
        - sama5d41
        - sama5d42
        - sama5d43
        - sama5d44 (device superset)
        + Datasheet
          http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
      - sama5d2 family
        - sama5d27
        + Datasheet
          Coming soon

Else, you end up with two "ARM Cortex-A5 + NEON based SoCs" sections.
Nicolas Ferre July 28, 2015, 8:54 a.m. UTC | #4
Le 29/06/2015 17:04, Alexandre Belloni a écrit :
> On 29/06/2015 at 14:46:51 +0200, Nicolas Ferre wrote :
>> Le 18/06/2015 17:21, Alexandre Belloni a écrit :
>>> Hi,
>>>
>>> On 18/06/2015 at 15:18:28 +0200, Nicolas Ferre wrote :
>>>> diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
>>>> index c53a19b4aab2..6650a8ffaa64 100644
>>>> --- a/Documentation/arm/Atmel/README
>>>> +++ b/Documentation/arm/Atmel/README
>>>> @@ -90,6 +90,12 @@ the Atmel website: http://www.atmel.com.
>>>>          + Datasheet
>>>>            http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>>>>  
>>>> +    * ARM Cortex-A5 + NEON based SoCs
>>>> +      - sama5d2 family
>>>> +        - sama5d27
>>>> +        + Datasheet
>>>> +          Coming soon
>>>
>>> Shouldn't that go directly before or after the sama5d4 family ?
>>
>> This is "after" sama5d4: I sorted this file according to SoC release
>> date whereas I sorted the other entries in alpa-numerial order (sama5d2
>> placed before sama5d3).
>>
>> Is it what you answered?
>>
> 
> No, I meant doing something like:
> 
>     * ARM Cortex-A5 + NEON based SoCs
>       - sama5d4 family
>         - sama5d41
>         - sama5d42
>         - sama5d43
>         - sama5d44 (device superset)
>         + Datasheet
>           http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>       - sama5d2 family
>         - sama5d27
>         + Datasheet
>           Coming soon
> 
> Else, you end up with two "ARM Cortex-A5 + NEON based SoCs" sections.

Oh, yes. Sure, I'll modify this.

Do you think that it's worth sending another series or I can take it for
the pull-request when it's modified?

Bye,
Nicolas Ferre July 28, 2015, 9:38 a.m. UTC | #5
Le 28/07/2015 10:54, Nicolas Ferre a écrit :
> Le 29/06/2015 17:04, Alexandre Belloni a écrit :
>> On 29/06/2015 at 14:46:51 +0200, Nicolas Ferre wrote :
>>> Le 18/06/2015 17:21, Alexandre Belloni a écrit :
>>>> Hi,
>>>>
>>>> On 18/06/2015 at 15:18:28 +0200, Nicolas Ferre wrote :
>>>>> diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
>>>>> index c53a19b4aab2..6650a8ffaa64 100644
>>>>> --- a/Documentation/arm/Atmel/README
>>>>> +++ b/Documentation/arm/Atmel/README
>>>>> @@ -90,6 +90,12 @@ the Atmel website: http://www.atmel.com.
>>>>>          + Datasheet
>>>>>            http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>>>>>  
>>>>> +    * ARM Cortex-A5 + NEON based SoCs
>>>>> +      - sama5d2 family
>>>>> +        - sama5d27
>>>>> +        + Datasheet
>>>>> +          Coming soon
>>>>
>>>> Shouldn't that go directly before or after the sama5d4 family ?
>>>
>>> This is "after" sama5d4: I sorted this file according to SoC release
>>> date whereas I sorted the other entries in alpa-numerial order (sama5d2
>>> placed before sama5d3).
>>>
>>> Is it what you answered?
>>>
>>
>> No, I meant doing something like:
>>
>>     * ARM Cortex-A5 + NEON based SoCs
>>       - sama5d4 family
>>         - sama5d41
>>         - sama5d42
>>         - sama5d43
>>         - sama5d44 (device superset)
>>         + Datasheet
>>           http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
>>       - sama5d2 family
>>         - sama5d27
>>         + Datasheet
>>           Coming soon
>>
>> Else, you end up with two "ARM Cortex-A5 + NEON based SoCs" sections.
> 
> Oh, yes. Sure, I'll modify this.
> 
> Do you think that it's worth sending another series or I can take it for
> the pull-request when it's modified?

Actually, I realized that I have some more nodes to add to the DT
descriptions, to it's worth sending a v2 of this series...

Bye,
diff mbox

Patch

diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README
index c53a19b4aab2..6650a8ffaa64 100644
--- a/Documentation/arm/Atmel/README
+++ b/Documentation/arm/Atmel/README
@@ -90,6 +90,12 @@  the Atmel website: http://www.atmel.com.
         + Datasheet
           http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf
 
+    * ARM Cortex-A5 + NEON based SoCs
+      - sama5d2 family
+        - sama5d27
+        + Datasheet
+          Coming soon
+
 
 Linux kernel information
 ------------------------
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 424ac8cbfa08..7f04b8ae4ca9 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -27,6 +27,8 @@  compatible: must be one of:
     o "atmel,at91sam9xe"
  * "atmel,sama5" for SoCs using a Cortex-A5, shall be extended with the specific
    SoC family:
+    o "atmel,sama5d2" shall be extended with the specific SoC compatible:
+       - "atmel,sama5d27"
     o "atmel,sama5d3" shall be extended with the specific SoC compatible:
        - "atmel,sama5d31"
        - "atmel,sama5d33"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index f1b157971366..140228d033c2 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -141,6 +141,12 @@  choice
 		depends on ARCH_AT91
 		depends on SOC_SAMA5
 
+	config AT91_DEBUG_LL_DBGU3
+		bool "Kernel low-level debugging on sama5d2"
+		select DEBUG_AT91_UART
+		depends on ARCH_AT91
+		depends on SOC_SAMA5
+
 	config DEBUG_BCM2835
 		bool "Kernel low-level debugging on BCM2835 PL011 UART"
 		depends on ARCH_BCM2835
diff --git a/arch/arm/include/debug/at91.S b/arch/arm/include/debug/at91.S
index c3c45e628e33..2556a8801c8c 100644
--- a/arch/arm/include/debug/at91.S
+++ b/arch/arm/include/debug/at91.S
@@ -13,9 +13,12 @@ 
 #define AT91_DBGU 0xfffff200 /* AT91_BASE_DBGU0 */
 #elif defined(CONFIG_AT91_DEBUG_LL_DBGU1)
 #define AT91_DBGU 0xffffee00 /* AT91_BASE_DBGU1 */
-#else
+#elif defined(CONFIG_AT91_DEBUG_LL_DBGU2)
 /* On sama5d4, use USART3 as low level serial console */
 #define AT91_DBGU 0xfc00c000 /* SAMA5D4_BASE_USART3 */
+#else
+/* On sama5d2, use UART1 as low level serial console */
+#define AT91_DBGU 0xf8020000
 #endif
 
 #ifdef CONFIG_MMU
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 43ec794d1057..e53780a28605 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -8,6 +8,18 @@  menuconfig ARCH_AT91
 	select SOC_BUS
 
 if ARCH_AT91
+config SOC_SAMA5D2
+	bool "SAMA5D2 family" if ARCH_MULTI_V7
+	select SOC_SAMA5
+	select CACHE_L2X0
+	select HAVE_FB_ATMEL
+	select HAVE_AT91_UTMI
+	select HAVE_AT91_USB_CLK
+	select HAVE_AT91_H32MX
+	select HAVE_AT91_GENERATED
+	help
+	  Select this if ou are using one of Atmel's SAMA5D2 family SoC.
+
 config SOC_SAMA5D3
 	bool "SAMA5D3 family" if ARCH_MULTI_V7
 	select SOC_SAMA5
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index 41d829d8e7d5..90c3c3051ae7 100644
--- a/arch/arm/mach-at91/sama5.c
+++ b/arch/arm/mach-at91/sama5.c
@@ -18,6 +18,8 @@ 
 #include "soc.h"
 
 static const struct at91_soc sama5_socs[] = {
+	AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27_EXID_MATCH,
+		 "sama5d27", "sama5d2"),
 	AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D31_EXID_MATCH,
 		 "sama5d31", "sama5d3"),
 	AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D33_EXID_MATCH,
@@ -64,6 +66,7 @@  DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
 MACHINE_END
 
 static const char *sama5_alt_dt_board_compat[] __initconst = {
+	"atmel,sama5d2",
 	"atmel,sama5d4",
 	NULL
 };
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index be23c400596b..8ede0ef86172 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -62,6 +62,9 @@  at91_soc_init(const struct at91_soc *socs);
 #define AT91SAM9XE256_CIDR_MATCH	0x329a93a0
 #define AT91SAM9XE512_CIDR_MATCH	0x329aa3a0
 
+#define SAMA5D2_CIDR_MATCH		0x0a5c08c0
+#define SAMA5D27_EXID_MATCH		0x00000021
+
 #define SAMA5D3_CIDR_MATCH		0x0a5c07c0
 #define SAMA5D31_EXID_MATCH		0x00444300
 #define SAMA5D33_EXID_MATCH		0x00414300