Skip to contentSkip to conversation

SAMA5D3 support

PATCH Superseded ludovic.desroches at atmel.com 2 participants 7 messages Mar 14, 2013 – Mar 19, 2013

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover SAMA5D3 support

From: Ludovic Desroches <[email protected]>

Hello,

Updated set of patches for SAMA5D3 family support, based on Jean-Christophe ARM: at91: Kconfig cleanup for prepare add of Cortex-A5 Sama5 patches.

v2 changes:
- remove ARM: at91: fix infinite loop in at91_irq_suspend/resume taken as 3.9 fix
- add missing patch: ARM: at91: change name template in AT91_SOC_START macro
- remove select HAVE_NET_MACB

Ludovic Desroches (4):
ARM: at91: change name template in AT91_SOC_START macro
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: 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                 |   59 +-
 arch/arm/mach-at91/Makefile                |    7 +-
 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/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                   |    7 +-
 29 files changed, 2486 insertions(+), 43 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
#1 lore raw

PATCH v2 1/4 ARM: at91: change name template in AT91_SOC_START macro

From: 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
index 9706c00..ccce759 100644
@@ -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
index b67cd53..1833b4c 100644
@@ -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
index 2998a08..ac7a341b 100644
@@ -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
index b9fc60d..8e2d9f4 100644
@@ -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
index d3addee..4fcbe7b 100644
@@ -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
index 5dfc8fd..2c7a2f4 100644
@@ -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
index eb98704..c396007 100644
@@ -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
index 44a9a62..3a1a799 100644
@@ -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
index 9c6d3d4..f3d3502 100644
@@ -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
#2 lore raw

PATCH v2 2/4 ARM: at91: add AT91_SAM9_TIME entry to select at91sam926x_time.c compilation

In reply to ludovic.desroches at atmel.com

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
index 440682b..68c53c3 100644
@@ -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
index 505fed9..74e9b5b 100644
@@ -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
#3 lore raw

PATCH v2 3/4 ARM: at91: introduce the core type choice to split ARMv4/5 and ARMv7 arch

In reply to 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.

---
 arch/arm/mach-at91/Kconfig | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
arch/arm/mach-at91/Kconfig +18 -4
index 68c53c3..8b35c7f 100644
@@ -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
#4 lore raw

PATCH v2 4/4 ARM: at91: introduce SAMA5 support

In reply to ludovic.desroches at atmel.com

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.

---
 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                 |   33 +
 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, 2453 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
index 9c62558..234e78f 100644
@@ -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 +33 -0
index 8b35c7f..0280238 100644
@@ -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,27 @@ 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_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 +159,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
index 74e9b5b..788562d 100644
@@ -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
index c2e63e4..a98a39b 100644
@@ -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
index ea2c57a..31df120 100644
@@ -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
index b6504c1..0f3379f 100644
@@ -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
index 4b67847..2ecd169 100644
@@ -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
index f3d3502..43a225f 100644
@@ -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
#5 lore raw

PATCH 4/4 ARM: at91: introduce SAMA5 support

Quoted 37 lines · ludovic.desroches at atmel.com

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.

---
 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                 |   33 +
 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, 2453 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
Quoted 8 lines
 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

So I haven't started reviewing this yet, but looking at the diffstat, I can't help but think this patch could use some splitting to be more easily reviewable.

How about having one patch for the clock stuff, one for the config, one for the DT, and finally one for the SoC support itself?

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#6 lore raw

PATCH v2 4/4 ARM: at91: introduce SAMA5 support

Quoted 47 lines · Marc Zyngier
Quoted 37 lines · ludovic.desroches at atmel.com

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.

---
 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                 |   33 +
 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, 2453 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
Quoted 8 lines
 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
Quoted 7 lines

So I haven't started reviewing this yet, but looking at the diffstat, I can't help but think this patch could use some splitting to be more easily reviewable.

How about having one patch for the clock stuff, one for the config, one for the DT, and finally one for the SoC support itself?

Hello Marc,

As you said I can split dts/dtsi, defconf to have a more easily reviewable patch. On the other side, I know that some people prefer to have the whole 'functionnality' in one patch.

Concerning clock stuff and SoC support, they are tied:
- I use cpu_is_sama5d3 macro in clock.c
- in sama5d3.c I am using the new fields (div and pid) introduced by the clock.c update.

Regards

Ludovic