From ce596f0ff6e4d12b0b2093ecf4480eab55c9f1c6 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Tue, 9 Dec 2014 18:54:46 +0800 Subject: [PATCH 01/46] ARM: at91/dt: sama5d3: enable D2 as the heartbeat LED This D2 led is available for all sama5d3x-ek board. So make it a heartbeat LED. Signed-off-by: Josh Wu Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3xcm.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi index cfcd200b0c17..7d6babdab039 100644 --- a/arch/arm/boot/dts/sama5d3xcm.dtsi +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi @@ -122,6 +122,7 @@ d2 { label = "d2"; gpios = <&pioE 25 GPIO_ACTIVE_LOW>; /* PE25, conflicts with A25, RXD2 */ + linux,default-trigger = "heartbeat"; }; }; }; From 226b7b61d551bdd5e0c9e1e0de02e6c793b4c245 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Fri, 5 Dec 2014 15:16:55 +0100 Subject: [PATCH 02/46] ARM: at91/dt: sam9263: Fix typo: ac91_clk -> ac97_clk That clock should be called ac97_clk. Signed-off-by: Alexander Stein Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/at91sam9263.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 1467750e3377..ef8a70c27439 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -294,7 +294,7 @@ reg = <17>; }; - ac91_clk: ac97_clk { + ac97_clk: ac97_clk { #clock-cells = <0>; reg = <18>; }; From cb282f784507b40425ccb45fcaf5f2d38cea17b3 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 18 Dec 2014 10:45:50 +0100 Subject: [PATCH 03/46] ARM: at91: Add Special Function Registers binding documentation The special function registers gather some registers that allow to tweak features provided by IPs controlled through another register range. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon [nicolas.ferre@atmel.com: reg size: 0x60] Signed-off-by: Nicolas Ferre --- .../devicetree/bindings/arm/atmel-at91.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt index 562cda9d86d9..571fc76c6edb 100644 --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt @@ -136,3 +136,19 @@ Example: compatible = "atmel,at91sam9260-rstc"; reg = <0xfffffd00 0x10>; }; + +Special Function Registers (SFR) + +Special Function Registers (SFR) manage specific aspects of the integrated +memory, bridge implementations, processor and other functionality not controlled +elsewhere. + +required properties: +- compatible: Should be "atmel,-sfr", "syscon". + can be "sama5d3" or "sama5d4". +- reg: Should contain registers location and length + + sfr@f0038000 { + compatible = "atmel,sama5d3-sfr", "syscon"; + reg = <0xf0038000 0x60>; + }; From 6ced9f4a3c2a9c9c688d653a0448db79c02171f9 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 18 Dec 2014 10:45:51 +0100 Subject: [PATCH 04/46] ARM: at91: sama5d3: Add SFR The sama5d3 has Special Function Registers that allow to manage OHCI, EBI and the UTMI clock. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon [nicolas.ferre@atmel.com: reg size: 0x60] Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 5f4144d1e3a1..d701ddda0e00 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -217,6 +217,11 @@ status = "disabled"; }; + sfr: sfr@f0038000 { + compatible = "atmel,sama5d3-sfr", "syscon"; + reg = <0xf0038000 0x60>; + }; + mmc1: mmc@f8000000 { compatible = "atmel,hsmci"; reg = <0xf8000000 0x600>; From c3ef0b0cebad57f20f848e4f91a535c9305cf57f Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 18 Dec 2014 10:45:52 +0100 Subject: [PATCH 05/46] ARM: at91: sama5d4: Add SFR The sama4d4 has Special Function Registers that allow to manage DDR, OHCI, EBI and AIC interrupt redirection. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon [nicolas.ferre@atmel.com: reg size: 0x60] Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d4.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 1b0f30c2c4a5..0a2477fe5525 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -870,6 +870,11 @@ status = "disabled"; }; + sfr: sfr@f8028000 { + compatible = "atmel,sama5d4-sfr", "syscon"; + reg = <0xf8028000 0x60>; + }; + mmc1: mmc@fc000000 { compatible = "atmel,hsmci"; reg = <0xfc000000 0x600>; From a4d1ca3425df99918a6c8af45a660c62687e2ced Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Tue, 6 Jan 2015 11:25:12 +0100 Subject: [PATCH 06/46] ARM: at91/Documentation: add a README for Atmel SoCs Add a README file to describe Atmel SoCs (aka AT91) support in Mainline Linux: - SoC list + datasheet web links - Basic but useful information - Device Tree conventions and Work In Progress statement. Signed-off-by: Nicolas Ferre Acked-by: Olof Johansson --- Documentation/arm/Atmel/README | 124 +++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 Documentation/arm/Atmel/README diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Atmel/README new file mode 100644 index 000000000000..c53a19b4aab2 --- /dev/null +++ b/Documentation/arm/Atmel/README @@ -0,0 +1,124 @@ +ARM Atmel SoCs (aka AT91) +========================= + + +Introduction +------------ +This document gives useful information about the ARM Atmel SoCs that are +currently supported in Linux Mainline (you know, the one on kernel.org). + +It is important to note that the Atmel | SMART ARM-based MPU product line is +historically named "AT91" or "at91" throughout the Linux kernel development +process even if this product prefix has completely disappeared from the +official Atmel product name. Anyway, files, directories, git trees, +git branches/tags and email subject always contain this "at91" sub-string. + + +AT91 SoCs +--------- +Documentation and detailled datasheet for each product are available on +the Atmel website: http://www.atmel.com. + + Flavors: + * ARM 920 based SoC + - at91rm9200 + + Datasheet + http://www.atmel.com/Images/doc1768.pdf + + * ARM 926 based SoCs + - at91sam9260 + + Datasheet + http://www.atmel.com/Images/doc6221.pdf + + - at91sam9xe + + Datasheet + http://www.atmel.com/Images/Atmel-6254-32-bit-ARM926EJ-S-Embedded-Microprocessor-SAM9XE_Datasheet.pdf + + - at91sam9261 + + Datasheet + http://www.atmel.com/Images/doc6062.pdf + + - at91sam9263 + + Datasheet + http://www.atmel.com/Images/Atmel_6249_32-bit-ARM926EJ-S-Microcontroller_SAM9263_Datasheet.pdf + + - at91sam9rl + + Datasheet + http://www.atmel.com/Images/doc6289.pdf + + - at91sam9g20 + + Datasheet + http://www.atmel.com/Images/doc6384.pdf + + - at91sam9g45 family + - at91sam9g45 + - at91sam9g46 + - at91sam9m10 + - at91sam9m11 (device superset) + + Datasheet + http://www.atmel.com/Images/Atmel-6437-32-bit-ARM926-Embedded-Microprocessor-SAM9M11_Datasheet.pdf + + - at91sam9x5 family (aka "The 5 series") + - at91sam9g15 + - at91sam9g25 + - at91sam9g35 + - at91sam9x25 + - at91sam9x35 + + Datasheet (can be considered as covering the whole family) + http://www.atmel.com/Images/Atmel_11055_32-bit-ARM926EJ-S-Microcontroller_SAM9X35_Datasheet.pdf + + - at91sam9n12 + + Datasheet + http://www.atmel.com/Images/Atmel_11063_32-bit-ARM926EJ-S-Microcontroller_SAM9N12CN11CN12_Datasheet.pdf + + * ARM Cortex-A5 based SoCs + - sama5d3 family + - sama5d31 + - sama5d33 + - sama5d34 + - sama5d35 + - sama5d36 (device superset) + + Datasheet + http://www.atmel.com/Images/Atmel-11121-32-bit-Cortex-A5-Microcontroller-SAMA5D3_Datasheet.pdf + + * ARM Cortex-A5 + NEON based SoCs + - sama5d4 family + - sama5d41 + - sama5d42 + - sama5d43 + - sama5d44 (device superset) + + Datasheet + http://www.atmel.com/Images/Atmel-11238-32-bit-Cortex-A5-Microcontroller-SAMA5D4_Datasheet.pdf + + +Linux kernel information +------------------------ +Linux kernel mach directory: arch/arm/mach-at91 +MAINTAINERS entry is: "ARM/ATMEL AT91RM9200 AND AT91SAM ARM ARCHITECTURES" + + +Device Tree for AT91 SoCs and boards +------------------------------------ +All AT91 SoCs are converted to Device Tree. Since Linux 3.19, these products +must use this method to boot the Linux kernel. + +Work In Progress statement: +Device Tree files and Device Tree bindings that apply to AT91 SoCs and boards are +considered as "Unstable". To be completely clear, any at91 binding can change at +any time. So, be sure to use a Device Tree Binary and a Kernel Image generated from +the same source tree. +Please refer to the Documentation/devicetree/bindings/ABI.txt file for a +definition of a "Stable" binding/ABI. +This statement will be removed by AT91 MAINTAINERS when appropriate. + +Naming conventions and best practice: +- SoCs Device Tree Source Include files are named after the official name of + the product (at91sam9g20.dtsi or sama5d33.dtsi for instance). +- Device Tree Source Include files (.dtsi) are used to collect common nodes that can be + shared across SoCs or boards (sama5d3.dtsi or at91sam9x5cm.dtsi for instance). + When collecting nodes for a particular peripheral or topic, the identifier have to + be placed at the end of the file name, separated with a "_" (at91sam9x5_can.dtsi + or sama5d3_gmac.dtsi for example). +- board Device Tree Source files (.dts) are prefixed by the string "at91-" so + that they can be identified easily. Note that some files are historical exceptions + to this rule (sama5d3[13456]ek.dts, usb_a9g20.dts or animeo_ip.dts for example). From 9cb0a36e0e894d7c6de9a21ed23256cf61a44878 Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Thu, 4 Dec 2014 14:59:24 +0100 Subject: [PATCH 07/46] rtc: at91/Kconfig: remove useless options As we removed all the !DT boards during 3.19 cycle, we can now remove these options. Reported-by: Paul Bolle Signed-off-by: Nicolas Ferre --- drivers/rtc/Kconfig | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index f15cddfeb897..f211dfb7b913 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1141,34 +1141,6 @@ config RTC_DRV_AT91SAM9 probably want to use the real RTC block instead of the "RTT as an RTC" driver. -config RTC_DRV_AT91SAM9_RTT - int - range 0 1 - default 0 - depends on RTC_DRV_AT91SAM9 - help - This option is only relevant for legacy board support and - won't be used when booting a DT board. - - More than one RTT module is available. You can choose which - one will be used as an RTC. The default of zero is normally - OK to use, though some systems use that for non-RTC purposes. - -config RTC_DRV_AT91SAM9_GPBR - int - range 0 3 - default 0 - prompt "Backup Register Number" - depends on RTC_DRV_AT91SAM9 - help - This option is only relevant for legacy board support and - won't be used when booting a DT board. - - The RTC driver needs to use one of the General Purpose Backup - Registers (GPBRs) as well as the RTT. You can choose which one - will be used. The default of zero is normally OK to use, but - on some systems other software needs to use that register. - config RTC_DRV_AU1XXX tristate "Au1xxx Counter0 RTC support" depends on MIPS_ALCHEMY From ccf7222412dedc59b579a7fa14e08af3cdbf72ca Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Thu, 4 Dec 2014 15:09:47 +0100 Subject: [PATCH 08/46] ARM: at91: remove unneeded header file These GPIO pin descriptions are now moved with the pinctrl driver. We can safely remove this useless header file. Reported-by: Arnd Bergmann Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/include/mach/at91_pio.h | 80 ---------------------- 1 file changed, 80 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/at91_pio.h diff --git a/arch/arm/mach-at91/include/mach/at91_pio.h b/arch/arm/mach-at91/include/mach/at91_pio.h deleted file mode 100644 index 7b7366253ceb..000000000000 --- a/arch/arm/mach-at91/include/mach/at91_pio.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * arch/arm/mach-at91/include/mach/at91_pio.h - * - * Copyright (C) 2005 Ivan Kokshaysky - * Copyright (C) SAN People - * - * Parallel I/O Controller (PIO) - System peripherals registers. - * Based on AT91RM9200 datasheet revision E. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef AT91_PIO_H -#define AT91_PIO_H - -#define PIO_PER 0x00 /* Enable Register */ -#define PIO_PDR 0x04 /* Disable Register */ -#define PIO_PSR 0x08 /* Status Register */ -#define PIO_OER 0x10 /* Output Enable Register */ -#define PIO_ODR 0x14 /* Output Disable Register */ -#define PIO_OSR 0x18 /* Output Status Register */ -#define PIO_IFER 0x20 /* Glitch Input Filter Enable */ -#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */ -#define PIO_IFSR 0x28 /* Glitch Input Filter Status */ -#define PIO_SODR 0x30 /* Set Output Data Register */ -#define PIO_CODR 0x34 /* Clear Output Data Register */ -#define PIO_ODSR 0x38 /* Output Data Status Register */ -#define PIO_PDSR 0x3c /* Pin Data Status Register */ -#define PIO_IER 0x40 /* Interrupt Enable Register */ -#define PIO_IDR 0x44 /* Interrupt Disable Register */ -#define PIO_IMR 0x48 /* Interrupt Mask Register */ -#define PIO_ISR 0x4c /* Interrupt Status Register */ -#define PIO_MDER 0x50 /* Multi-driver Enable Register */ -#define PIO_MDDR 0x54 /* Multi-driver Disable Register */ -#define PIO_MDSR 0x58 /* Multi-driver Status Register */ -#define PIO_PUDR 0x60 /* Pull-up Disable Register */ -#define PIO_PUER 0x64 /* Pull-up Enable Register */ -#define PIO_PUSR 0x68 /* Pull-up Status Register */ -#define PIO_ASR 0x70 /* Peripheral A Select Register */ -#define PIO_ABCDSR1 0x70 /* Peripheral ABCD Select Register 1 [some sam9 only] */ -#define PIO_BSR 0x74 /* Peripheral B Select Register */ -#define PIO_ABCDSR2 0x74 /* Peripheral ABCD Select Register 2 [some sam9 only] */ -#define PIO_ABSR 0x78 /* AB Status Register */ -#define PIO_IFSCDR 0x80 /* Input Filter Slow Clock Disable Register */ -#define PIO_IFSCER 0x84 /* Input Filter Slow Clock Enable Register */ -#define PIO_IFSCSR 0x88 /* Input Filter Slow Clock Status Register */ -#define PIO_SCDR 0x8c /* Slow Clock Divider Debouncing Register */ -#define PIO_SCDR_DIV (0x3fff << 0) /* Slow Clock Divider Mask */ -#define PIO_PPDDR 0x90 /* Pad Pull-down Disable Register */ -#define PIO_PPDER 0x94 /* Pad Pull-down Enable Register */ -#define PIO_PPDSR 0x98 /* Pad Pull-down Status Register */ -#define PIO_OWER 0xa0 /* Output Write Enable Register */ -#define PIO_OWDR 0xa4 /* Output Write Disable Register */ -#define PIO_OWSR 0xa8 /* Output Write Status Register */ -#define PIO_AIMER 0xb0 /* Additional Interrupt Modes Enable Register */ -#define PIO_AIMDR 0xb4 /* Additional Interrupt Modes Disable Register */ -#define PIO_AIMMR 0xb8 /* Additional Interrupt Modes Mask Register */ -#define PIO_ESR 0xc0 /* Edge Select Register */ -#define PIO_LSR 0xc4 /* Level Select Register */ -#define PIO_ELSR 0xc8 /* Edge/Level Status Register */ -#define PIO_FELLSR 0xd0 /* Falling Edge/Low Level Select Register */ -#define PIO_REHLSR 0xd4 /* Rising Edge/ High Level Select Register */ -#define PIO_FRLHSR 0xd8 /* Fall/Rise - Low/High Status Register */ -#define PIO_SCHMITT 0x100 /* Schmitt Trigger Register */ - -#define ABCDSR_PERIPH_A 0x0 -#define ABCDSR_PERIPH_B 0x1 -#define ABCDSR_PERIPH_C 0x2 -#define ABCDSR_PERIPH_D 0x3 - -#define SAMA5D3_PIO_DRIVER1 0x118 /*PIO Driver 1 register offset*/ -#define SAMA5D3_PIO_DRIVER2 0x11C /*PIO Driver 2 register offset*/ - -#define AT91SAM9X5_PIO_DRIVER1 0x114 /*PIO Driver 1 register offset*/ -#define AT91SAM9X5_PIO_DRIVER2 0x118 /*PIO Driver 2 register offset*/ - -#endif From 0b4d5cdce7ac31ea09f5ecd631dd625680b33396 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 4 Dec 2014 15:26:09 +0100 Subject: [PATCH 09/46] ARM: at91: remove useless header file includes Since removal of !DT boards, asm/irq.h inclusion is not needed in these product files. Signed-off-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/at91sam9g45.c | 1 - arch/arm/mach-at91/at91sam9rl.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index b6117bea9a6f..3d225105e0d1 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -11,7 +11,6 @@ */ #include -#include #include #include "soc.h" diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index f25b9aec9c50..bd7e56889b43 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c @@ -10,7 +10,6 @@ */ #include -#include #include #include #include From e822aaef0c74b787d12c7bb3266c306a080e4790 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:10 +0100 Subject: [PATCH 10/46] ARM: at91: remove unused mach/memory.h CONFIG_NEED_MACH_MEMORY_H is not set by any at91 platform, remove mach/memory.h Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/include/mach/memory.h | 26 ------------------------ 1 file changed, 26 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/memory.h diff --git a/arch/arm/mach-at91/include/mach/memory.h b/arch/arm/mach-at91/include/mach/memory.h deleted file mode 100644 index 401c207f2f39..000000000000 --- a/arch/arm/mach-at91/include/mach/memory.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * arch/arm/mach-at91/include/mach/memory.h - * - * Copyright (C) 2004 SAN People - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ASM_ARCH_MEMORY_H -#define __ASM_ARCH_MEMORY_H - -#include - -#endif From 30edcdcc0529370264e87cf5a9185991a0fed70f Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:11 +0100 Subject: [PATCH 11/46] ARM: at91: remove useless config MACH_AT91RM9200_DT Now that rm9200 is only supported through DT, remove CONFIG_MACH_AT91RM9200_DT and use CONFIG_SOC_AT91RM9200 instead. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/Kconfig | 3 --- arch/arm/mach-at91/Makefile | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 2395c68b3e32..34725b296e4d 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -174,9 +174,6 @@ config SOC_AT91SAM9N12 # ---------------------------------------------------------- endif # SOC_SAM_V4_V5 -config MACH_AT91RM9200_DT - def_bool SOC_AT91RM9200 - config MACH_AT91SAM9_DT def_bool SOC_AT91SAM9 diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 7b6424d40764..55fc93f5638b 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -19,7 +19,7 @@ obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o # AT91SAM board with device-tree -obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o +obj-$(CONFIG_SOC_AT91RM9200) += board-dt-rm9200.o obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o # SAMA5 board with device-tree From c46317b7748af5bbbf914c8903c514500d7c8c18 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:12 +0100 Subject: [PATCH 12/46] ARM: at91: remove useless config MACH_AT91SAM9_DT Now that at91sam9 SoCs are only supported through DT, remove CONFIG_MACH_AT91SAM9_DT and use CONFIG_SOC_AT91SAM9 instead. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/Kconfig | 5 ----- arch/arm/mach-at91/Makefile | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 34725b296e4d..cec0fb5d621a 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -174,11 +174,6 @@ config SOC_AT91SAM9N12 # ---------------------------------------------------------- endif # SOC_SAM_V4_V5 -config MACH_AT91SAM9_DT - def_bool SOC_AT91SAM9 - -# ---------------------------------------------------------- - comment "AT91 Feature Selections" config AT91_SLOW_CLOCK diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 55fc93f5638b..9165a4aa7f0d 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -20,7 +20,7 @@ obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o # AT91SAM board with device-tree obj-$(CONFIG_SOC_AT91RM9200) += board-dt-rm9200.o -obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o +obj-$(CONFIG_SOC_AT91SAM9) += board-dt-sam9.o # SAMA5 board with device-tree obj-$(CONFIG_SOC_SAMA5) += board-dt-sama5.o From 415c94743524696d66e2bbbc00b72ad593cb0187 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:13 +0100 Subject: [PATCH 13/46] ARM: at91: remove useless at91_sysirq_mask_rtx The irq fixup from at91_sysirq_mask_rtc and at91_sysirq_mask_rtt is now handled by aic_common_rtc_irq_fixup and aic_common_rtt_irq_fixup. Remove those useless functions. Also remove the now unused mach/at91_rtt.h header. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/Makefile | 2 +- arch/arm/mach-at91/at91sam9260.c | 2 - arch/arm/mach-at91/at91sam9261.c | 2 - arch/arm/mach-at91/at91sam9263.c | 3 - arch/arm/mach-at91/at91sam9g45.c | 3 - arch/arm/mach-at91/at91sam9n12.c | 6 -- arch/arm/mach-at91/at91sam9rl.c | 3 - arch/arm/mach-at91/at91sam9x5.c | 10 --- arch/arm/mach-at91/generic.h | 4 -- arch/arm/mach-at91/include/mach/at91_rtt.h | 35 ---------- arch/arm/mach-at91/sama5d3.c | 6 -- arch/arm/mach-at91/sysirq_mask.c | 75 ---------------------- 12 files changed, 1 insertion(+), 150 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/at91_rtt.h delete mode 100644 arch/arm/mach-at91/sysirq_mask.c diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 9165a4aa7f0d..8ef7d9a2e855 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y := setup.o sysirq_mask.o +obj-y := setup.o obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index 78137c24d90b..34e2abe82ae4 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -51,8 +51,6 @@ static void __init at91sam9260_map_io(void) static void __init at91sam9260_initialize(void) { arm_pm_idle = at91sam9_idle; - - at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT); } AT91_SOC_START(at91sam9260) diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index d29953ecb0c4..47878b849975 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -32,8 +32,6 @@ static void __init at91sam9261_map_io(void) static void __init at91sam9261_initialize(void) { arm_pm_idle = at91sam9_idle; - - at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT); } AT91_SOC_START(at91sam9261) diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index e7ad14864083..aabcb66145d0 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c @@ -29,9 +29,6 @@ static void __init at91sam9263_map_io(void) static void __init at91sam9263_initialize(void) { arm_pm_idle = at91sam9_idle; - - at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0); - at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1); } AT91_SOC_START(at91sam9263) diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 3d225105e0d1..000166777a8d 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -28,9 +28,6 @@ static void __init at91sam9g45_map_io(void) static void __init at91sam9g45_initialize(void) { arm_pm_idle = at91sam9_idle; - - at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC); - at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT); } AT91_SOC_START(at91sam9g45) diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index dee569b1987e..0135f868ea4f 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c @@ -21,12 +21,6 @@ static void __init at91sam9n12_map_io(void) at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE); } -static void __init at91sam9n12_initialize(void) -{ - at91_sysirq_mask_rtc(AT91SAM9N12_BASE_RTC); -} - AT91_SOC_START(at91sam9n12) .map_io = at91sam9n12_map_io, - .init = at91sam9n12_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index bd7e56889b43..1babfb27694a 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c @@ -41,9 +41,6 @@ static void __init at91sam9rl_map_io(void) static void __init at91sam9rl_initialize(void) { arm_pm_idle = at91sam9_idle; - - at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC); - at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT); } AT91_SOC_START(at91sam9rl) diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index f0d5a69a7237..aa17520ccb0a 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c @@ -21,16 +21,6 @@ static void __init at91sam9x5_map_io(void) at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); } -static void __init at91sam9x5_initialize(void) -{ - at91_sysirq_mask_rtc(AT91SAM9X5_BASE_RTC); -} - -/* -------------------------------------------------------------------- - * Interrupt initialization - * -------------------------------------------------------------------- */ - AT91_SOC_START(at91sam9x5) .map_io = at91sam9x5_map_io, - .init = at91sam9x5_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index d53324210adf..e0368aa06390 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -25,10 +25,6 @@ extern void __init at91rm9200_set_type(int type); extern void __init at91rm9200_dt_initialize(void); extern void __init at91_dt_initialize(void); - /* Interrupts */ -extern void __init at91_sysirq_mask_rtc(u32 rtc_base); -extern void __init at91_sysirq_mask_rtt(u32 rtt_base); - /* Timer */ extern void at91rm9200_timer_init(void); diff --git a/arch/arm/mach-at91/include/mach/at91_rtt.h b/arch/arm/mach-at91/include/mach/at91_rtt.h deleted file mode 100644 index 7ec75de8bbb6..000000000000 --- a/arch/arm/mach-at91/include/mach/at91_rtt.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * arch/arm/mach-at91/include/mach/at91_rtt.h - * - * Copyright (C) 2007 Andrew Victor - * Copyright (C) 2007 Atmel Corporation. - * - * Real-time Timer (RTT) - System peripherals regsters. - * Based on AT91SAM9261 datasheet revision D. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef AT91_RTT_H -#define AT91_RTT_H - -#define AT91_RTT_MR 0x00 /* Real-time Mode Register */ -#define AT91_RTT_RTPRES (0xffff << 0) /* Real-time Timer Prescaler Value */ -#define AT91_RTT_ALMIEN (1 << 16) /* Alarm Interrupt Enable */ -#define AT91_RTT_RTTINCIEN (1 << 17) /* Real Time Timer Increment Interrupt Enable */ -#define AT91_RTT_RTTRST (1 << 18) /* Real Time Timer Restart */ - -#define AT91_RTT_AR 0x04 /* Real-time Alarm Register */ -#define AT91_RTT_ALMV (0xffffffff) /* Alarm Value */ - -#define AT91_RTT_VR 0x08 /* Real-time Value Register */ -#define AT91_RTT_CRTV (0xffffffff) /* Current Real-time Value */ - -#define AT91_RTT_SR 0x0c /* Real-time Status Register */ -#define AT91_RTT_ALMS (1 << 0) /* Real-time Alarm Status */ -#define AT91_RTT_RTTINC (1 << 1) /* Real-time Timer Increment */ - -#endif diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c index 3d775d08de08..ae58feada72b 100644 --- a/arch/arm/mach-at91/sama5d3.c +++ b/arch/arm/mach-at91/sama5d3.c @@ -30,12 +30,6 @@ static void __init sama5d3_map_io(void) at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE); } -static void __init sama5d3_initialize(void) -{ - at91_sysirq_mask_rtc(SAMA5D3_BASE_RTC); -} - AT91_SOC_START(sama5d3) .map_io = sama5d3_map_io, - .init = sama5d3_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/sysirq_mask.c b/arch/arm/mach-at91/sysirq_mask.c deleted file mode 100644 index f8bc3511a8c8..000000000000 --- a/arch/arm/mach-at91/sysirq_mask.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * sysirq_mask.c - System-interrupt masking - * - * Copyright (C) 2013 Johan Hovold - * - * Functions to disable system interrupts from backup-powered peripherals. - * - * The RTC and RTT-peripherals are generally powered by backup power (VDDBU) - * and are not reset on wake-up, user, watchdog or software reset. This means - * that their interrupts may be enabled during early boot (e.g. after a user - * reset). - * - * As the RTC and RTT share the system-interrupt line with the PIT, an - * interrupt occurring before a handler has been installed would lead to the - * system interrupt being disabled and prevent the system from booting. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include -#include - -#include "generic.h" - -#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ -#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ -#define AT91_RTC_IRQ_MASK 0x1f /* Available IRQs mask */ - -void __init at91_sysirq_mask_rtc(u32 rtc_base) -{ - void __iomem *base; - - base = ioremap(rtc_base, 64); - if (!base) - return; - - /* - * sam9x5 SoCs have the following errata: - * "RTC: Interrupt Mask Register cannot be used - * Interrupt Mask Register read always returns 0." - * - * Hence we're not relying on IMR values to disable - * interrupts. - */ - writel_relaxed(AT91_RTC_IRQ_MASK, base + AT91_RTC_IDR); - (void)readl_relaxed(base + AT91_RTC_IMR); /* flush */ - - iounmap(base); -} - -void __init at91_sysirq_mask_rtt(u32 rtt_base) -{ - void __iomem *base; - void __iomem *reg; - u32 mode; - - base = ioremap(rtt_base, 16); - if (!base) - return; - - reg = base + AT91_RTT_MR; - - mode = readl_relaxed(reg); - if (mode & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)) { - pr_info("AT91: Disabling rtt irq\n"); - mode &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); - writel_relaxed(mode, reg); - (void)readl_relaxed(reg); /* flush */ - } - - iounmap(base); -} From 5f58c97099f20cb12b463d3bb8bf0cbe522deb22 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:14 +0100 Subject: [PATCH 14/46] ARM: at91: move debug-macro.S into the common space Move debug-macro.S from include/mach/ to include/debug where all other common debug macros are. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- MAINTAINERS | 1 + arch/arm/Kconfig.debug | 9 +++++++-- .../debug-macro.S => include/debug/at91.S} | 19 +++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) rename arch/arm/{mach-at91/include/mach/debug-macro.S => include/debug/at91.S} (68%) diff --git a/MAINTAINERS b/MAINTAINERS index 3589d67437f8..8c25979a3c43 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -877,6 +877,7 @@ F: arch/arm/boot/dts/at91*.dts F: arch/arm/boot/dts/at91*.dtsi F: arch/arm/boot/dts/sama*.dts F: arch/arm/boot/dts/sama*.dtsi +F: arch/arm/include/debug/at91.S ARM/ATMEL AT91 Clock Support M: Boris Brezillon diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 5ddd4906f7a7..e34d24949c6a 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -115,15 +115,18 @@ choice 0x80024000 | 0xf0024000 | UART9 config AT91_DEBUG_LL_DBGU0 - bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" + bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10, 9rl, 9x5, 9n12" + select DEBUG_AT91_UART depends on HAVE_AT91_DBGU0 config AT91_DEBUG_LL_DBGU1 - bool "Kernel low-level debugging on 9263 and 9g45" + bool "Kernel low-level debugging on 9263, 9g45 and sama5d3" + select DEBUG_AT91_UART depends on HAVE_AT91_DBGU1 config AT91_DEBUG_LL_DBGU2 bool "Kernel low-level debugging on sama5d4" + select DEBUG_AT91_UART depends on HAVE_AT91_DBGU2 config DEBUG_BCM2835 @@ -1165,6 +1168,8 @@ config DEBUG_LL_INCLUDE string default "debug/sa1100.S" if DEBUG_SA1100 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 + default "debug/at91.S" if AT91_DEBUG_LL_DBGU0 || AT91_DEBUG_LL_DBGU1 || \ + AT91_DEBUG_LL_DBGU2 default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/meson.S" if DEBUG_MESON_UARTAO diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/include/debug/at91.S similarity index 68% rename from arch/arm/mach-at91/include/mach/debug-macro.S rename to arch/arm/include/debug/at91.S index 2103a90f2261..80a6501b4d50 100644 --- a/arch/arm/mach-at91/include/mach/debug-macro.S +++ b/arch/arm/include/debug/at91.S @@ -1,6 +1,4 @@ /* - * arch/arm/mach-at91/include/mach/debug-macro.S - * * Copyright (C) 2003-2005 SAN People * * Debugging macro include header @@ -11,18 +9,23 @@ * */ -#include -#include - #if defined(CONFIG_AT91_DEBUG_LL_DBGU0) -#define AT91_DBGU AT91_BASE_DBGU0 +#define AT91_DBGU 0xfffff200 /* AT91_BASE_DBGU0 */ #elif defined(CONFIG_AT91_DEBUG_LL_DBGU1) -#define AT91_DBGU AT91_BASE_DBGU1 +#define AT91_DBGU 0xffffee00 /* AT91_BASE_DBGU1 */ #else /* On sama5d4, use USART3 as low level serial console */ -#define AT91_DBGU SAMA5D4_BASE_USART3 +#define AT91_DBGU 0xfc00c000 /* SAMA5D4_BASE_USART3 */ #endif +/* Keep in sync with mach-at91/include/mach/hardware.h */ +#define AT91_IO_P2V(x) ((x) - 0x01000000) + +#define AT91_DBGU_SR (0x14) /* Status Register */ +#define AT91_DBGU_THR (0x1c) /* Transmitter Holding Register */ +#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */ +#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */ + .macro addruart, rp, rv, tmp ldr \rp, =AT91_DBGU @ System peripherals (phys address) ldr \rv, =AT91_IO_P2V(AT91_DBGU) @ System peripherals (virt address) From 427accd3c43aee11c59b4c2d6e8328a0337017fc Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:15 +0100 Subject: [PATCH 15/46] ARM: at91: remove useless at91rm9200_dt_initialize() at91rm9200_dt_initialize() is doing the same as at91_dt_initialize(), use that one instead. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/board-dt-rm9200.c | 2 +- arch/arm/mach-at91/generic.h | 1 - arch/arm/mach-at91/setup.c | 7 ------- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c index 76dfe8f9af50..a15ab6f8de00 100644 --- a/arch/arm/mach-at91/board-dt-rm9200.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c @@ -38,6 +38,6 @@ static const char *at91rm9200_dt_board_compat[] __initdata = { DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") .init_time = at91rm9200_dt_timer_init, .map_io = at91_map_io, - .init_early = at91rm9200_dt_initialize, + .init_early = at91_dt_initialize, .dt_compat = at91rm9200_dt_board_compat, MACHINE_END diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index e0368aa06390..c10c2ddaae6d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -22,7 +22,6 @@ extern void __init at91_init_sram(int bank, unsigned long base, /* Processors */ extern void __init at91rm9200_set_type(int type); -extern void __init at91rm9200_dt_initialize(void); extern void __init at91_dt_initialize(void); /* Timer */ diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index ce25e85720fb..acb8d7724609 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -429,13 +429,6 @@ static void at91_dt_ramc(void) at91_pm_set_standby(standby); } -void __init at91rm9200_dt_initialize(void) -{ - at91_dt_ramc(); - - at91_boot_soc.init(); -} - void __init at91_dt_initialize(void) { at91_dt_ramc(); From bd87373229e3e8b1a2a42b9eeed4c60fd4418ec6 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Mon, 12 Jan 2015 19:42:16 +0100 Subject: [PATCH 16/46] ARM: at91: remove useless at91rm9200_set_type() Since all rm9200 board files have been removed, there is no user of at91rm9200_set_type() left. Remove it Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/generic.h | 1 - arch/arm/mach-at91/setup.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index c10c2ddaae6d..54f3837a0a4d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -21,7 +21,6 @@ extern void __init at91_init_sram(int bank, unsigned long base, unsigned int length); /* Processors */ -extern void __init at91rm9200_set_type(int type); extern void __init at91_dt_initialize(void); /* Timer */ diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index acb8d7724609..e3c21b458bb8 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -31,17 +31,6 @@ struct at91_init_soc __initdata at91_boot_soc; struct at91_socinfo at91_soc_initdata; EXPORT_SYMBOL(at91_soc_initdata); -void __init at91rm9200_set_type(int type) -{ - if (type == ARCH_REVISON_9200_PQFP) - at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP; - else - at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; - - pr_info("filled in soc subtype: %s\n", - at91_get_soc_subtype(&at91_soc_initdata)); -} - void __iomem *at91_ramc_base[2]; EXPORT_SYMBOL_GPL(at91_ramc_base); From 52820d26ec501f6aa52766ab8ca6b22e2dc4e53e Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:21 +0100 Subject: [PATCH 17/46] ARM: at91/dt: at91sam9n12: Add RTC node Add node for the RTC available on the at91sam9n12. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/at91sam9n12.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 68eb9aded164..1d69db2e9e28 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -893,6 +893,13 @@ status = "disabled"; }; + rtc@fffffeb0 { + compatible = "atmel,at91rm9200-rtc"; + reg = <0xfffffeb0 0x40>; + interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; + status = "disabled"; + }; + pwm0: pwm@f8034000 { compatible = "atmel,at91sam9rl-pwm"; reg = <0xf8034000 0x300>; From e39f00e5d28969d8dd52028e43e19186e8a0e328 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:22 +0100 Subject: [PATCH 18/46] ARM: at91/dt: rm9200: add RTC node Add a node for the RTC available on at91rm9200. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/at91rm9200.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi index 6c97d4af61ee..f449a864b81e 100644 --- a/arch/arm/boot/dts/at91rm9200.dtsi +++ b/arch/arm/boot/dts/at91rm9200.dtsi @@ -356,6 +356,13 @@ interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; }; + rtc: rtc@fffffe00 { + compatible = "atmel,at91rm9200-rtc"; + reg = <0xfffffe00 0x40>; + interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; + status = "disabled"; + }; + tcb0: timer@fffa0000 { compatible = "atmel,at91rm9200-tcb"; reg = <0xfffa0000 0x100>; From 74335f4977178921d172d7cba4749e89a34d0f52 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:23 +0100 Subject: [PATCH 19/46] ARM: at91/dt: at91rm9200ek: enable RTC Enable the RTC on the at91rm9200ek. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/at91rm9200ek.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts index 43eb779dd6f6..2a5d21247d7e 100644 --- a/arch/arm/boot/dts/at91rm9200ek.dts +++ b/arch/arm/boot/dts/at91rm9200ek.dts @@ -77,6 +77,10 @@ dbgu: serial@fffff200 { status = "okay"; }; + + rtc: rtc@fffffe00 { + status = "okay"; + }; }; usb0: ohci@00300000 { From f04660e48b201b3ca3f3fbdfbd57f11e68a50600 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:24 +0100 Subject: [PATCH 20/46] ARM: at91/dt: add SRAM nodes Add nodes for the SRAM available on atmel SoCs For the at91sam9260 and the at91sam9g20, address mirroring is used to create a single contiguous SRAM range instead of declaring two separate banks. Also remove leftover TODOs in the sam9g45 file Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon [nicolas.ferre@atmel.com: correct at91sam9rl sram size => 0x10000] Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/at91rm9200.dtsi | 5 +++++ arch/arm/boot/dts/at91sam9260.dtsi | 5 +++++ arch/arm/boot/dts/at91sam9261.dtsi | 5 +++++ arch/arm/boot/dts/at91sam9263.dtsi | 10 ++++++++++ arch/arm/boot/dts/at91sam9g20.dtsi | 9 +++++++++ arch/arm/boot/dts/at91sam9g45.dtsi | 7 +++++-- arch/arm/boot/dts/at91sam9n12.dtsi | 5 +++++ arch/arm/boot/dts/at91sam9rl.dtsi | 5 +++++ arch/arm/boot/dts/at91sam9x5.dtsi | 5 +++++ arch/arm/boot/dts/sama5d3.dtsi | 5 +++++ arch/arm/boot/dts/sama5d4.dtsi | 5 +++++ 11 files changed, 64 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi index f449a864b81e..21c2b504f977 100644 --- a/arch/arm/boot/dts/at91rm9200.dtsi +++ b/arch/arm/boot/dts/at91rm9200.dtsi @@ -66,6 +66,11 @@ }; }; + sram: sram@00200000 { + compatible = "mmio-sram"; + reg = <0x00200000 0x4000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index dd1313cbc314..fff0ee69aab4 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -69,6 +69,11 @@ }; }; + sram0: sram@002ff000 { + compatible = "mmio-sram"; + reg = <0x002ff000 0x2000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi index cdb9ed612109..e247b0b5fdab 100644 --- a/arch/arm/boot/dts/at91sam9261.dtsi +++ b/arch/arm/boot/dts/at91sam9261.dtsi @@ -60,6 +60,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x28000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index ef8a70c27439..8a210d5033b1 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -62,6 +62,16 @@ }; }; + sram0: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x14000>; + }; + + sram1: sram@00500000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x4000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index a50ee587a7af..f59301618163 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi @@ -16,6 +16,15 @@ reg = <0x20000000 0x08000000>; }; + sram0: sram@002ff000 { + status = "disabled"; + }; + + sram1: sram@002fc000 { + compatible = "mmio-sram"; + reg = <0x002fc000 0x8000>; + }; + ahb { apb { i2c0: i2c@fffac000 { diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index 2a8da8a884b4..ee80aa9c0759 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -74,6 +74,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x10000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; @@ -1287,7 +1292,6 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x00700000 0x100000>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - //TODO clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; status = "disabled"; @@ -1297,7 +1301,6 @@ compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x00800000 0x100000>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - //TODO clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; clock-names = "usb_clk", "ehci_clk", "hclk", "uhpck"; status = "disabled"; diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 1d69db2e9e28..c2666a7cb5b1 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -64,6 +64,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x8000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi index 72424371413e..40f645b8fe25 100644 --- a/arch/arm/boot/dts/at91sam9rl.dtsi +++ b/arch/arm/boot/dts/at91sam9rl.dtsi @@ -70,6 +70,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x10000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index bbb3ba65165f..818dabdd8c0e 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi @@ -72,6 +72,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x8000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index d701ddda0e00..e17614fe58a9 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -78,6 +78,11 @@ }; }; + sram: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x20000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 0a2477fe5525..1b4fe4e19721 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -103,6 +103,11 @@ }; }; + ns_sram: sram@00210000 { + compatible = "mmio-sram"; + reg = <0x00210000 0x10000>; + }; + ahb { compatible = "simple-bus"; #address-cells = <1>; From 1d376dff0cd988c7387e4bcd13aa9621f7b466b3 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:25 +0100 Subject: [PATCH 21/46] ARM: at91/dt: Add a dtsi for at91sam9xe at91sam9xe is slightly different from at91sam9260, in particular it has a different SRAM size and location. Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- .../devicetree/bindings/arm/atmel-at91.txt | 1 + arch/arm/boot/dts/at91sam9xe.dtsi | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 arch/arm/boot/dts/at91sam9xe.dtsi diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt index 571fc76c6edb..ad319f84f560 100644 --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt @@ -24,6 +24,7 @@ compatible: must be one of: o "atmel,at91sam9g45" o "atmel,at91sam9n12" o "atmel,at91sam9rl" + o "atmel,at91sam9xe" * "atmel,sama5" for SoCs using a Cortex-A5, shall be extended with the specific SoC family: o "atmel,sama5d3" shall be extended with the specific SoC compatible: diff --git a/arch/arm/boot/dts/at91sam9xe.dtsi b/arch/arm/boot/dts/at91sam9xe.dtsi new file mode 100644 index 000000000000..0278f63b2daf --- /dev/null +++ b/arch/arm/boot/dts/at91sam9xe.dtsi @@ -0,0 +1,60 @@ +/* + * at91sam9xe.dtsi - Device Tree Include file for AT91SAM9XE family SoC + * + * Copyright (C) 2015 Atmel, + * 2015 Alexandre Belloni + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "at91sam9260.dtsi" + +/ { + model = "Atmel AT91SAM9XE family SoC"; + compatible = "atmel,at91sam9xe", "atmel,at91sam9260"; + + sram0: sram@002ff000 { + status = "disabled"; + }; + + sram1: sram@00300000 { + compatible = "mmio-sram"; + reg = <0x00300000 0x4000>; + }; +}; From 81a229d389866f5ef848fb66ff881a709106995e Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Tue, 13 Jan 2015 19:12:26 +0100 Subject: [PATCH 22/46] ARM: at91/dt: ethernut5: use at91sam9xe.dtsi The ethernut5 is actually based on an at91sam9xe, use the correct dts include. Cc: Martin Reimann Cc: Tim Schendekehl Signed-off-by: Alexandre Belloni Acked-by: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/ethernut5.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/ethernut5.dts b/arch/arm/boot/dts/ethernut5.dts index 8f941c2db7c6..243044343ee8 100644 --- a/arch/arm/boot/dts/ethernut5.dts +++ b/arch/arm/boot/dts/ethernut5.dts @@ -6,7 +6,7 @@ * Licensed under GPLv2. */ /dts-v1/; -#include "at91sam9260.dtsi" +#include "at91sam9xe.dtsi" / { model = "Ethernut 5"; From b00122f6e1d449e735fe1d8df052dae3c63f4b83 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Sun, 4 Jan 2015 17:02:26 +0800 Subject: [PATCH 23/46] ARM: at91: dts: sama5d3: add isi clock Add ISI peripheral clock in sama5d3.dtsi. Signed-off-by: Josh Wu Acked-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index e17614fe58a9..9a6fdc265ae7 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -219,6 +219,8 @@ compatible = "atmel,at91sam9g45-isi"; reg = <0xf0034000 0x4000>; interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>; + clocks = <&isi_clk>; + clock-names = "isi_clk"; status = "disabled"; }; From cbaa29c4c3a7b880d196c15b41fc20dcfdac9ac1 Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Sun, 4 Jan 2015 17:02:27 +0800 Subject: [PATCH 24/46] ARM: at91: dts: sama5d3: split isi pinctrl As the ISI has 12 data lines, however we only use 8 data lines with sensor module. So, split the data line into two groups which make it can be choosed depends on the hardware design. Signed-off-by: Bo Shen Acked-by: Alexandre Belloni Signed-off-by: Josh Wu Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 11 ++++++++--- arch/arm/boot/dts/sama5d3xmb.dtsi | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 9a6fdc265ae7..58b93d384f39 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -557,7 +557,7 @@ }; isi { - pinctrl_isi: isi-0 { + pinctrl_isi_data_0_7: isi-0-data-0-7 { atmel,pins = ; /* PA30 periph C ISI_VSYNC, conflicts with TWD0, URXD1 */ + }; + + pinctrl_isi_data_8_9: isi-0-data-8-9 { + atmel,pins = + ; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */ }; + pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { atmel,pins = ; /* PD31 periph B ISI_MCK */ diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 49c10d33df30..2530541680e7 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -61,7 +61,7 @@ isi: isi@f0034000 { pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_isi &pinctrl_isi_pck_as_mck &pinctrl_isi_power &pinctrl_isi_reset>; + pinctrl-0 = <&pinctrl_isi_data_0_7 &pinctrl_isi_pck_as_mck &pinctrl_isi_power &pinctrl_isi_reset>; }; mmc1: mmc@f8000000 { From 3d755488dd882176e6857733c5e9bff1697c1852 Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Sun, 4 Jan 2015 17:02:28 +0800 Subject: [PATCH 25/46] ARM: at91: dts: sama5d3: add missing pins of isi The ISI has 12 data lines, add the missing two data lines. Signed-off-by: Bo Shen Acked-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 58b93d384f39..0f2b4eff26ff 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -578,6 +578,12 @@ AT91_PIOC 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */ }; + pinctrl_isi_data_10_11: isi-0-data-10-11 { + atmel,pins = + ; /* PC26 periph C ISI_PD11, conflicts with SPI1_NPCS1, TWD1 */ + }; + pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { atmel,pins = ; /* PD31 periph B ISI_MCK */ From 24fe3f02c0bfae19736f454bc76a9863a0c76e5d Mon Sep 17 00:00:00 2001 From: Bo Shen Date: Sun, 4 Jan 2015 17:02:29 +0800 Subject: [PATCH 26/46] ARM: at91: dts: sama5d3: move the isi mck pin to mb The mck is decided by the board design, move it to mb related dtsi file. Signed-off-by: Bo Shen Acked-by: Alexandre Belloni Signed-off-by: Josh Wu Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 5 ----- arch/arm/boot/dts/sama5d3xmb.dtsi | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 0f2b4eff26ff..bd3b43558ddb 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -583,11 +583,6 @@ ; /* PC26 periph C ISI_PD11, conflicts with SPI1_NPCS1, TWD1 */ }; - - pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { - atmel,pins = - ; /* PD31 periph B ISI_MCK */ - }; }; mmc0 { diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 2530541680e7..6af1cbab3572 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -117,6 +117,11 @@ ; /* PD30 periph B */ }; + pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { + atmel,pins = + ; /* PD31 periph B ISI_MCK */ + }; + pinctrl_isi_reset: isi_reset-0 { atmel,pins = ; /* PE24 gpio */ From 97889b14ed6f18e85dedca32116c2e4502b445c6 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Sun, 4 Jan 2015 17:02:30 +0800 Subject: [PATCH 27/46] ARM: at91: dts: sama5d3: change name of pinctrl_isi_{power,reset} For sama5d3xmb board, the pins: pinctrl_isi_{power,reset} is used to power-down or reset camera sensor. So we should let camera sensor instead of ISI to configure the pins. This patch will change pinctrl name from pinctrl_isi_{power,reset} to pinctrl_sensor_{power,reset}. And remove these two pinctrl from ISI's DT node. We will add these two pinctrl to sensor's DT node. Signed-off-by: Josh Wu Acked-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3xmb.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index 6af1cbab3572..db47f8b81837 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -61,7 +61,7 @@ isi: isi@f0034000 { pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_isi_data_0_7 &pinctrl_isi_pck_as_mck &pinctrl_isi_power &pinctrl_isi_reset>; + pinctrl-0 = <&pinctrl_isi_data_0_7 &pinctrl_isi_pck_as_mck>; }; mmc1: mmc@f8000000 { @@ -122,12 +122,12 @@ ; /* PD31 periph B ISI_MCK */ }; - pinctrl_isi_reset: isi_reset-0 { + pinctrl_sensor_reset: sensor_reset-0 { atmel,pins = ; /* PE24 gpio */ }; - pinctrl_isi_power: isi_power-0 { + pinctrl_sensor_power: sensor_power-0 { atmel,pins = ; /* PE29 gpio */ }; From fbe18601a521d2ac2a6190107970a4e882a06a5d Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Sun, 4 Jan 2015 17:02:31 +0800 Subject: [PATCH 28/46] ARM: at91: dts: sama5d3: change name of pinctrl of ISI_MCK For sama5d3xmb board, the pins: pinctrl_isi_pck_as_mck is pck1, and used to provide MCK for camera sensor. We change its name to: pinctrl_pck1_as_isi_mck. As we want camera sensor instead of ISI to configure the pck1 (ISI_MCK) pin. So we remove this pinctrl from ISI DT node. It will be added in sensor's DT node. Signed-off-by: Josh Wu Acked-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3xmb.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index db47f8b81837..d9464fce4c0e 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -61,7 +61,7 @@ isi: isi@f0034000 { pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_isi_data_0_7 &pinctrl_isi_pck_as_mck>; + pinctrl-0 = <&pinctrl_isi_data_0_7>; }; mmc1: mmc@f8000000 { @@ -117,7 +117,7 @@ ; /* PD30 periph B */ }; - pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { + pinctrl_pck1_as_isi_mck: pck1_as_isi_mck-0 { atmel,pins = ; /* PD31 periph B ISI_MCK */ }; From 4dd32e6d24932b0b0327d3a8ce526a56446e9b98 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Wed, 14 Jan 2015 10:41:54 +0800 Subject: [PATCH 29/46] ARM: at91: dts: sama5d3: add ov2640 camera sensor support According to v4l2 dt document, we add: a camera host: ISI port. a i2c camera sensor: ov2640 port. to sama5d3xmb.dtsi. The ov2640 node defines the pinctrls, clocks and refer to isi port. The ISI node also has a reference to the ov2640 port. Signed-off-by: Josh Wu Acked-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d3.dtsi | 6 ++++++ arch/arm/boot/dts/sama5d3xmb.dtsi | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index bd3b43558ddb..261311bdf65b 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -219,9 +219,15 @@ compatible = "atmel,at91sam9g45-isi"; reg = <0xf0034000 0x4000>; interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_isi_data_0_7>; clocks = <&isi_clk>; clock-names = "isi_clk"; status = "disabled"; + port { + #address-cells = <1>; + #size-cells = <0>; + }; }; sfr: sfr@f0038000 { diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi index d9464fce4c0e..9fdb8a07b145 100644 --- a/arch/arm/boot/dts/sama5d3xmb.dtsi +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi @@ -52,6 +52,29 @@ }; }; + i2c1: i2c@f0018000 { + ov2640: camera@0x30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pck1_as_isi_mck &pinctrl_sensor_power &pinctrl_sensor_reset>; + resetb-gpios = <&pioE 24 GPIO_ACTIVE_LOW>; + pwdn-gpios = <&pioE 29 GPIO_ACTIVE_HIGH>; + /* use pck1 for the master clock of ov2640 */ + clocks = <&pck1>; + clock-names = "xvclk"; + assigned-clocks = <&pck1>; + assigned-clock-rates = <25000000>; + + port { + ov2640_0: endpoint { + remote-endpoint = <&isi_0>; + bus-width = <8>; + }; + }; + }; + }; + usart1: serial@f0020000 { dmas = <0>, <0>; /* Do not use DMA for usart1 */ pinctrl-names = "default"; @@ -60,8 +83,12 @@ }; isi: isi@f0034000 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_isi_data_0_7>; + port { + isi_0: endpoint { + remote-endpoint = <&ov2640_0>; + bus-width = <8>; + }; + }; }; mmc1: mmc@f8000000 { From f5598d346e36169f3eb4008c895300a39b100a0b Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:24 +0100 Subject: [PATCH 30/46] ARM: at91: pm: rework cpu detection Store SoC differences in a struct to remove cpu_is_* usage. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/pm.c | 54 +++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 9b15169a1c62..79aa793d1f00 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,11 @@ #include "generic.h" #include "pm.h" +static struct { + unsigned long uhp_udp_mask; + int memctrl; +} at91_pm_data; + static void (*at91_pm_standby)(void); static int at91_pm_valid_state(suspend_state_t state) @@ -71,17 +77,9 @@ static int at91_pm_verify_clocks(void) scsr = at91_pmc_read(AT91_PMC_SCSR); /* USB must not be using PLLB */ - if (cpu_is_at91rm9200()) { - if ((scsr & (AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP)) != 0) { - pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); - return 0; - } - } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263() - || cpu_is_at91sam9g20() || cpu_is_at91sam9g10()) { - if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { - pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); - return 0; - } + if ((scsr & at91_pm_data.uhp_udp_mask) != 0) { + pr_err("AT91: PM - Suspend-to-RAM with USB still active\n"); + return 0; } /* PCK0..PCK3 must be disabled, or configured to use clk32k */ @@ -149,18 +147,13 @@ static int at91_pm_enter(suspend_state_t state) * turning off the main oscillator; reverse on wakeup. */ if (slow_clock) { - int memctrl = AT91_MEMCTRL_SDRAMC; - - if (cpu_is_at91rm9200()) - memctrl = AT91_MEMCTRL_MC; - else if (cpu_is_at91sam9g45()) - memctrl = AT91_MEMCTRL_DDRSDR; #ifdef CONFIG_AT91_SLOW_CLOCK /* copy slow_clock handler to SRAM, and call it */ memcpy(slow_clock, at91_slow_clock, at91_slow_clock_sz); #endif slow_clock(at91_pmc_base, at91_ramc_base[0], - at91_ramc_base[1], memctrl); + at91_ramc_base[1], + at91_pm_data.memctrl); break; } else { pr_info("AT91: PM - no slow clock mode enabled ...\n"); @@ -237,10 +230,29 @@ static int __init at91_pm_init(void) pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); - /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ - if (cpu_is_at91rm9200()) + at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; + + if (of_machine_is_compatible("atmel,at91rm9200")) { + /* + * AT91RM9200 SDRAM low-power mode cannot be used with + * self-refresh. + */ at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); - + + at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | + AT91RM9200_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_MC; + } else if (of_machine_is_compatible("atmel,at91sam9260") || + of_machine_is_compatible("atmel,at91sam9g20") || + of_machine_is_compatible("atmel,at91sam9261") || + of_machine_is_compatible("atmel,at91sam9g10") || + of_machine_is_compatible("atmel,at91sam9263")) { + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | + AT91SAM926x_PMC_UDP; + } else if (of_machine_is_compatible("atmel,at91sam9g45")) { + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + } + if (at91_cpuidle_device.dev.platform_data) platform_device_register(&at91_cpuidle_device); From d2e467905596760f1218e3382de24ab2c14d5baf Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:25 +0100 Subject: [PATCH 31/46] ARM: at91: pm: use the mmio-sram pool to access SRAM Now that the SRAM is part of a genpool, use it to allocate memory to use for the slowclock implementation. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/Kconfig | 1 + arch/arm/mach-at91/pm.c | 46 +++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index cec0fb5d621a..b7dcef50db23 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -178,6 +178,7 @@ comment "AT91 Feature Selections" config AT91_SLOW_CLOCK bool "Suspend-to-RAM disables main oscillator" + select SRAM depends on SUSPEND help Select this if you want Suspend-to-RAM to save the most power diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 79aa793d1f00..515791edcc60 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -14,10 +14,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -222,10 +224,52 @@ void at91_pm_set_standby(void (*at91_standby)(void)) } } +#ifdef CONFIG_AT91_SLOW_CLOCK +static void __init at91_pm_sram_init(void) +{ + struct gen_pool *sram_pool; + phys_addr_t sram_pbase; + unsigned long sram_base; + struct device_node *node; + struct platform_device *pdev; + + node = of_find_compatible_node(NULL, NULL, "mmio-sram"); + if (!node) { + pr_warn("%s: failed to find sram node!\n", __func__); + return; + } + + pdev = of_find_device_by_node(node); + if (!pdev) { + pr_warn("%s: failed to find sram device!\n", __func__); + goto put_node; + } + + sram_pool = dev_get_gen_pool(&pdev->dev); + if (!sram_pool) { + pr_warn("%s: sram pool unavailable!\n", __func__); + goto put_node; + } + + sram_base = gen_pool_alloc(sram_pool, at91_slow_clock_sz); + if (!sram_base) { + pr_warn("%s: unable to alloc ocram!\n", __func__); + goto put_node; + } + + sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); + slow_clock = __arm_ioremap_exec(sram_pbase, at91_slow_clock_sz, false); + +put_node: + of_node_put(node); +} +#endif + + static int __init at91_pm_init(void) { #ifdef CONFIG_AT91_SLOW_CLOCK - slow_clock = (void *) (AT91_IO_VIRT_BASE - at91_slow_clock_sz); + at91_pm_sram_init(); #endif pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); From a63ba4114690cad6e71cbcfd187b0ebf20321dfa Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:26 +0100 Subject: [PATCH 32/46] ARM: at91: pm: add UDP and UHP checks to newer SoCs Check UDP and UHP on sam9x5, sam9n12 and the sama5 series. Check UHP on the sam9g45. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/pm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 515791edcc60..71cc845263dc 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -275,6 +275,7 @@ static int __init at91_pm_init(void) pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; if (of_machine_is_compatible("atmel,at91rm9200")) { /* @@ -286,14 +287,8 @@ static int __init at91_pm_init(void) at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; at91_pm_data.memctrl = AT91_MEMCTRL_MC; - } else if (of_machine_is_compatible("atmel,at91sam9260") || - of_machine_is_compatible("atmel,at91sam9g20") || - of_machine_is_compatible("atmel,at91sam9261") || - of_machine_is_compatible("atmel,at91sam9g10") || - of_machine_is_compatible("atmel,at91sam9263")) { - at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | - AT91SAM926x_PMC_UDP; } else if (of_machine_is_compatible("atmel,at91sam9g45")) { + at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP; at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; } From 4db0ba22da9f4406c292a6a6110eeb2edd12f16a Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:27 +0100 Subject: [PATCH 33/46] ARM: at91: pm: prepare for multiplatform Split at91_pm_init() in three variants that are called by the respective SoCs .init_machine. This allows to remove the of_machine_is_compatible() calls and move at91_pm_init() out of arch_initcall() which is required for multiplatform. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/board-dt-rm9200.c | 11 ++++++ arch/arm/mach-at91/board-dt-sam9.c | 27 +++++++++++++++ arch/arm/mach-at91/board-dt-sama5.c | 1 + arch/arm/mach-at91/generic.h | 12 +++++++ arch/arm/mach-at91/pm.c | 50 ++++++++++++++++------------ 5 files changed, 79 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c index a15ab6f8de00..5f82a65153e1 100644 --- a/arch/arm/mach-at91/board-dt-rm9200.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,15 @@ static void __init at91rm9200_dt_timer_init(void) at91rm9200_timer_init(); } +static void __init rm9200_dt_device_init(void) +{ + at91_rm9200_pm_init(); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + + + static const char *at91rm9200_dt_board_compat[] __initdata = { "atmel,at91rm9200", NULL @@ -39,5 +49,6 @@ DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") .init_time = at91rm9200_dt_timer_init, .map_io = at91_map_io, .init_early = at91_dt_initialize, + .init_machine = rm9200_dt_device_init, .dt_compat = at91rm9200_dt_board_compat, MACHINE_END diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c index f99246aa9b38..0fe1ced608c5 100644 --- a/arch/arm/mach-at91/board-dt-sam9.c +++ b/arch/arm/mach-at91/board-dt-sam9.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -23,6 +24,12 @@ #include "generic.h" +static void __init sam9_dt_device_init(void) +{ + at91_sam9260_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + static const char *at91_dt_board_compat[] __initdata = { "atmel,at91sam9", NULL @@ -32,5 +39,25 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") /* Maintainer: Atmel */ .map_io = at91_map_io, .init_early = at91_dt_initialize, + .init_machine = sam9_dt_device_init, .dt_compat = at91_dt_board_compat, MACHINE_END + +static void __init sam9g45_dt_device_init(void) +{ + at91_sam9g45_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + +static const char *at91_9g45_board_compat[] __initconst = { + "atmel,at91sam9g45", + NULL +}; + +DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") + /* Maintainer: Atmel */ + .map_io = at91_map_io, + .init_early = at91_dt_initialize, + .init_machine = sam9g45_dt_device_init, + .dt_compat = at91_9g45_board_compat, +MACHINE_END diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c index 8fb9ef5333f1..44d372a22a29 100644 --- a/arch/arm/mach-at91/board-dt-sama5.c +++ b/arch/arm/mach-at91/board-dt-sama5.c @@ -28,6 +28,7 @@ static void __init sama5_dt_device_init(void) { + at91_sam9260_pm_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 54f3837a0a4d..fae7a703813c 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -31,4 +31,16 @@ extern void at91sam9_idle(void); /* Matrix */ extern void at91_ioremap_matrix(u32 base_addr); + + +#ifdef CONFIG_PM +extern void __init at91_rm9200_pm_init(void); +extern void __init at91_sam9260_pm_init(void); +extern void __init at91_sam9g45_pm_init(void); +#else +void __init at91_rm9200_pm_init(void) { } +void __init at91_sam9260_pm_init(void) { } +void __init at91_sam9g45_pm_init(void) { } +#endif + #endif /* _AT91_GENERIC_H */ diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 71cc845263dc..81f2f12d3cc1 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -266,7 +266,7 @@ put_node: #endif -static int __init at91_pm_init(void) +static void __init at91_pm_init(void) { #ifdef CONFIG_AT91_SLOW_CLOCK at91_pm_sram_init(); @@ -274,29 +274,35 @@ static int __init at91_pm_init(void) pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); - at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; - at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; - - if (of_machine_is_compatible("atmel,at91rm9200")) { - /* - * AT91RM9200 SDRAM low-power mode cannot be used with - * self-refresh. - */ - at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); - - at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | - AT91RM9200_PMC_UDP; - at91_pm_data.memctrl = AT91_MEMCTRL_MC; - } else if (of_machine_is_compatible("atmel,at91sam9g45")) { - at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP; - at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; - } - if (at91_cpuidle_device.dev.platform_data) platform_device_register(&at91_cpuidle_device); suspend_set_ops(&at91_pm_ops); - - return 0; } -arch_initcall(at91_pm_init); + +void __init at91_rm9200_pm_init(void) +{ + /* + * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. + */ + at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); + + at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_MC; + + at91_pm_init(); +} + +void __init at91_sam9260_pm_init(void) +{ + at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; + return at91_pm_init(); +} + +void __init at91_sam9g45_pm_init(void) +{ + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + return at91_pm_init(); +} From 14efc54a9470e63ce004ae17e9512f4b3953a2fe Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:28 +0100 Subject: [PATCH 34/46] ARM: at91: remove useless map_io Now that the SRAM is initialized by the mmio-sram driver, .map_io is useless. remove it. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/at91rm9200.c | 6 ------ arch/arm/mach-at91/at91sam9260.c | 27 --------------------------- arch/arm/mach-at91/at91sam9261.c | 9 --------- arch/arm/mach-at91/at91sam9263.c | 7 ------- arch/arm/mach-at91/at91sam9g45.c | 7 ------- arch/arm/mach-at91/at91sam9n12.c | 6 ------ arch/arm/mach-at91/at91sam9rl.c | 18 ------------------ arch/arm/mach-at91/at91sam9x5.c | 6 ------ arch/arm/mach-at91/sama5d3.c | 6 ------ 9 files changed, 92 deletions(-) diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index b52916947535..fc7c26138037 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c @@ -42,11 +42,6 @@ static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd) /* -------------------------------------------------------------------- * AT91RM9200 processor initialization * -------------------------------------------------------------------- */ -static void __init at91rm9200_map_io(void) -{ - /* Map peripherals */ - at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE); -} static void __init at91rm9200_initialize(void) { @@ -56,6 +51,5 @@ static void __init at91rm9200_initialize(void) AT91_SOC_START(at91rm9200) - .map_io = at91rm9200_map_io, .init = at91rm9200_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index 34e2abe82ae4..ab9841c8b0d5 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -22,38 +22,11 @@ * AT91SAM9260 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9xe_map_io(void) -{ - unsigned long sram_size; - - switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) { - case AT91_CIDR_SRAMSIZ_32K: - sram_size = 2 * SZ_16K; - break; - case AT91_CIDR_SRAMSIZ_16K: - default: - sram_size = SZ_16K; - } - - at91_init_sram(0, AT91SAM9XE_SRAM_BASE, sram_size); -} - -static void __init at91sam9260_map_io(void) -{ - if (cpu_is_at91sam9xe()) - at91sam9xe_map_io(); - else if (cpu_is_at91sam9g20()) - at91_init_sram(0, AT91SAM9G20_SRAM_BASE, AT91SAM9G20_SRAM_SIZE); - else - at91_init_sram(0, AT91SAM9260_SRAM_BASE, AT91SAM9260_SRAM_SIZE); -} - static void __init at91sam9260_initialize(void) { arm_pm_idle = at91sam9_idle; } AT91_SOC_START(at91sam9260) - .map_io = at91sam9260_map_io, .init = at91sam9260_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 47878b849975..2029096b93fa 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -21,20 +21,11 @@ * AT91SAM9261 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9261_map_io(void) -{ - if (cpu_is_at91sam9g10()) - at91_init_sram(0, AT91SAM9G10_SRAM_BASE, AT91SAM9G10_SRAM_SIZE); - else - at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); -} - static void __init at91sam9261_initialize(void) { arm_pm_idle = at91sam9_idle; } AT91_SOC_START(at91sam9261) - .map_io = at91sam9261_map_io, .init = at91sam9261_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index aabcb66145d0..1fe672a05513 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c @@ -20,18 +20,11 @@ * AT91SAM9263 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9263_map_io(void) -{ - at91_init_sram(0, AT91SAM9263_SRAM0_BASE, AT91SAM9263_SRAM0_SIZE); - at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE); -} - static void __init at91sam9263_initialize(void) { arm_pm_idle = at91sam9_idle; } AT91_SOC_START(at91sam9263) - .map_io = at91sam9263_map_io, .init = at91sam9263_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 000166777a8d..d0493df40a13 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -19,18 +19,11 @@ /* -------------------------------------------------------------------- * AT91SAM9G45 processor initialization * -------------------------------------------------------------------- */ - -static void __init at91sam9g45_map_io(void) -{ - at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE); -} - static void __init at91sam9g45_initialize(void) { arm_pm_idle = at91sam9_idle; } AT91_SOC_START(at91sam9g45) - .map_io = at91sam9g45_map_io, .init = at91sam9g45_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index 0135f868ea4f..b5ea69a3eaf6 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c @@ -16,11 +16,5 @@ * AT91SAM9N12 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9n12_map_io(void) -{ - at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE); -} - AT91_SOC_START(at91sam9n12) - .map_io = at91sam9n12_map_io, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index 1babfb27694a..33acae30bb0b 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c @@ -21,29 +21,11 @@ * AT91SAM9RL processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9rl_map_io(void) -{ - unsigned long sram_size; - - switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) { - case AT91_CIDR_SRAMSIZ_32K: - sram_size = 2 * SZ_16K; - break; - case AT91_CIDR_SRAMSIZ_16K: - default: - sram_size = SZ_16K; - } - - /* Map SRAM */ - at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size); -} - static void __init at91sam9rl_initialize(void) { arm_pm_idle = at91sam9_idle; } AT91_SOC_START(at91sam9rl) - .map_io = at91sam9rl_map_io, .init = at91sam9rl_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index aa17520ccb0a..7b60a529db01 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c @@ -16,11 +16,5 @@ * AT91SAM9x5 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9x5_map_io(void) -{ - at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); -} - AT91_SOC_START(at91sam9x5) - .map_io = at91sam9x5_map_io, AT91_SOC_END diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c index ae58feada72b..b7c64ca7107f 100644 --- a/arch/arm/mach-at91/sama5d3.c +++ b/arch/arm/mach-at91/sama5d3.c @@ -25,11 +25,5 @@ * AT91SAM9x5 processor initialization * -------------------------------------------------------------------- */ -static void __init sama5d3_map_io(void) -{ - at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE); -} - AT91_SOC_START(sama5d3) - .map_io = sama5d3_map_io, AT91_SOC_END From 84fb0dc7c8abc2ea34496cdb32493bd8f7665dac Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:29 +0100 Subject: [PATCH 35/46] ARM: at91: sama5d4: remove useless call to at91_init_sram Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/sama5d4.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c index 7638509639f4..fa127fb79221 100644 --- a/arch/arm/mach-at91/sama5d4.c +++ b/arch/arm/mach-at91/sama5d4.c @@ -56,7 +56,6 @@ static struct map_desc at91_io_desc[] __initdata = { static void __init sama5d4_map_io(void) { iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc)); - at91_init_sram(0, SAMA5D4_NS_SRAM_BASE, SAMA5D4_NS_SRAM_SIZE); } AT91_SOC_START(sama5d4) From 0be0b8cd49f22037096ad41b831a93dd8d0d4f87 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:30 +0100 Subject: [PATCH 36/46] ARM: at91: remove unused at91_init_sram SRAM initialization is now done through the mmio-sram driver and at91_init_sram() is not called anymore, remove it. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/generic.h | 2 -- arch/arm/mach-at91/setup.c | 20 -------------------- 2 files changed, 22 deletions(-) diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index fae7a703813c..1823a779182d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -17,8 +17,6 @@ /* Map io */ extern void __init at91_map_io(void); extern void __init at91_alt_map_io(void); -extern void __init at91_init_sram(int bank, unsigned long base, - unsigned int length); /* Processors */ extern void __init at91_dt_initialize(void); diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index e3c21b458bb8..4c184285d38f 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -34,26 +34,6 @@ EXPORT_SYMBOL(at91_soc_initdata); void __iomem *at91_ramc_base[2]; EXPORT_SYMBOL_GPL(at91_ramc_base); -static struct map_desc sram_desc[2] __initdata; - -void __init at91_init_sram(int bank, unsigned long base, unsigned int length) -{ - struct map_desc *desc = &sram_desc[bank]; - - desc->virtual = (unsigned long)AT91_IO_VIRT_BASE - length; - if (bank > 0) - desc->virtual -= sram_desc[bank - 1].length; - - desc->pfn = __phys_to_pfn(base); - desc->length = length; - desc->type = MT_MEMORY_RWX_NONCACHED; - - pr_info("sram at 0x%lx of 0x%x mapped at 0x%lx\n", - base, length, desc->virtual); - - iotable_init(desc, 1); -} - static struct map_desc at91_io_desc __initdata __maybe_unused = { .virtual = (unsigned long)AT91_VA_BASE_SYS, .pfn = __phys_to_pfn(AT91_BASE_SYS), From 29ee506d0d56f6d39cc237de2512f9cb5629cbf7 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 15:59:31 +0100 Subject: [PATCH 37/46] ARM: at91: move at91rm9200_idle() to clk/at91/pmc.c Move at91rm9200_idle() along with at91sam9_idle() in clk/at91/pmc.c. Signed-off-by: Alexandre Belloni Acked-by: Michael Turquette Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/at91rm9200.c | 9 --------- arch/arm/mach-at91/generic.h | 1 + drivers/clk/at91/pmc.c | 9 +++++++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index fc7c26138037..3be1963f5c56 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c @@ -21,14 +21,6 @@ #include "soc.h" #include "generic.h" -static void at91rm9200_idle(void) -{ - /* - * Disable the processor clock. The processor will be automatically - * re-enabled by an interrupt or by a reset. - */ - at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); -} static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd) { @@ -49,7 +41,6 @@ static void __init at91rm9200_initialize(void) arm_pm_restart = at91rm9200_restart; } - AT91_SOC_START(at91rm9200) .init = at91rm9200_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 1823a779182d..44fc725edcf1 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -25,6 +25,7 @@ extern void __init at91_dt_initialize(void); extern void at91rm9200_timer_init(void); /* idle */ +extern void at91rm9200_idle(void); extern void at91sam9_idle(void); /* Matrix */ diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 386999b4f8eb..f07c8152e5cc 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -27,6 +27,15 @@ void __iomem *at91_pmc_base; EXPORT_SYMBOL_GPL(at91_pmc_base); +void at91rm9200_idle(void) +{ + /* + * Disable the processor clock. The processor will be automatically + * re-enabled by an interrupt or by a reset. + */ + at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); +} + void at91sam9_idle(void) { at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); From 42dfd1e10c9a50146656c32da667f1a7ff280325 Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Tue, 20 Jan 2015 11:38:02 +0100 Subject: [PATCH 38/46] ARM: at91: fix Kconfig.debug by adding DEBUG_AT91_UART option The DEBUG_AT91_UART Kconfig option was forgotten when moving the AT91 debug-macro.S file. Add it and use it for the at91.S compilation. Reported-by: Paul Bolle Signed-off-by: Nicolas Ferre --- arch/arm/Kconfig.debug | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index e34d24949c6a..3092052bb285 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -117,16 +117,19 @@ choice config AT91_DEBUG_LL_DBGU0 bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10, 9rl, 9x5, 9n12" select DEBUG_AT91_UART + depends on ARCH_AT91 depends on HAVE_AT91_DBGU0 config AT91_DEBUG_LL_DBGU1 bool "Kernel low-level debugging on 9263, 9g45 and sama5d3" select DEBUG_AT91_UART + depends on ARCH_AT91 depends on HAVE_AT91_DBGU1 config AT91_DEBUG_LL_DBGU2 bool "Kernel low-level debugging on sama5d4" select DEBUG_AT91_UART + depends on ARCH_AT91 depends on HAVE_AT91_DBGU2 config DEBUG_BCM2835 @@ -1112,6 +1115,10 @@ choice endchoice +config DEBUG_AT91_UART + bool + depends on ARCH_AT91 + config DEBUG_EXYNOS_UART bool @@ -1168,8 +1175,7 @@ config DEBUG_LL_INCLUDE string default "debug/sa1100.S" if DEBUG_SA1100 default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250 - default "debug/at91.S" if AT91_DEBUG_LL_DBGU0 || AT91_DEBUG_LL_DBGU1 || \ - AT91_DEBUG_LL_DBGU2 + default "debug/at91.S" if DEBUG_AT91_UART default "debug/asm9260.S" if DEBUG_ASM9260_UART default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || DEBUG_CLPS711X_UART2 default "debug/meson.S" if DEBUG_MESON_UARTAO From bf02280e435cb620b255bb03738ac334cb7233dd Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Thu, 22 Jan 2015 16:54:50 +0100 Subject: [PATCH 39/46] ARM: at91: fix PM initialization for newer SoCs Newer SoCs: at91sam9x5, at91sam9n12, sama5d3 and sama5d4 embed a DDR controller and have a different PMC status register layout than the at91sam9g45. Create another at91_sam9x5_pm_init() function to match this compatibility. Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/board-dt-sam9.c | 20 ++++++++++++++++++++ arch/arm/mach-at91/board-dt-sama5.c | 2 +- arch/arm/mach-at91/generic.h | 2 ++ arch/arm/mach-at91/pm.c | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c index 0fe1ced608c5..c8252ddac6f0 100644 --- a/arch/arm/mach-at91/board-dt-sam9.c +++ b/arch/arm/mach-at91/board-dt-sam9.c @@ -61,3 +61,23 @@ DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") .init_machine = sam9g45_dt_device_init, .dt_compat = at91_9g45_board_compat, MACHINE_END + +static void __init sam9x5_dt_device_init(void) +{ + at91_sam9x5_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + +static const char *at91_9x5_board_compat[] __initconst = { + "atmel,at91sam9x5", + "atmel,at91sam9n12", + NULL +}; + +DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9") + /* Maintainer: Atmel */ + .map_io = at91_map_io, + .init_early = at91_dt_initialize, + .init_machine = sam9x5_dt_device_init, + .dt_compat = at91_9x5_board_compat, +MACHINE_END diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c index 44d372a22a29..b7338966c8ab 100644 --- a/arch/arm/mach-at91/board-dt-sama5.c +++ b/arch/arm/mach-at91/board-dt-sama5.c @@ -28,7 +28,7 @@ static void __init sama5_dt_device_init(void) { - at91_sam9260_pm_init(); + at91_sam9x5_pm_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 44fc725edcf1..a8ee83ef6cd4 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -36,10 +36,12 @@ extern void at91_ioremap_matrix(u32 base_addr); extern void __init at91_rm9200_pm_init(void); extern void __init at91_sam9260_pm_init(void); extern void __init at91_sam9g45_pm_init(void); +extern void __init at91_sam9x5_pm_init(void); #else void __init at91_rm9200_pm_init(void) { } void __init at91_sam9260_pm_init(void) { } void __init at91_sam9g45_pm_init(void) { } +void __init at91_sam9x5_pm_init(void) { } #endif #endif /* _AT91_GENERIC_H */ diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 81f2f12d3cc1..87c1fd8aa1b6 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -306,3 +306,10 @@ void __init at91_sam9g45_pm_init(void) at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; return at91_pm_init(); } + +void __init at91_sam9x5_pm_init(void) +{ + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + return at91_pm_init(); +} From 37e9c4d947dedd74d6ce1488a3baac42349b7323 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 22 Jan 2015 17:19:04 +0100 Subject: [PATCH 40/46] ARM: at91: mark const init data with __initconst instead of __initdata As long as there is no other non-const variable marked __initdata in the same compilation unit it doesn't hurt. If there were one however compilation would fail with error: $variablename causes a section type conflict because a section containing const variables is marked read only and so cannot contain non-const variables. Signed-off-by: Alexandre Belloni [nicolas.ferre@atmel.com: update the paths after having re-arranged the patches] Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/board-dt-rm9200.c | 2 +- arch/arm/mach-at91/board-dt-sam9.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c index 5f82a65153e1..0455c96d32b1 100644 --- a/arch/arm/mach-at91/board-dt-rm9200.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c @@ -40,7 +40,7 @@ static void __init rm9200_dt_device_init(void) -static const char *at91rm9200_dt_board_compat[] __initdata = { +static const char *at91rm9200_dt_board_compat[] __initconst = { "atmel,at91rm9200", NULL }; diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c index c8252ddac6f0..a648d090d74a 100644 --- a/arch/arm/mach-at91/board-dt-sam9.c +++ b/arch/arm/mach-at91/board-dt-sam9.c @@ -30,7 +30,7 @@ static void __init sam9_dt_device_init(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } -static const char *at91_dt_board_compat[] __initdata = { +static const char *at91_dt_board_compat[] __initconst = { "atmel,at91sam9", NULL }; From 4fe604c8b3657c63354fef196509c1596058d9f2 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 22:58:07 +0100 Subject: [PATCH 41/46] ARM: at91: fix sam9n12 and sam9x5 arm_pm_idle sam9n12 and sam9x5 don't set arm_pm_idle because of an oversight, fix that. Signed-off-by: Alexandre Belloni Suggested-by: Arnd Bergmann Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/at91sam9n12.c | 5 +++++ arch/arm/mach-at91/at91sam9x5.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index b5ea69a3eaf6..276b8f0e4183 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c @@ -15,6 +15,11 @@ /* -------------------------------------------------------------------- * AT91SAM9N12 processor initialization * -------------------------------------------------------------------- */ +static void __init at91sam9n12_initialize(void) +{ + arm_pm_idle = at91sam9_idle; +} AT91_SOC_START(at91sam9n12) + .init = at91sam9n12_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index 7b60a529db01..7b6fb1bca505 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c @@ -16,5 +16,11 @@ * AT91SAM9x5 processor initialization * -------------------------------------------------------------------- */ +static void __init at91sam9x5_initialize(void) +{ + arm_pm_idle = at91sam9_idle; +} + AT91_SOC_START(at91sam9x5) + .init = at91sam9x5_initialize, AT91_SOC_END From b9f122cc63ef7f30919b628bee48ab31501e3408 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 22:58:08 +0100 Subject: [PATCH 42/46] ARM: at91: sam9: set arm_pm_idle from sam9_dt_device_init As all sam9 SoCs are setting arm_pm_idle to at91sam9_idle(), do it from sam9_dt_device_init(). Signed-off-by: Alexandre Belloni Suggested-by: Arnd Bergmann [nicolas.ferre@atmel.com: adapt patch to newer series] Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/at91sam9260.c | 6 ------ arch/arm/mach-at91/at91sam9261.c | 6 ------ arch/arm/mach-at91/at91sam9263.c | 6 ------ arch/arm/mach-at91/at91sam9g45.c | 5 ----- arch/arm/mach-at91/at91sam9n12.c | 5 ----- arch/arm/mach-at91/at91sam9rl.c | 6 ------ arch/arm/mach-at91/at91sam9x5.c | 6 ------ arch/arm/mach-at91/board-dt-sam9.c | 7 +++++++ 8 files changed, 7 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index ab9841c8b0d5..37b7ce4c6a3b 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c @@ -22,11 +22,5 @@ * AT91SAM9260 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9260_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} - AT91_SOC_START(at91sam9260) - .init = at91sam9260_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 2029096b93fa..aebbf76b6038 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -21,11 +21,5 @@ * AT91SAM9261 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9261_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} - AT91_SOC_START(at91sam9261) - .init = at91sam9261_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 1fe672a05513..dca29457d9cc 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c @@ -20,11 +20,5 @@ * AT91SAM9263 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9263_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} - AT91_SOC_START(at91sam9263) - .init = at91sam9263_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index d0493df40a13..4957a9ef748a 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c @@ -19,11 +19,6 @@ /* -------------------------------------------------------------------- * AT91SAM9G45 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9g45_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} AT91_SOC_START(at91sam9g45) - .init = at91sam9g45_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index 276b8f0e4183..b5ea69a3eaf6 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c @@ -15,11 +15,6 @@ /* -------------------------------------------------------------------- * AT91SAM9N12 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9n12_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} AT91_SOC_START(at91sam9n12) - .init = at91sam9n12_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index 33acae30bb0b..6cb40e4ec20f 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c @@ -21,11 +21,5 @@ * AT91SAM9RL processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9rl_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} - AT91_SOC_START(at91sam9rl) - .init = at91sam9rl_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index 7b6fb1bca505..7b60a529db01 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c @@ -16,11 +16,5 @@ * AT91SAM9x5 processor initialization * -------------------------------------------------------------------- */ -static void __init at91sam9x5_initialize(void) -{ - arm_pm_idle = at91sam9_idle; -} - AT91_SOC_START(at91sam9x5) - .init = at91sam9x5_initialize, AT91_SOC_END diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c index a648d090d74a..8391b9558c22 100644 --- a/arch/arm/mach-at91/board-dt-sam9.c +++ b/arch/arm/mach-at91/board-dt-sam9.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,9 @@ static void __init sam9_dt_device_init(void) { + arm_pm_idle = at91sam9_idle; at91_sam9260_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } @@ -45,7 +48,9 @@ MACHINE_END static void __init sam9g45_dt_device_init(void) { + arm_pm_idle = at91sam9_idle; at91_sam9g45_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } @@ -64,7 +69,9 @@ MACHINE_END static void __init sam9x5_dt_device_init(void) { + arm_pm_idle = at91sam9_idle; at91_sam9x5_pm_init(); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } From ea69f998499d556251d1e2843953cc4f85788464 Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Fri, 23 Jan 2015 11:47:37 +0100 Subject: [PATCH 43/46] ARM: at91: fix ordering of SRAM and PM initialization The PM initialization needs internal SRAM for allocating a gen_pool and use it to store its PM code. So we need to have of_platform_populate() before this code. Suggested-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/board-dt-rm9200.c | 4 ++-- arch/arm/mach-at91/board-dt-sam9.c | 12 ++++++------ arch/arm/mach-at91/board-dt-sama5.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c index 0455c96d32b1..d47c4433444d 100644 --- a/arch/arm/mach-at91/board-dt-rm9200.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c @@ -33,9 +33,9 @@ static void __init at91rm9200_dt_timer_init(void) static void __init rm9200_dt_device_init(void) { - at91_rm9200_pm_init(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + at91_rm9200_pm_init(); } diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/board-dt-sam9.c index 8391b9558c22..f5d922e57655 100644 --- a/arch/arm/mach-at91/board-dt-sam9.c +++ b/arch/arm/mach-at91/board-dt-sam9.c @@ -27,10 +27,10 @@ static void __init sam9_dt_device_init(void) { + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + arm_pm_idle = at91sam9_idle; at91_sam9260_pm_init(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *at91_dt_board_compat[] __initconst = { @@ -48,10 +48,10 @@ MACHINE_END static void __init sam9g45_dt_device_init(void) { + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + arm_pm_idle = at91sam9_idle; at91_sam9g45_pm_init(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *at91_9g45_board_compat[] __initconst = { @@ -69,10 +69,10 @@ MACHINE_END static void __init sam9x5_dt_device_init(void) { + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + arm_pm_idle = at91sam9_idle; at91_sam9x5_pm_init(); - - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } static const char *at91_9x5_board_compat[] __initconst = { diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c index b7338966c8ab..86cffcdef145 100644 --- a/arch/arm/mach-at91/board-dt-sama5.c +++ b/arch/arm/mach-at91/board-dt-sama5.c @@ -28,8 +28,8 @@ static void __init sama5_dt_device_init(void) { - at91_sam9x5_pm_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + at91_sam9x5_pm_init(); } static const char *sama5_dt_board_compat[] __initconst = { From ae57d0c6094773e222e2047ded87073c59c7ac25 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 22:58:11 +0100 Subject: [PATCH 44/46] ARM: at91: stop using HAVE_AT91_DBGUx In order to remove SOC_SAM9xxx options, stop using HAVE_AT91_DBGUx. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/Kconfig.debug | 6 +++--- arch/arm/mach-at91/Kconfig | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 3092052bb285..575db67a61d6 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -118,19 +118,19 @@ choice bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10, 9rl, 9x5, 9n12" select DEBUG_AT91_UART depends on ARCH_AT91 - depends on HAVE_AT91_DBGU0 + depends on SOC_AT91RM9200 || SOC_AT91SAM9 config AT91_DEBUG_LL_DBGU1 bool "Kernel low-level debugging on 9263, 9g45 and sama5d3" select DEBUG_AT91_UART depends on ARCH_AT91 - depends on HAVE_AT91_DBGU1 + depends on SOC_AT91SAM9 || SOC_SAMA5 config AT91_DEBUG_LL_DBGU2 bool "Kernel low-level debugging on sama5d4" select DEBUG_AT91_UART depends on ARCH_AT91 - depends on HAVE_AT91_DBGU2 + depends on SOC_SAMA5 config DEBUG_BCM2835 bool "Kernel low-level debugging on BCM2835 PL011 UART" diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index b7dcef50db23..c6956b863b9d 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -6,15 +6,6 @@ config HAVE_AT91_UTMI config HAVE_AT91_USB_CLK bool -config HAVE_AT91_DBGU0 - bool - -config HAVE_AT91_DBGU1 - bool - -config HAVE_AT91_DBGU2 - bool - config COMMON_CLK_AT91 bool select COMMON_CLK @@ -70,7 +61,6 @@ config SOC_SAMA5D3 bool "SAMA5D3 family" select SOC_SAMA5 select HAVE_FB_ATMEL - select HAVE_AT91_DBGU1 select HAVE_AT91_UTMI select HAVE_AT91_SMD select HAVE_AT91_USB_CLK @@ -81,7 +71,6 @@ config SOC_SAMA5D3 config SOC_SAMA5D4 bool "SAMA5D4 family" select SOC_SAMA5 - select HAVE_AT91_DBGU2 select CLKSRC_MMIO select CACHE_L2X0 select CACHE_PL310 @@ -101,12 +90,10 @@ config SOC_AT91RM9200 select COMMON_CLK_AT91 select CPU_ARM920T select GENERIC_CLOCKEVENTS - select HAVE_AT91_DBGU0 select HAVE_AT91_USB_CLK config SOC_AT91SAM9260 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" - select HAVE_AT91_DBGU0 select SOC_AT91SAM9 select HAVE_AT91_USB_CLK help @@ -115,7 +102,6 @@ config SOC_AT91SAM9260 config SOC_AT91SAM9261 bool "AT91SAM9261 or AT91SAM9G10" - select HAVE_AT91_DBGU0 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_USB_CLK @@ -124,21 +110,18 @@ config SOC_AT91SAM9261 config SOC_AT91SAM9263 bool "AT91SAM9263" - select HAVE_AT91_DBGU1 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_USB_CLK config SOC_AT91SAM9RL bool "AT91SAM9RL" - select HAVE_AT91_DBGU0 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_UTMI config SOC_AT91SAM9G45 bool "AT91SAM9G45 or AT91SAM9M10 families" - select HAVE_AT91_DBGU1 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_UTMI @@ -149,7 +132,6 @@ config SOC_AT91SAM9G45 config SOC_AT91SAM9X5 bool "AT91SAM9x5 family" - select HAVE_AT91_DBGU0 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_UTMI @@ -164,7 +146,6 @@ config SOC_AT91SAM9X5 config SOC_AT91SAM9N12 bool "AT91SAM9N12 family" - select HAVE_AT91_DBGU0 select HAVE_FB_ATMEL select SOC_AT91SAM9 select HAVE_AT91_USB_CLK From 3129437b313cba3cd88f42b88c58deefba291f13 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 22:58:06 +0100 Subject: [PATCH 45/46] ARM: at91: remove unused mach/system_rev.h mach/system_rev.h is not used, remove it. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/include/mach/system_rev.h | 27 -------------------- 1 file changed, 27 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/system_rev.h diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h deleted file mode 100644 index ef79a9aafc08..000000000000 --- a/arch/arm/mach-at91/include/mach/system_rev.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD - * - * Under GPLv2 only - */ - -#ifndef __ARCH_SYSTEM_REV_H__ -#define __ARCH_SYSTEM_REV_H__ - -#include - -/* - * board revision encoding - * mach specific - * the 16-31 bit are reserved for at91 generic information - * - * bit 31: - * 0 => nand 8 bit - * 1 => nand 16 bit - */ -#define BOARD_HAVE_NAND_16BIT (1 << 31) -static inline int board_have_nand_16bit(void) -{ - return (system_rev & BOARD_HAVE_NAND_16BIT) ? 1 : 0; -} - -#endif /* __ARCH_SYSTEM_REV_H__ */ From 9726b6892beeaa736610370429a23a481d1b133e Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 15 Jan 2015 22:58:12 +0100 Subject: [PATCH 46/46] ARM: at91: pm: remove warning to remove SOC_AT91SAM9263 usage The SOC_AT91SAM9263 is being removed, stop using it. Signed-off-by: Alexandre Belloni Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/pm_slowclock.S | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S index 20018779bae7..556151e85ec4 100644 --- a/arch/arm/mach-at91/pm_slowclock.S +++ b/arch/arm/mach-at91/pm_slowclock.S @@ -17,15 +17,6 @@ #include #include - -#ifdef CONFIG_SOC_AT91SAM9263 -/* - * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; - * handle those cases both here and in the Suspend-To-RAM support. - */ -#warning Assuming EB1 SDRAM controller is *NOT* used -#endif - /* * When SLOWDOWN_MASTER_CLOCK is defined we will also slow down the Master * clock during suspend by adjusting its prescalar and divisor.