SAMA5D3 support
Subsystems (5)
cover SAMA5D3 support
From: Ludovic Desroches <[email protected]>
Hi,
This set of patches introduces basic support for the SAMA5D3 family. It is based on Jean-Christophe Kconfig cleanup patch series available at:
git://github.com/at91linux/linux-at91.git delivery/at91_3.9_dt_cleanup
Regards
Ludovic Desroches (4):
ARM: at91: add AT91_SAM9_TIME entry to select at91sam926x_time.c
compilation
ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7
arch
ARM: at91: fix infinite loop in at91_irq_suspend/resume
ARM: at91: introduce SAMA5 support
arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 60 +- arch/arm/mach-at91/Makefile | 7 +- arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/irq.c | 20 +- arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 22 files changed, 2486 insertions(+), 46 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c
Signature · 1 line
1.7.11.3
PATCH 1/4 ARM: at91: add AT91_SAM9_TIME entry to select at91sam926x_time.c compilation
From: Ludovic Desroches <[email protected]>
No more associate at91sam926x_time.c compilation with SOC_AT91SAM9 entry since SAMA5D3 devices will use this driver too.
--- arch/arm/mach-at91/Kconfig | 4 ++++ arch/arm/mach-at91/Makefile | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-at91/Kconfig +4 -0
@@ -14,8 +14,12 @@ config AT91_SAM9G45_RESET bool default !ARCH_AT91X40 +config AT91_SAM9_TIME + bool + config SOC_AT91SAM9 bool + select AT91_SAM9_TIME select CPU_ARM926T select GENERIC_CLOCKEVENTS select MULTI_IRQ_HANDLER
arch/arm/mach-at91/Makefile +2 -1
@@ -10,7 +10,8 @@ obj- := obj-$(CONFIG_AT91_PMC_UNIT) += clock.o obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o -obj-$(CONFIG_SOC_AT91SAM9) += at91sam926x_time.o sam9_smc.o +obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o +obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o # CPU-specific support obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o
Signature · 1 line
1.7.11.3
PATCH 2/4 ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7 arch
In reply to ludovic.desroches at atmel.comFrom: Ludovic Desroches <[email protected]>
As we will introduce SAMA5, we need to distinguish the core architecture. It is useless to show ARMv4/5 entries if we are configuring a kernel for SAMA5 devices.
--- arch/arm/mach-at91/Kconfig | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
arch/arm/mach-at91/Kconfig +18 -4
@@ -6,6 +6,10 @@ config HAVE_AT91_DBGU0 config HAVE_AT91_DBGU1 bool +config AT91_PMC_UNIT + bool + default !ARCH_AT91X40 + config AT91_SAM9_ALT_RESET bool default !ARCH_AT91X40
@@ -27,8 +31,21 @@ config SOC_AT91SAM9 menu "Atmel AT91 System-on-Chip" +choice + + prompt "Core type" + +config SOC_SAM_V4_V5 + bool "ARM7/ARM9" + help + Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 + or AT91X40 SoC. + +endchoice + comment "Atmel AT91 Processor" +if SOC_SAM_V4_V5 config SOC_AT91RM9200 bool "AT91RM9200" select CPU_ARM920T
@@ -94,13 +111,10 @@ config SOC_AT91SAM9N12 help Select this if you are using Atmel's AT91SAM9N12 SoC. -config AT91_PMC_UNIT - bool - default !ARCH_AT91X40 - # ---------------------------------------------------------- source arch/arm/mach-at91/Kconfig.non_dt +endif # SOC_SAM_V4_V5 comment "Generic Board Type"
Signature · 1 line
1.7.11.3
PATCH 2/4 ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7 arch
Quoted 7 lines · ludovic.desroches at atmel.com
From: Ludovic Desroches <[email protected]>
As we will introduce SAMA5, we need to distinguish the core architecture. It is useless to show ARMv4/5 entries if we are configuring a kernel for SAMA5 devices.
Signed-off-by Ludovic Desroches <[email protected]>
Best Regards,
J.
Quoted 59 lines
--- arch/arm/mach-at91/Kconfig | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)arch/arm/mach-at91/Kconfig +18
-4@@ -6,6 +6,10 @@ config HAVE_AT91_DBGU0 config HAVE_AT91_DBGU1 bool +config AT91_PMC_UNIT + bool + default !ARCH_AT91X40 + config AT91_SAM9_ALT_RESET bool default !ARCH_AT91X40@@ -27,8 +31,21 @@ config SOC_AT91SAM9 menu "Atmel AT91 System-on-Chip" +choice + + prompt "Core type" + +config SOC_SAM_V4_V5 + bool "ARM7/ARM9" + help + Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 + or AT91X40 SoC. + +endchoice + comment "Atmel AT91 Processor" +if SOC_SAM_V4_V5 config SOC_AT91RM9200 bool "AT91RM9200" select CPU_ARM920T@@ -94,13 +111,10 @@ config SOC_AT91SAM9N12 help Select this if you are using Atmel's AT91SAM9N12 SoC. -config AT91_PMC_UNIT - bool - default !ARCH_AT91X40 - # ---------------------------------------------------------- source arch/arm/mach-at91/Kconfig.non_dt +endif # SOC_SAM_V4_V5 comment "Generic Board Type"Signature · 1 line
1.7.11.3
PATCH 3/4 ARM: at91: fix infinite loop in at91_irq_suspend/resume
In reply to ludovic.desroches at atmel.comFrom: Ludovic Desroches <[email protected]>
Fix an infinite loop when suspending or resuming a device with AIC5 i.e. SAMA5 devices.
--- arch/arm/mach-at91/irq.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
arch/arm/mach-at91/irq.c +8 -12
@@ -92,23 +92,21 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)void at91_irq_suspend (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable enabled irqs */ -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable wakeup irqs */ - i =0 ; -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *backups);
@@ -118,23 +116,21 @@ void at91_irq_suspend(void)void at91_irq_resume (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable wakeup irqs */ -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable irqs disabled for suspend */ - i =0 ; -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *wakeups);
Signature · 1 line
1.7.11.3
PATCH 3/4 ARM: at91: fix infinite loop in at91_irq_suspend/resume
Quoted 6 lines · ludovic.desroches at atmel.com
From: Ludovic Desroches <[email protected]>
Fix an infinite loop when suspending or resuming a device with AIC5 i.e. SAMA5 devices.
Signed-off-by Ludovic Desroches <[email protected]>
Best Regards,
J.
Quoted 67 lines
--- arch/arm/mach-at91/irq.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)arch/arm/mach-at91/irq.c +8
-12@@ -92,23 +92,21 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)void at91_irq_suspend (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable enabled irqs */ -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable wakeup irqs */ - i =0 ; -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *backups);@@ -118,23 +116,21 @@ void at91_irq_suspend(void)void at91_irq_resume (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable wakeup irqs */ -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable irqs disabled for suspend */ - i =0 ; -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *wakeups);Signature · 1 line
1.7.11.3
PATCH 3/4 ARM: at91: fix infinite loop in at91_irq_suspend/resume
On 03/08/2013 04:58 PM, Jean-Christophe PLAGNIOL-VILLARD :
Quoted 8 lines · ludovic.desroches at atmel.com
Quoted 6 lines
From: Ludovic Desroches <[email protected]>
Fix an infinite loop when suspending or resuming a device with AIC5 i.e. SAMA5 devices.
Signed-off-by Ludovic Desroches <[email protected]>
I think that we can queue this one for "fixes".
I integrated it in at91-3.9-fixes branch. It means that you can drop this one from your patch series.
Thanks, best regards.
Quoted 72 lines
Best Regards,
J.Quoted 67 lines
--- arch/arm/mach-at91/irq.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)arch/arm/mach-at91/irq.c +8
-12@@ -92,23 +92,21 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)void at91_irq_suspend (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable enabled irqs */ -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable wakeup irqs */ - i =0 ; -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *backups);@@ -118,23 +116,21 @@ void at91_irq_suspend(void)void at91_irq_resume (void ) { -int i =0 , bit; +int bit =-1 ;if (has_aic5 ()) {/* disable wakeup irqs */ -while ((bit =find_next_bit (wakeups, n_irqs, i)) < n_irqs) { +while ((bit =find_next_bit (wakeups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IDCR ,1 ); - i = bit; }/* enable irqs disabled for suspend */ - i =0 ; -while ((bit =find_next_bit (backups, n_irqs, i)) < n_irqs) { + bit =-1 ; +while ((bit =find_next_bit (backups, n_irqs, bit +1 )) < n_irqs) {at91_aic_write (AT91_AIC5_SSR , bit &AT91_AIC5_INTSEL_MSK );at91_aic_write (AT91_AIC5_IECR ,1 ); - i = bit; } }else {at91_aic_write (AT91_AIC_IDCR , *wakeups);Signature · 1 line
1.7.11.3
Signature · 1 line
Nicolas Ferre
PATCH 4/4 ARM: at91: introduce SAMA5 support
In reply to ludovic.desroches at atmel.comFrom: Ludovic Desroches <[email protected]>
This patch introduces the SAMA5 support. It also updates the PMC driver to manage clock division which is a requirement since some peripherals can't work at the bus frequency on SAMA5.
--- arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 34 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 21 files changed, 2454 insertions(+), 29 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c
arch/arm/boot/dts/Makefile +5 -0
@@ -31,6 +31,11 @@ dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb +# sama5d3 +dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb +dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb +dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb +dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
arch/arm/boot/dts/sama5d3.dtsi new file +1031 -0
1,031 lines not on this page · raw message
arch/arm/boot/dts/sama5d31ek.dts new file +51 -0
51 lines not on this page · raw message
arch/arm/boot/dts/sama5d33ek.dts new file +44 -0
44 lines not on this page · raw message
arch/arm/boot/dts/sama5d34ek.dts new file +61 -0
61 lines not on this page · raw message
arch/arm/boot/dts/sama5d35ek.dts new file +56 -0
56 lines not on this page · raw message
arch/arm/boot/dts/sama5d3xcm.dtsi new file +91 -0
91 lines not on this page · raw message
arch/arm/boot/dts/sama5d3xdm.dtsi new file +42 -0
42 lines not on this page · raw message
arch/arm/boot/dts/sama5d3xmb.dtsi new file +166 -0
166 lines not on this page · raw message
arch/arm/configs/sama5_defconfig new file +181 -0
181 lines not on this page · raw message
arch/arm/mach-at91/Kconfig +34 -0
@@ -29,6 +29,14 @@ config SOC_AT91SAM9 select MULTI_IRQ_HANDLER select SPARSE_IRQ +config SOC_SAMA5 + bool + select AT91_SAM9_TIME + select CPU_V7 + select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ + menu "Atmel AT91 System-on-Chip" choice
@@ -41,10 +49,28 @@ config SOC_SAM_V4_V5 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 or AT91X40 SoC. +config SOC_SAM_V7 + bool "Cortex A5" + help + Select this if you are using one of Atmel's SAMA5D3 SoC. + endchoice comment "Atmel AT91 Processor" +if SOC_SAM_V7 +config SOC_SAMA5D3 + bool "SAMA5D3 family" + depends on SOC_SAM_V7 + select SOC_SAMA5 + select HAVE_FB_ATMEL + select HAVE_NET_MACB + select HAVE_AT91_DBGU1 + help + Select this if you are using one of Atmel's SAMA5D3 family SoC. + This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. +endif + if SOC_SAM_V4_V5 config SOC_AT91RM9200 bool "AT91RM9200"
@@ -134,6 +160,14 @@ config MACH_AT91SAM9_DT Select this if you want to experiment device-tree with an Atmel Evaluation Kit. +config MACH_SAMA5_DT + bool "Atmel SAMA5 Evaluation Kits with device-tree support" + depends on SOC_SAMA5 + select USE_OF + help + Select this if you want to experiment device-tree with + an Atmel Evaluation Kit. + # ---------------------------------------------------------- comment "AT91 Feature Selections"
arch/arm/mach-at91/Makefile +4 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o +obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
@@ -91,6 +92,9 @@ obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o +# SAMA5 board with device-tree +obj-$(CONFIG_MACH_SAMA5_DT) += board-dt-sama5.o + # AT91X40 board-specific support obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
arch/arm/mach-at91/board-dt-sama5.c new file +86 -0
86 lines not on this page · raw message
arch/arm/mach-at91/clock.c +84 -25
207 lines not on this page · raw message
arch/arm/mach-at91/clock.h +2 -0
@@ -20,7 +20,9 @@ struct clk {const char *name;/* unique clock name */ struct clk_lookup cl;unsigned long rate_hz; +unsigned div;/* parent clock divider */ struct clk *parent; +unsigned pid;/* peripheral ID */ u32 pmc_mask;void (*mode)(struct clk *,int ); unsigned id:3; /* PCK0..4, or 32k/main/a/b */
arch/arm/mach-at91/include/mach/at91_pmc.h +14 -4
@@ -75,6 +75,9 @@ extern void __iomem *at91_pmc_base;#define AT91_PMC_PLLCOUNT (0x3f << 8)/* PLL Counter */ #define AT91_PMC_OUT (3 << 14)/* PLL Clock Frequency Range */ #define AT91_PMC_MUL (0x7ff << 16)/* PLL Multiplier */ +#define AT91_PMC_MUL_GET (n) ((n) >> 16 & 0x7ff) +#define AT91_PMC3_MUL (0x7f << 18)/* PLL Multiplier [SAMA5 only] */ +#define AT91_PMC3_MUL_GET (n) ((n) >> 18 & 0x7f)#define AT91_PMC_USBDIV (3 << 28)/* USB Divisor (PLLB only) */ #define AT91_PMC_USBDIV_1 (0 << 28)#define AT91_PMC_USBDIV_2 (1 << 28)
@@ -167,11 +170,18 @@ extern void __iomem *at91_pmc_base;#define AT91_PMC_WPVS (0x1 << 0)/* Write Protect Violation Status */ #define AT91_PMC_WPVSRC (0xffff << 8)/* Write Protect Violation Source */ -#define AT91_PMC_PCR 0x10c/* Peripheral Control Register [some SAM9] */ +#define AT91_PMC_PCER1 0x100/* Peripheral Clock Enable Register 1 [SAMA5 only]*/ +#define AT91_PMC_PCDR1 0x104/* Peripheral Clock Enable Register 1 */ +#define AT91_PMC_PCSR1 0x108/* Peripheral Clock Enable Register 1 */ + +#define AT91_PMC_PCR 0x10c/* Peripheral Control Register [some SAM9 and SAMA5] */ #define AT91_PMC_PCR_PID (0x3f << 0)/* Peripheral ID */ -#define AT91_PMC_PCR_CMD (0x1 << 12)/* Command */ -#define AT91_PMC_PCR_DIV (0x3 << 16)/* Divisor Value */ -#define AT91_PMC_PCRDIV (n) (((n) << 16) & AT91_PMC_PCR_DIV) +#define AT91_PMC_PCR_CMD (0x1 << 12)/* Command (read=0, write=1) */ +#define AT91_PMC_PCR_DIV (n) ((n) << 16)/* Divisor Value */ +#define AT91_PMC_PCR_DIV0 0x0/* Peripheral clock is MCK */ +#define AT91_PMC_PCR_DIV2 0x2/* Peripheral clock is MCK/2 */ +#define AT91_PMC_PCR_DIV4 0x4/* Peripheral clock is MCK/4 */ +#define AT91_PMC_PCR_DIV8 0x8/* Peripheral clock is MCK/8 */ #define AT91_PMC_PCR_EN (0x1 << 28)/* Enable */ #endif
arch/arm/mach-at91/include/mach/cpu.h +20 -0
@@ -36,6 +36,8 @@#define ARCH_ID_AT91M40807 0x14080745#define ARCH_ID_AT91R40008 0x44000840 +#define ARCH_ID_SAMA5D3 0x8A5C07C0 +#define ARCH_EXID_AT91SAM9M11 0x00000001#define ARCH_EXID_AT91SAM9M10 0x00000002#define ARCH_EXID_AT91SAM9G46 0x00000003
@@ -47,6 +49,11 @@#define ARCH_EXID_AT91SAM9G25 0x00000003#define ARCH_EXID_AT91SAM9X25 0x00000004 +#define ARCH_EXID_SAMA5D31 0x00444300 +#define ARCH_EXID_SAMA5D33 0x00414300 +#define ARCH_EXID_SAMA5D34 0x00414301 +#define ARCH_EXID_SAMA5D35 0x00584300 +#define ARCH_FAMILY_AT91X92 0x09200000#define ARCH_FAMILY_AT91SAM9 0x01900000#define ARCH_FAMILY_AT91SAM9XE 0x02900000
@@ -75,6 +82,9 @@ enum at91_soc_type {/* SAM9N12 */ AT91_SOC_SAM9N12 , +/* SAMA5D3 */ +AT91_SOC_SAMA5D3 , +/* Unknown type */ AT91_SOC_NONE };
@@ -93,6 +103,10 @@ enum at91_soc_subtype {AT91_SOC_SAM9G15 ,AT91_SOC_SAM9G35 ,AT91_SOC_SAM9X35 ,AT91_SOC_SAM9G25 ,AT91_SOC_SAM9X25 , +/* SAMA5D3 */ +AT91_SOC_SAMA5D31 ,AT91_SOC_SAMA5D33 ,AT91_SOC_SAMA5D34 , +AT91_SOC_SAMA5D35 , +/* Unknown subtype */ AT91_SOC_SUBTYPE_NONE };
@@ -187,6 +201,12 @@ static inline int at91_soc_is_detected(void)#define cpu_is_at91sam9n12 () (0)#endif +#ifdef CONFIG_SOC_SAMA5D3 +#define cpu_is_sama5d3 () (at91_soc_initdata.type == AT91_SOC_SAMA5D3) +#else +#define cpu_is_sama5d3 () (0) +#endif +/* * Since this is ARM, we will never run on any AVR32 CPU. But these * definitions may reduce clutter in common drivers.
arch/arm/mach-at91/include/mach/sama5d3.h new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-at91/sama5d3.c new file +377 -0
377 lines not on this page · raw message
arch/arm/mach-at91/setup.c +27 -0
@@ -151,6 +151,11 @@ static void __init soc_detect(u32 dbgu_base) at91_soc_initdata.type =AT91_SOC_SAM9N12 ; at91_boot_soc = at91sam9n12_soc;break ; + +case ARCH_ID_SAMA5D3 : + at91_soc_initdata.type =AT91_SOC_SAMA5D3 ; + at91_boot_soc = sama5d3_soc; +break ; }/* at91sam9g10 */
@@ -206,6 +211,23 @@ static void __init soc_detect(u32 dbgu_base)break ; } } + +if (at91_soc_initdata.type ==AT91_SOC_SAMA5D3 ) { +switch (at91_soc_initdata.exid) { +case ARCH_EXID_SAMA5D31 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D31 ; +break ; +case ARCH_EXID_SAMA5D33 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D33 ; +break ; +case ARCH_EXID_SAMA5D34 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D34 ; +break ; +case ARCH_EXID_SAMA5D35 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D35 ; +break ; + } + } }static const char *soc_name[] = {
@@ -219,6 +241,7 @@ static const char *soc_name[] = { [AT91_SOC_SAM9RL] = "at91sam9rl", [AT91_SOC_SAM9X5] = "at91sam9x5", [AT91_SOC_SAM9N12] = "at91sam9n12", + [AT91_SOC_SAMA5D3] = "sama5d3", [AT91_SOC_NONE] = "Unknown" };
@@ -241,6 +264,10 @@ static const char *soc_subtype_name[] = { [AT91_SOC_SAM9X35] = "at91sam9x35", [AT91_SOC_SAM9G25] = "at91sam9g25", [AT91_SOC_SAM9X25] = "at91sam9x25", + [AT91_SOC_SAMA5D31] = "sama5d31", + [AT91_SOC_SAMA5D33] = "sama5d33", + [AT91_SOC_SAMA5D34] = "sama5d34", + [AT91_SOC_SAMA5D35] = "sama5d35", [AT91_SOC_SUBTYPE_NONE] = "Unknown" };
arch/arm/mach-at91/soc.h +5 -0
@@ -22,6 +22,7 @@ extern struct at91_init_soc at91sam9g45_soc;extern struct at91_init_soc at91sam9rl_soc;extern struct at91_init_soc at91sam9x5_soc;extern struct at91_init_soc at91sam9n12_soc; +extern struct at91_init_soc sama5d3_soc;#define AT91_SOC_START (_name) \ struct at91_init_soc __initdata _name##_soc \
@@ -68,3 +69,7 @@ static inline int at91_soc_is_enabled(void)#if !defined(CONFIG_SOC_AT91SAM9N12 )#define at91sam9n12_soc at91_boot_soc#endif + +#if !defined(CONFIG_SOC_SAMA5D3 ) +#define sama5d3_soc at91_boot_soc +#endif
Signature · 1 line
1.7.11.3
PATCH 4/4 ARM: at91: introduce SAMA5 support
Quoted 44 lines · On 8 March 2013 16:13, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
This patch introduces the SAMA5 support. It also updates the PMC driver to manage clock division which is a requirement since some peripherals can't work at the bus frequency on SAMA5.
Signed-off-by Ludovic Desroches <[email protected]>Signed-off-by Nicolas Ferre <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 34 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 21 files changed, 2454 insertions(+), 29 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c
<snip>
Quoted 27 lines
arch/arm/mach-at91/Kconfig +13
-0@@ -29,6 +29,14 @@ config SOC_AT91SAM9 select MULTI_IRQ_HANDLER select SPARSE_IRQ +config SOC_SAMA5 + bool + select AT91_SAM9_TIME + select CPU_V7 + select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ + menu "Atmel AT91 System-on-Chip" choice@@ -41,10 +49,28 @@ config SOC_SAM_V4_V5 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 or AT91X40 SoC. +config SOC_SAM_V7 + bool "Cortex A5" + help + Select this if you are using one of Atmel's SAMA5D3 SoC. + endchoice
arch/arm/mach-at91/Kconfig config SOC_SAM_V4_V5 · line 67
Quoted 10 lines
arch/arm/mach-at91/Kconfig +7
-0comment "Atmel AT91 Processor" +if SOC_SAM_V7 +config SOC_SAMA5D3 + bool "SAMA5D3 family" + depends on SOC_SAM_V7 + select SOC_SAMA5 + select HAVE_FB_ATMEL + select HAVE_NET_MACB
Remove HAVE_NET_MACB. It doesn't exist elsewhere in the kernel now.
Quoted 6 lines
arch/arm/mach-at91/Kconfig +6
-0+ select HAVE_AT91_DBGU1 + help + Select this if you are using one of Atmel's SAMA5D3 family SoC. + This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. +endif +
<snip>
Quoted 82 lines
arch/arm/mach-at91/board-dt-sama5.c new file +76
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; +
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 10 lines
arch/arm/mach-at91/board-dt-sama5.c new file +10
-0+DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize, + .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END
Do we really need board-dt-sama5.c?
Now that we have both irqchip_init and clocksource_of_init it shouldn't be necessary with more than one board-dt.c.
regards
Joachim Eastwood
PATCH 4/4 ARM: at91: introduce SAMA5 support
Hi Joachim,
Quoted 78 lines · Joachim Eastwood
Quoted 44 lines · On 8 March 2013 16:13, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
This patch introduces the SAMA5 support. It also updates the PMC driver to manage clock division which is a requirement since some peripherals can't work at the bus frequency on SAMA5.
Signed-off-by Ludovic Desroches <[email protected]>Signed-off-by Nicolas Ferre <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 34 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 21 files changed, 2454 insertions(+), 29 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c<snip>
Quoted 30 lines
arch/arm/mach-at91/Kconfig +13
-0@@ -29,6 +29,14 @@ config SOC_AT91SAM9 select MULTI_IRQ_HANDLER select SPARSE_IRQ +config SOC_SAMA5 + bool + select AT91_SAM9_TIME + select CPU_V7 + select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ + menu "Atmel AT91 System-on-Chip" choice@@ -41,10 +49,28 @@ config SOC_SAM_V4_V5 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 or AT91X40 SoC. +config SOC_SAM_V7 + bool "Cortex A5" + help + Select this if you are using one of Atmel's SAMA5D3 SoC. + endchoice comment "Atmel AT91 Processor"
Quoted 10 lines
arch/arm/mach-at91/Kconfig config SOC_SAM_V4_V5 · line 67
Quoted 7 lines
arch/arm/mach-at91/Kconfig +7
-0+if SOC_SAM_V7 +config SOC_SAMA5D3 + bool "SAMA5D3 family" + depends on SOC_SAM_V7 + select SOC_SAMA5 + select HAVE_FB_ATMEL + select HAVE_NET_MACBRemove
HAVE_NET_MACB. It doesn't exist elsewhere in the kernel now.
Good point, thx.
Quoted 97 lines
Quoted 6 lines
arch/arm/mach-at91/Kconfig +6
-0+ select HAVE_AT91_DBGU1 + help + Select this if you are using one of Atmel's SAMA5D3 family SoC. + This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. +endif +<snip>
Quoted 88 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,
Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
Regards
Ludovic
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 4/4 ARM: at91: introduce SAMA5 support
Quoted 201 lines · Ludovic Desroches
Hi Joachim,
Quoted 78 lines · Joachim Eastwood
Quoted 44 lines · On 8 March 2013 16:13, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
This patch introduces the SAMA5 support. It also updates the PMC driver to manage clock division which is a requirement since some peripherals can't work at the bus frequency on SAMA5.
Signed-off-by Ludovic Desroches <[email protected]>Signed-off-by Nicolas Ferre <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 34 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 21 files changed, 2454 insertions(+), 29 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c<snip>
Quoted 30 lines
arch/arm/mach-at91/Kconfig +13
-0@@ -29,6 +29,14 @@ config SOC_AT91SAM9 select MULTI_IRQ_HANDLER select SPARSE_IRQ +config SOC_SAMA5 + bool + select AT91_SAM9_TIME + select CPU_V7 + select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ + menu "Atmel AT91 System-on-Chip" choice@@ -41,10 +49,28 @@ config SOC_SAM_V4_V5 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 or AT91X40 SoC. +config SOC_SAM_V7 + bool "Cortex A5" + help + Select this if you are using one of Atmel's SAMA5D3 SoC. + endchoice comment "Atmel AT91 Processor"Quoted 10 lines
arch/arm/mach-at91/Kconfig config SOC_SAM_V4_V5 · line 67
Quoted 7 lines
arch/arm/mach-at91/Kconfig +7
-0+if SOC_SAM_V7 +config SOC_SAMA5D3 + bool "SAMA5D3 family" + depends on SOC_SAM_V7 + select SOC_SAMA5 + select HAVE_FB_ATMEL + select HAVE_NET_MACBRemove
HAVE_NET_MACB. It doesn't exist elsewhere in the kernel now.Good point, thx.
Quoted 97 lines
Quoted 6 lines
arch/arm/mach-at91/Kconfig +6
-0+ select HAVE_AT91_DBGU1 + help + Select this if you are using one of Atmel's SAMA5D3 family SoC. + This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. +endif +<snip>
Quoted 88 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.
Quoted 3 lines
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
It does add more lines to mach-at91 and I don't see a reason to have two near identical board-dt files. board-dt could be used for SAMA5 even without irqchip_init and clocksource_of_init so what's the point in splitting it?
When the at91 clocksource and irqchip driver are converted/moved we could support all AT91 SoC from RM9200 to SAMA5 in one board-dt. I don't see the reason for 3 board-dt files or even 2.
That we can't build a kernel that supports both ARMv4-5 and ARMv7 doesn't make a difference.
regards
Joachim Eastwood
PATCH 4/4 ARM: at91: introduce SAMA5 support
Quoted 211 lines · Joachim Eastwood
Quoted 201 lines · Ludovic Desroches
Hi Joachim,
Quoted 78 lines · Joachim Eastwood
Quoted 44 lines · On 8 March 2013 16:13, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
This patch introduces the SAMA5 support. It also updates the PMC driver to manage clock division which is a requirement since some peripherals can't work at the bus frequency on SAMA5.
Signed-off-by Ludovic Desroches <[email protected]>Signed-off-by Nicolas Ferre <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/boot/dts/Makefile | 5 + arch/arm/boot/dts/sama5d3.dtsi | 1031 ++++++++++++++++++++++++++++ arch/arm/boot/dts/sama5d31ek.dts | 51 ++ arch/arm/boot/dts/sama5d33ek.dts | 44 ++ arch/arm/boot/dts/sama5d34ek.dts | 61 ++ arch/arm/boot/dts/sama5d35ek.dts | 56 ++ arch/arm/boot/dts/sama5d3xcm.dtsi | 91 +++ arch/arm/boot/dts/sama5d3xdm.dtsi | 42 ++ arch/arm/boot/dts/sama5d3xmb.dtsi | 166 +++++ arch/arm/configs/sama5_defconfig | 181 +++++ arch/arm/mach-at91/Kconfig | 34 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/board-dt-sama5.c | 86 +++ arch/arm/mach-at91/clock.c | 109 ++- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 18 +- arch/arm/mach-at91/include/mach/cpu.h | 20 + arch/arm/mach-at91/include/mach/sama5d3.h | 73 ++ arch/arm/mach-at91/sama5d3.c | 377 ++++++++++ arch/arm/mach-at91/setup.c | 27 + arch/arm/mach-at91/soc.h | 5 + 21 files changed, 2454 insertions(+), 29 deletions(-) create mode 100644 arch/arm/boot/dts/sama5d3.dtsi create mode 100644 arch/arm/boot/dts/sama5d31ek.dts create mode 100644 arch/arm/boot/dts/sama5d33ek.dts create mode 100644 arch/arm/boot/dts/sama5d34ek.dts create mode 100644 arch/arm/boot/dts/sama5d35ek.dts create mode 100644 arch/arm/boot/dts/sama5d3xcm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xdm.dtsi create mode 100644 arch/arm/boot/dts/sama5d3xmb.dtsi create mode 100644 arch/arm/configs/sama5_defconfig create mode 100644 arch/arm/mach-at91/board-dt-sama5.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/sama5d3.c<snip>
Quoted 30 lines
arch/arm/mach-at91/Kconfig +13
-0@@ -29,6 +29,14 @@ config SOC_AT91SAM9 select MULTI_IRQ_HANDLER select SPARSE_IRQ +config SOC_SAMA5 + bool + select AT91_SAM9_TIME + select CPU_V7 + select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ + menu "Atmel AT91 System-on-Chip" choice@@ -41,10 +49,28 @@ config SOC_SAM_V4_V5 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 or AT91X40 SoC. +config SOC_SAM_V7 + bool "Cortex A5" + help + Select this if you are using one of Atmel's SAMA5D3 SoC. + endchoice comment "Atmel AT91 Processor"Quoted 10 lines
arch/arm/mach-at91/Kconfig config SOC_SAM_V4_V5 · line 67
Quoted 7 lines
arch/arm/mach-at91/Kconfig +7
-0+if SOC_SAM_V7 +config SOC_SAMA5D3 + bool "SAMA5D3 family" + depends on SOC_SAM_V7 + select SOC_SAMA5 + select HAVE_FB_ATMEL + select HAVE_NET_MACBRemove
HAVE_NET_MACB. It doesn't exist elsewhere in the kernel now.Good point, thx.
Quoted 97 lines
Quoted 6 lines
arch/arm/mach-at91/Kconfig +6
-0+ select HAVE_AT91_DBGU1 + help + Select this if you are using one of Atmel's SAMA5D3 family SoC. + This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. +endif +<snip>
Quoted 88 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.Quoted 3 lines
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
It does add more lines to mach-at91 and I don't see a reason to have two near identical board-dt files. board-dt could be used for SAMA5 even without
irqchip_initandclocksource_of_initso what's the point in splitting it?
Quoted 6 lines
When the at91 clocksource and irqchip driver are converted/moved we could support all AT91 SoC from RM9200 to SAMA5 in one board-dt. I don't see the reason for 3 board-dt files or even 2.
That we can't build a kernel that supports both ARMv4-5 and ARMv7 doesn't make a difference.
my answer is no I do not want to if compatible_is on the c code so no different files
Best Regards,
J.
Quoted 3 lines
regards
Joachim Eastwood
PATCH 4/4 ARM: at91: introduce SAMA5 support
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Joachim Eastwood
On 8 March 2013 17:52, Ludovic Desroches <[email protected]> wrote:
<snip>
Quoted 108 lines
Quoted 108 lines
Quoted 99 lines
Quoted 89 lines
Quoted 89 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.Quoted 3 lines
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
It does add more lines to mach-at91 and I don't see a reason to have two near identical board-dt files. board-dt could be used for SAMA5 even without
irqchip_initandclocksource_of_initso what's the point in splitting it?
Quoted 8 lines
Quoted 6 lines
When the at91 clocksource and irqchip driver are converted/moved we could support all AT91 SoC from RM9200 to SAMA5 in one board-dt. I don't see the reason for 3 board-dt files or even 2.
That we can't build a kernel that supports both ARMv4-5 and ARMv7 doesn't make a difference.
my answer is no I do not want to if
compatible_ison the c code so no different files
But you have this already on the above code:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ if (
of_machine_is_compatible("atmel,sama5d3xcm"))
I don't see the point to have different board-dt files.
If a board turns out to need lots of specific C code to work I think it's fine to have it in its own board file. But right now you are just duplicating code unnecessary.
regards
Joachim Eastwood
PATCH 4/4 ARM: at91: introduce SAMA5 support
Quoted 124 lines · Joachim Eastwood
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Joachim Eastwood
On 8 March 2013 17:52, Ludovic Desroches <[email protected]> wrote:
<snip>
Quoted 108 lines
Quoted 108 lines
Quoted 99 lines
Quoted 89 lines
Quoted 89 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.Quoted 3 lines
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
It does add more lines to mach-at91 and I don't see a reason to have two near identical board-dt files. board-dt could be used for SAMA5 even without
irqchip_initandclocksource_of_initso what's the point in splitting it?Quoted 8 lines
Quoted 6 lines
When the at91 clocksource and irqchip driver are converted/moved we could support all AT91 SoC from RM9200 to SAMA5 in one board-dt. I don't see the reason for 3 board-dt files or even 2.
That we can't build a kernel that supports both ARMv4-5 and ARMv7 doesn't make a difference.
my answer is no I do not want to if
compatible_ison the c code so no different files
Quoted 7 lines
But you have this already on the above code:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ if (
of_machine_is_compatible("atmel,sama5d3xcm"))I don't see the point to have different board-dt files.
If a board turns out to need lots of specific C code to work I think it's fine to have it in its own board file. But right now you are just duplicating code unnecessary.
sorry my mind is made NACK
I do want one file per core rm9200/sama9 sama5
no compatible_is and mutilple MACHINE_xx in the same file
Best Regards,
J.
Quoted 2 lines
regards
Joachim Eastwood
PATCH 4/4 ARM: at91: introduce SAMA5 support
In reply to Joachim EastwoodOn 03/08/2013 10:27 PM, Joachim Eastwood :
Quoted 124 lines
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Joachim Eastwood
On 8 March 2013 17:52, Ludovic Desroches <[email protected]> wrote:
<snip>
Quoted 108 lines
Quoted 108 lines
Quoted 99 lines
Quoted 89 lines
Quoted 89 lines
arch/arm/mach-at91/board-dt-sama5.c new file +82
-0@@ -0,0 +1,86 @@ +/* +* Setup code for SAMA5 Evaluation Kits with Device Tree support +* +* Copyright (C) 2013 Atmel, +* 2013 Ludovic Desroches <[email protected]> +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/micrel_phy.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/phy.h> + +#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/irq.h> + +#include "at91_aic.h" +#include "generic.h" + + +static const struct of_device_id irq_of_match[]__initconst = { + + { .compatible ="atmel,sama5d3-aic" , .data = at91_aic5_of_init }, + {/*sentinel*/ } +}; + +static void __init at91_dt_init_irq (void ) +{ +of_irq_init (irq_of_match); +} + +static int ksz9021rn_phy_fixup (struct phy_device *phy) +{ +int value; + +#define GMII_RCCPSR 260 +#define GMII_RRDPSR 261 +#define GMII_ERCR 11 +#define GMII_ERDWR 12 + +/* Set delay values */ + value =GMII_RCCPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0xF2F4 ; +phy_write (phy,GMII_ERDWR , value); + value =GMII_RRDPSR |0x8000 ; +phy_write (phy,GMII_ERCR , value); + value =0x2222 ; +phy_write (phy,GMII_ERDWR , value); + +return 0 ; +} + +static void __init sama5_dt_device_init (void ) +{ +if (of_machine_is_compatible ("atmel,sama5d3xcm" )) +phy_register_fixup_for_uid (PHY_ID_KSZ9021 ,MICREL_PHY_ID_MASK , + ksz9021rn_phy_fixup); + +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *sama5_dt_board_compat[]__initdata = { +"atmel,sama5" , +NULL +}; + +DT_MACHINE_START (sama5_dt,"Atmel SAMA5 (Device Tree)" ) +/* Maintainer: Atmel */ + .init_time = at91sam926x_pit_init, + .map_io = at91_map_io, + .handle_irq = at91_aic5_handle_irq, + .init_early = at91_dt_initialize,Quoted 9 lines
arch/arm/mach-at91/board-dt-sama5.c line 86
Quoted 4 lines
arch/arm/mach-at91/board-dt-sama5.c new file +4
-0+ .init_irq = at91_dt_init_irq, + .init_machine = sama5_dt_device_init, + .dt_compat = sama5_dt_board_compat, +MACHINE_END Do we really need
board-dt-sama5.c?
Now that we have bothirqchip_initandclocksource_of_initit shouldn't be necessary with more than oneboard-dt.c.Quoted 3 lines
At the beginning, I had the same point of view but we have a new architecture, we can't build a single kernel image for both AT91SAM9 and SAMA5. So why not splitting it?
It does add more lines to mach-at91 and I don't see a reason to have two near identical board-dt files. board-dt could be used for SAMA5 even without
irqchip_initandclocksource_of_initso what's the point in splitting it?Quoted 8 lines
Quoted 6 lines
When the at91 clocksource and irqchip driver are converted/moved we could support all AT91 SoC from RM9200 to SAMA5 in one board-dt. I don't see the reason for 3 board-dt files or even 2.
That we can't build a kernel that supports both ARMv4-5 and ARMv7 doesn't make a difference.
my answer is no I do not want to if
compatible_ison the c code so no different files
Quoted 7 lines
But you have this already on the above code:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ if (
of_machine_is_compatible("atmel,sama5d3xcm"))I don't see the point to have different board-dt files.
If a board turns out to need lots of specific C code to work I think it's fine to have it in its own board file. But right now you are just duplicating code unnecessary.
Well, in fact it turns out that we already have quite a few DT tests in our sama5d3 kernel (github/linux4sam) because all subsystem are not converted to DT yet. If we put even an extract of this in a common board file it will soon become a mess.
I also do understand the need for limiting the testing of several compatibility strings before booting...
Moreover, as discussed with Jean-Christophe, if we join board-dt-rm9200.c and the sam9 one, we will need to compile at91rm9200_time.c ST driver, even for sam9s and sama5s which is kind of useless.
Even if I hate duplicating code, I tend to prefer the "multi-file" solution as it adds a tiny overhead but leads to a clearer result.
Ludovic, can you please re-spin the whole series with updated patches and the removal of patch #3 which I plan to queue for 3.9 fixes.
Best regards,
Signature · 1 line
Nicolas Ferre
cover SAMA5D3 support
In reply to ludovic.desroches at atmel.comQuoted 11 lines · On Fri, Mar 8, 2013 at 9:13 AM, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
Hi,
This set of patches introduces basic support for the SAMA5D3 family. It is based on Jean-Christophe
Kconfigcleanup patch series available at:
git://github.com/at91linux/linux-at91.gitdelivery/at91_3.9_dt_cleanupRegards
Quoted 7 lines
Ludovic Desroches (4):
ARM: at91: addAT91_SAM9_TIMEentry to selectat91sam926x_time.c
compilation
ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7
arch
ARM: at91: fix infinite loop in at91_irq_suspend/resume
ARM: at91: introduce SAMA5 support
Hi Ludovic,
Looks like something is still missing, with the 3 cleanup patches (delivery/at91_3.9_dt_cleanup) and these 4 on top of mainline built with "sama5_defconfig" results in:
CC net/wireless/ap.o CC net/wireless/trace.o LD net/wireless/cfg80211.o LD net/wireless/built-in.o LD net/built-in.o LINK vmlinux LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o
arch/arm/mach-at91/built-in.o: In function `soc_detect':
pm.c:(.init.text+0xa88): undefined reference to `sama5d3_soc'
make: *** [vmlinux] Error 1
Everything looks correct in:./arch/arm/mach-at91/setup.c./arch/arm/mach-at91/soc.h
Regards,
Signature · 2 lines
Robert Nelson http://www.rcn-ee.com/
cover SAMA5D3 support
Hi Robert,
Quoted 39 lines · Robert Nelson
Quoted 11 lines · On Fri, Mar 8, 2013 at 9:13 AM, <[email protected]> wrote:
From: Ludovic Desroches <[email protected]>
Hi,
This set of patches introduces basic support for the SAMA5D3 family. It is based on Jean-Christophe
Kconfigcleanup patch series available at:
git://github.com/at91linux/linux-at91.gitdelivery/at91_3.9_dt_cleanupRegards
Quoted 7 lines
Ludovic Desroches (4):
ARM: at91: addAT91_SAM9_TIMEentry to selectat91sam926x_time.c
compilation
ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7
arch
ARM: at91: fix infinite loop in at91_irq_suspend/resume
ARM: at91: introduce SAMA5 supportHi Ludovic,
Looks like something is still missing, with the 3 cleanup patches (delivery/at91_3.9_dt_cleanup) and these 4 on top of mainline built with "
sama5_defconfig" results in:CC net/wireless/ap.o CC net/wireless/trace.o LD net/wireless/cfg80211.o LD net/wireless/built-in.o LD net/built-in.o LINK vmlinux LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o
Quoted 8 lines
arch/arm/mach-at91/built-in.o: In function `soc_detect':
pm.c:(.init.text+0xa88): undefined reference to `sama5d3_soc'
make: *** [vmlinux] Error 1Everything looks correct in:
./arch/arm/mach-at91/setup.c./arch/arm/mach-at91/soc.h
Thanks for testing it. You are right, I have split my patch series and I have forgotten one patch.
Regards
Ludovic
Quoted 5 lines
Regards,
Signature · 2 lines
Robert Nelson http://www.rcn-ee.com/
A message that is not in the archive (sent off-list or not yet received): [email protected]
cover SAMA5D3 support
Quoted 21 lines
Quoted 21 lines
Looks like something is still missing, with the 3 cleanup patches (delivery/at91_3.9_dt_cleanup) and these 4 on top of mainline built with "
sama5_defconfig" results in:CC net/wireless/ap.o CC net/wireless/trace.o LD net/wireless/cfg80211.o LD net/wireless/built-in.o LD net/built-in.o LINK vmlinux LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o
arch/arm/mach-at91/built-in.o: In function `soc_detect':
pm.c:(.init.text+0xa88): undefined reference to `sama5d3_soc'
make: *** [vmlinux] Error 1
Quoted 7 lines
Quoted 4 lines
Everything looks correct in:
./arch/arm/mach-at91/setup.c./arch/arm/mach-at91/soc.hThanks for testing it. You are right, I have split my patch series and I have forgotten one patch.
Hi Ludovic,
Yeap, that patch fixed it ARM-at91-change-name-template-in-AT91_SOC_START-macr.patch
It now boots just fine on my D34-EK with v3.9-rc2 as a base..
Regards,
Signature · 2 lines
Robert Nelson http://www.rcn-ee.com/
PATCH 1/1 ARM: at91: change name template in AT91_SOC_START macro
In reply to ludovic.desroches at atmel.comFrom: Ludovic Desroches <[email protected]>
New devices are no more prefixed with at91 so remove the at91 and _name concatenation.
--- arch/arm/mach-at91/at91rm9200.c | 2 +- arch/arm/mach-at91/at91sam9260.c | 2 +- arch/arm/mach-at91/at91sam9261.c | 2 +- arch/arm/mach-at91/at91sam9263.c | 2 +- arch/arm/mach-at91/at91sam9g45.c | 2 +- arch/arm/mach-at91/at91sam9n12.c | 2 +- arch/arm/mach-at91/at91sam9rl.c | 2 +- arch/arm/mach-at91/at91sam9x5.c | 2 +- arch/arm/mach-at91/soc.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-at91/at91rm9200.c +1 -1
@@ -384,7 +384,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { 0 /* Advanced Interrupt Controller (IRQ6) */ }; -AT91_SOC_START (rm9200) +AT91_SOC_START (at91rm9200) .map_io = at91rm9200_map_io, .default_irq_priority = at91rm9200_default_irq_priority, .ioremap_registers = at91rm9200_ioremap_registers,
arch/arm/mach-at91/at91sam9260.c +1 -1
@@ -395,7 +395,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {0 ,/* Advanced Interrupt Controller */ }; -AT91_SOC_START (sam9260) +AT91_SOC_START (at91sam9260) .map_io = at91sam9260_map_io, .default_irq_priority = at91sam9260_default_irq_priority, .ioremap_registers = at91sam9260_ioremap_registers,
arch/arm/mach-at91/at91sam9261.c +1 -1
@@ -337,7 +337,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {0 ,/* Advanced Interrupt Controller */ }; -AT91_SOC_START (sam9261) +AT91_SOC_START (at91sam9261) .map_io = at91sam9261_map_io, .default_irq_priority = at91sam9261_default_irq_priority, .ioremap_registers = at91sam9261_ioremap_registers,
arch/arm/mach-at91/at91sam9263.c +1 -1
@@ -374,7 +374,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {0 ,/* Advanced Interrupt Controller (IRQ1) */ }; -AT91_SOC_START (sam9263) +AT91_SOC_START (at91sam9263) .map_io = at91sam9263_map_io, .default_irq_priority = at91sam9263_default_irq_priority, .ioremap_registers = at91sam9263_ioremap_registers,
arch/arm/mach-at91/at91sam9g45.c +1 -1
@@ -418,7 +418,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {0 ,/* Advanced Interrupt Controller (IRQ0) */ }; -AT91_SOC_START (sam9g45) +AT91_SOC_START (at91sam9g45) .map_io = at91sam9g45_map_io, .default_irq_priority = at91sam9g45_default_irq_priority, .ioremap_registers = at91sam9g45_ioremap_registers,
arch/arm/mach-at91/at91sam9n12.c +1 -1
@@ -226,7 +226,7 @@ void __init at91sam9n12_initialize(void) at91_extern_irq = (1 <<AT91SAM9N12_ID_IRQ0 ); } -AT91_SOC_START (sam9n12) +AT91_SOC_START (at91sam9n12) .map_io = at91sam9n12_map_io, .register_clocks = at91sam9n12_register_clocks, .init = at91sam9n12_initialize,
arch/arm/mach-at91/at91sam9rl.c +1 -1
@@ -340,7 +340,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {0 ,/* Advanced Interrupt Controller */ }; -AT91_SOC_START (sam9rl) +AT91_SOC_START (at91sam9rl) .map_io = at91sam9rl_map_io, .default_irq_priority = at91sam9rl_default_irq_priority, .ioremap_registers = at91sam9rl_ioremap_registers,
arch/arm/mach-at91/at91sam9x5.c +1 -1
@@ -320,7 +320,7 @@ static void __init at91sam9x5_map_io(void)* Interrupt initialization * -------------------------------------------------------------------- */ -AT91_SOC_START (sam9x5) +AT91_SOC_START (at91sam9x5) .map_io = at91sam9x5_map_io, .register_clocks = at91sam9x5_register_clocks,AT91_SOC_END
arch/arm/mach-at91/soc.h +1 -1
@@ -24,7 +24,7 @@ extern struct at91_init_soc at91sam9x5_soc;extern struct at91_init_soc at91sam9n12_soc;#define AT91_SOC_START (_name) \ -struct at91_init_soc __initdata at91##_name##_soc \ +struct at91_init_soc __initdata _name##_soc \ __used \ = { \ .builtin = 1, \
Signature · 1 line
1.7.11.3