Skip to contentSkip to conversation

SPEAr DT support updates

PATCH Superseded Viresh Kumar 2 participants 12 messages Mar 28, 2012 – Mar 29, 2012

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover SPEAr DT support updates

Hello,

This patchset updates DT support for SPEAr3xx and 6xx. It has following changes:
- updates DT support Mainly for SPEAr3xx family
- updates dma support for SPEAr6xx
- updates defconfig

It has dependency on following patchsets:
- ehci & ohci: http://www.spinics.net/lists/linux-usb/msg60362.html
- rtc: http://lkml.org/lkml/2012/3/26/96
- keyboard: http://www.spinics.net/lists/linux-input/msg19904.html

V2:
- Separate DT_MACHINE_INIT macros are defined per SoC.
- PATCH 1/7 was sent earlier as individual patch, and is now included in this patchset for completeness.
- clock support for ehci and ohci added
- plat data for UART PL011 removed as it is not required
- Minor issues fixed

Viresh Kumar (7):
SPEAr: Use CLKDEV_INIT for defining clk_lookups
SPEAr3xx: Add clock instance of usb hosts - ehci and ohci 0 and 1
SPEAr6xx: Add compilation support for dtbs using 'make dtbs'
SPEAr3xx: Replace printk() with pr_*()
ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture
SPEAr: Add PL080 DMA support for 3xx and 6xx
SPEAr: Update defconfigs

 Documentation/arm/SPEAr/overview.txt            |   13 +-
 Documentation/devicetree/bindings/arm/spear.txt |   18 ++
 arch/arm/Makefile                               |    6 +-
 arch/arm/boot/dts/spear300-evb.dts              |  183 +++++++++++
 arch/arm/boot/dts/spear300.dtsi                 |   74 +++++
 arch/arm/boot/dts/spear310-evb.dts              |  111 +++++++
 arch/arm/boot/dts/spear310.dtsi                 |   75 +++++
 arch/arm/boot/dts/spear320-evb.dts              |  112 +++++++
 arch/arm/boot/dts/spear320.dtsi                 |   92 ++++++
 arch/arm/boot/dts/spear3xx.dtsi                 |  153 ++++++++++
 arch/arm/boot/dts/spear600-evb.dts              |    4 +
 arch/arm/boot/dts/spear600.dtsi                 |    8 +
 arch/arm/configs/spear3xx_defconfig             |   52 +++-
 arch/arm/configs/spear6xx_defconfig             |   41 ++-
 arch/arm/mach-spear3xx/Kconfig                  |   40 +--
 arch/arm/mach-spear3xx/Makefile                 |   19 +-
 arch/arm/mach-spear3xx/Makefile.boot            |    4 +
 arch/arm/mach-spear3xx/clock.c                  |  208 +++++++------
 arch/arm/mach-spear3xx/include/mach/generic.h   |   52 ++--
 arch/arm/mach-spear3xx/include/mach/irqs.h      |    6 +-
 arch/arm/mach-spear3xx/include/mach/spear300.h  |    4 +-
 arch/arm/mach-spear3xx/include/mach/spear310.h  |    4 +-
 arch/arm/mach-spear3xx/include/mach/spear320.h  |    4 +-
 arch/arm/mach-spear3xx/spear300.c               |  284 +++++++++++++++--
 arch/arm/mach-spear3xx/spear300_evb.c           |   75 -----
 arch/arm/mach-spear3xx/spear310.c               |  324 ++++++++++++++++++--
 arch/arm/mach-spear3xx/spear310_evb.c           |   81 -----
 arch/arm/mach-spear3xx/spear320.c               |  323 ++++++++++++++++++--
 arch/arm/mach-spear3xx/spear320_evb.c           |   79 -----
 arch/arm/mach-spear3xx/spear3xx.c               |  157 +++++-----
 arch/arm/mach-spear6xx/Makefile.boot            |    2 +
 arch/arm/mach-spear6xx/clock.c                  |   80 ++---
 arch/arm/mach-spear6xx/spear6xx.c               |  372 ++++++++++++++++++++++-
 arch/arm/plat-spear/Kconfig                     |    5 +-
 arch/arm/plat-spear/Makefile                    |    4 +-
 arch/arm/plat-spear/include/plat/pl080.h        |   21 ++
 arch/arm/plat-spear/pl080.c                     |   79 +++++
 37 files changed, 2556 insertions(+), 613 deletions(-)
 create mode 100644 arch/arm/boot/dts/spear300-evb.dts
 create mode 100644 arch/arm/boot/dts/spear300.dtsi
 create mode 100644 arch/arm/boot/dts/spear310-evb.dts
 create mode 100644 arch/arm/boot/dts/spear310.dtsi
 create mode 100644 arch/arm/boot/dts/spear320-evb.dts
 create mode 100644 arch/arm/boot/dts/spear320.dtsi
 create mode 100644 arch/arm/boot/dts/spear3xx.dtsi
 delete mode 100644 arch/arm/mach-spear3xx/spear300_evb.c
 delete mode 100644 arch/arm/mach-spear3xx/spear310_evb.c
 delete mode 100644 arch/arm/mach-spear3xx/spear320_evb.c
 create mode 100644 arch/arm/plat-spear/include/plat/pl080.h
 create mode 100644 arch/arm/plat-spear/pl080.c
Signature · 1 line
1.7.10.rc2.10.gb47606
#1 lore raw

PATCH v2 1/7 SPEAr: Use CLKDEV_INIT for defining clk_lookups

---
 arch/arm/mach-spear3xx/clock.c |  111 ++++++++++++++++++++--------------------
 arch/arm/mach-spear6xx/clock.c |   80 ++++++++++++++---------------
 2 files changed, 96 insertions(+), 95 deletions(-)
arch/arm/mach-spear3xx/clock.c +56 -55
index 6c4841f..6b2cd9b 100644
@@ -11,6 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clkdev.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -652,85 +653,85 @@ static struct clk pwm_clk = {
 
 /* array of all spear 3xx clock lookups */
 static struct clk_lookup spear_clk_lookups[] = {
-	{ .con_id = "apb_pclk",		.clk = &dummy_apb_pclk},
+	CLKDEV_INIT(NULL, "apb_pclk", &dummy_apb_pclk),
 	/* root clks */
-	{ .con_id = "osc_32k_clk",	.clk = &osc_32k_clk},
-	{ .con_id = "osc_24m_clk",	.clk = &osc_24m_clk},
+	CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
+	CLKDEV_INIT(NULL, "osc_24m_clk", &osc_24m_clk),
 	/* clock derived from 32 KHz osc clk */
-	{ .dev_id = "rtc-spear",	.clk = &rtc_clk},
+	CLKDEV_INIT("rtc-spear", NULL, &rtc_clk),
 	/* clock derived from 24 MHz osc clk */
-	{ .con_id = "pll1_clk",		.clk = &pll1_clk},
-	{ .con_id = "pll3_48m_clk",	.clk = &pll3_48m_clk},
-	{ .dev_id = "wdt",		.clk = &wdt_clk},
+	CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
+	CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
+	CLKDEV_INIT("wdt", NULL, &wdt_clk),
 	/* clock derived from pll1 clk */
-	{ .con_id = "cpu_clk",		.clk = &cpu_clk},
-	{ .con_id = "ahb_clk",		.clk = &ahb_clk},
-	{ .con_id = "uart_synth_clk",	.clk = &uart_synth_clk},
-	{ .con_id = "firda_synth_clk",	.clk = &firda_synth_clk},
-	{ .con_id = "gpt0_synth_clk",	.clk = &gpt0_synth_clk},
-	{ .con_id = "gpt1_synth_clk",	.clk = &gpt1_synth_clk},
-	{ .con_id = "gpt2_synth_clk",	.clk = &gpt2_synth_clk},
-	{ .dev_id = "uart",		.clk = &uart_clk},
-	{ .dev_id = "firda",		.clk = &firda_clk},
-	{ .dev_id = "gpt0",		.clk = &gpt0_clk},
-	{ .dev_id = "gpt1",		.clk = &gpt1_clk},
-	{ .dev_id = "gpt2",		.clk = &gpt2_clk},
+	CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
+	CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
+	CLKDEV_INIT(NULL, "uart_synth_clk", &uart_synth_clk),
+	CLKDEV_INIT(NULL, "firda_synth_clk", &firda_synth_clk),
+	CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
+	CLKDEV_INIT(NULL, "gpt1_synth_clk", &gpt1_synth_clk),
+	CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
+	CLKDEV_INIT("uart", NULL, &uart_clk),
+	CLKDEV_INIT("firda", NULL, &firda_clk),
+	CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
+	CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
+	CLKDEV_INIT("gpt2", NULL, &gpt2_clk),
 	/* clock derived from pll3 clk */
-	{ .dev_id = "designware_udc",   .clk = &usbd_clk},
-	{ .con_id = "usbh_clk",		.clk = &usbh_clk},
+	CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
+	CLKDEV_INIT(NULL, "usbh_clk", &usbh_clk),
 	/* clock derived from ahb clk */
-	{ .con_id = "apb_clk",		.clk = &apb_clk},
-	{ .dev_id = "i2c_designware.0",	.clk = &i2c_clk},
-	{ .dev_id = "dma",		.clk = &dma_clk},
-	{ .dev_id = "jpeg",		.clk = &jpeg_clk},
-	{ .dev_id = "gmac",		.clk = &gmac_clk},
-	{ .dev_id = "smi",		.clk = &smi_clk},
-	{ .dev_id = "c3",		.clk = &c3_clk},
+	CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
+	CLKDEV_INIT("i2c_designware.0", NULL, &i2c_clk),
+	CLKDEV_INIT("dma", NULL, &dma_clk),
+	CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
+	CLKDEV_INIT("gmac", NULL, &gmac_clk),
+	CLKDEV_INIT("smi", NULL, &smi_clk),
+	CLKDEV_INIT("c3", NULL, &c3_clk),
 	/* clock derived from apb clk */
-	{ .dev_id = "adc",		.clk = &adc_clk},
-	{ .dev_id = "ssp-pl022.0",	.clk = &ssp0_clk},
-	{ .dev_id = "gpio",		.clk = &gpio_clk},
+	CLKDEV_INIT("adc", NULL, &adc_clk),
+	CLKDEV_INIT("ssp-pl022.0", NULL, &ssp0_clk),
+	CLKDEV_INIT("gpio", NULL, &gpio_clk),
 };
 
 /* array of all spear 300 clock lookups */
 #ifdef CONFIG_MACH_SPEAR300
 static struct clk_lookup spear300_clk_lookups[] = {
-	{ .dev_id = "clcd",		.clk = &clcd_clk},
-	{ .con_id = "fsmc",		.clk = &fsmc_clk},
-	{ .dev_id = "gpio1",		.clk = &gpio1_clk},
-	{ .dev_id = "keyboard",		.clk = &kbd_clk},
-	{ .dev_id = "sdhci",		.clk = &sdhci_clk},
+	CLKDEV_INIT("clcd", NULL, &clcd_clk),
+	CLKDEV_INIT("fsmc", NULL, &fsmc_clk),
+	CLKDEV_INIT("gpio1", NULL, &gpio1_clk),
+	CLKDEV_INIT("keyboard", NULL, &kbd_clk),
+	CLKDEV_INIT("sdhci", NULL, &sdhci_clk),
 };
 #endif
 
 /* array of all spear 310 clock lookups */
 #ifdef CONFIG_MACH_SPEAR310
 static struct clk_lookup spear310_clk_lookups[] = {
-	{ .con_id = "fsmc",		.clk = &fsmc_clk},
-	{ .con_id = "emi",		.clk = &emi_clk},
-	{ .dev_id = "uart1",		.clk = &uart1_clk},
-	{ .dev_id = "uart2",		.clk = &uart2_clk},
-	{ .dev_id = "uart3",		.clk = &uart3_clk},
-	{ .dev_id = "uart4",		.clk = &uart4_clk},
-	{ .dev_id = "uart5",		.clk = &uart5_clk},
+	CLKDEV_INIT("fsmc", NULL, &fsmc_clk),
+	CLKDEV_INIT(NULL, "emi", &emi_clk),
+	CLKDEV_INIT("uart1", NULL, &uart1_clk),
+	CLKDEV_INIT("uart2", NULL, &uart2_clk),
+	CLKDEV_INIT("uart3", NULL, &uart3_clk),
+	CLKDEV_INIT("uart4", NULL, &uart4_clk),
+	CLKDEV_INIT("uart5", NULL, &uart5_clk),
 };
 #endif
 
 /* array of all spear 320 clock lookups */
 #ifdef CONFIG_MACH_SPEAR320
 static struct clk_lookup spear320_clk_lookups[] = {
-	{ .dev_id = "clcd",		.clk = &clcd_clk},
-	{ .con_id = "fsmc",		.clk = &fsmc_clk},
-	{ .dev_id = "i2c_designware.1",	.clk = &i2c1_clk},
-	{ .con_id = "emi",		.clk = &emi_clk},
-	{ .dev_id = "pwm",		.clk = &pwm_clk},
-	{ .dev_id = "sdhci",		.clk = &sdhci_clk},
-	{ .dev_id = "c_can_platform.0",	.clk = &can0_clk},
-	{ .dev_id = "c_can_platform.1",	.clk = &can1_clk},
-	{ .dev_id = "ssp-pl022.1",	.clk = &ssp1_clk},
-	{ .dev_id = "ssp-pl022.2",	.clk = &ssp2_clk},
-	{ .dev_id = "uart1",		.clk = &uart1_clk},
-	{ .dev_id = "uart2",		.clk = &uart2_clk},
+	CLKDEV_INIT("clcd", NULL, &clcd_clk),
+	CLKDEV_INIT("fsmc", NULL, &fsmc_clk),
+	CLKDEV_INIT("i2c_designware.1", NULL, &i2c1_clk),
+	CLKDEV_INIT(NULL, "emi", &emi_clk),
+	CLKDEV_INIT("pwm", NULL, &pwm_clk),
+	CLKDEV_INIT("sdhci", NULL, &sdhci_clk),
+	CLKDEV_INIT("c_can_platform.0", NULL, &can0_clk),
+	CLKDEV_INIT("c_can_platform.1", NULL, &can1_clk),
+	CLKDEV_INIT("ssp-pl022.1", NULL, &ssp1_clk),
+	CLKDEV_INIT("ssp-pl022.2", NULL, &ssp2_clk),
+	CLKDEV_INIT("uart1", NULL, &uart1_clk),
+	CLKDEV_INIT("uart2", NULL, &uart2_clk),
 };
 #endif
 
arch/arm/mach-spear6xx/clock.c +40 -40

93 lines not on this page · raw message

Signature · 1 line
1.7.10.rc2.10.gb47606
#2 lore raw

PATCH v2 2/7 SPEAr3xx: Add clock instance of usb hosts - ehci and ohci 0 and 1

In reply to Viresh Kumar

This patch adds following clocks: "usbh.0_clk" and "usbh.1_clk". They are used by ehci and ohci drivers for SPEAr3xx usb host devices.

---
 arch/arm/mach-spear3xx/clock.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/mach-spear3xx/clock.c +18 -0
index 6b2cd9b..47d4535 100644
@@ -412,6 +412,21 @@ static struct clk usbd_clk = {
 	.recalc = &follow_parent,
 };
 
+/* clock derived from usbh clk */
+/* usbh0 clock */
+static struct clk usbh0_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &usbh_clk,
+	.recalc = &follow_parent,
+};
+
+/* usbh1 clock */
+static struct clk usbh1_clk = {
+	.flags = ALWAYS_ENABLED,
+	.pclk = &usbh_clk,
+	.recalc = &follow_parent,
+};
+
 /* clock derived from ahb clk */
 /* apb masks structure */
 static struct bus_clk_masks apb_masks = {
@@ -679,6 +694,9 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from pll3 clk */
 	CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
 	CLKDEV_INIT(NULL, "usbh_clk", &usbh_clk),
+	/* clock derived from usbh clk */
+	CLKDEV_INIT(NULL, "usbh.0_clk", &usbh0_clk),
+	CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
 	/* clock derived from ahb clk */
 	CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
 	CLKDEV_INIT("i2c_designware.0", NULL, &i2c_clk),
Signature · 1 line
1.7.10.rc2.10.gb47606
#3 lore raw

PATCH v2 3/7 SPEAr6xx: Add compilation support for dtbs using 'make dtbs'

In reply to Viresh Kumar

'make dtbs' compiles all dtbs for a family. For this we need to add entries for all board dtb's in Makefile.boot file. This patch does it.

---
 arch/arm/mach-spear6xx/Makefile.boot |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-spear6xx/Makefile.boot +2 -0
index 4674a4c..af493da 100644
@@ -1,3 +1,5 @@
 zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_BOARD_SPEAR600_DT)	+= spear600-evb.dtb
Signature · 1 line
1.7.10.rc2.10.gb47606
#4 lore raw

PATCH v2 4/7 SPEAr3xx: Replace printk() with pr_*()

In reply to Viresh Kumar

For better print logs/messages, it is advisable to use pr_*() routines instead of directly calling printks. This patch removes direct calling of printks for spear3xx.

---
 arch/arm/mach-spear3xx/spear300.c |    8 +++++---
 arch/arm/mach-spear3xx/spear310.c |   13 +++++++------
 arch/arm/mach-spear3xx/spear320.c |   11 ++++++-----
 arch/arm/mach-spear3xx/spear3xx.c |    2 ++
 4 files changed, 20 insertions(+), 14 deletions(-)
arch/arm/mach-spear3xx/spear300.c +5 -3
index f7db668..adee72b 100644
@@ -11,6 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#define pr_fmt(fmt) "SPEAr300: " fmt
+
 #include <linux/types.h>
 #include <linux/amba/pl061.h>
 #include <linux/ptrace.h>
@@ -447,7 +449,7 @@ void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 	if (shirq_ras1.regs.base) {
 		ret = spear_shirq_register(&shirq_ras1);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ\n");
+			pr_err("Error registering Shared IRQ\n");
 	}
 
 	/* pmx initialization */
@@ -459,8 +461,8 @@ void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 	if (pmx_driver.base) {
 		ret = pmx_register(&pmx_driver);
 		if (ret)
-			printk(KERN_ERR "padmux: registration failed. err no"
-					": %d\n", ret);
+			pr_err("padmux: registration failed. err no: %d\n",
+					ret);
 		/* Free Mapping, device selection already done */
 		iounmap(pmx_driver.base);
 	}
arch/arm/mach-spear3xx/spear310.c +7 -6
index febaa6f..b7c2876 100644
@@ -11,6 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#define pr_fmt(fmt) "SPEAr310: " fmt
+
 #include <linux/ptrace.h>
 #include <asm/irq.h>
 #include <plat/shirq.h>
@@ -274,25 +276,25 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 		shirq_ras1.regs.base = base;
 		ret = spear_shirq_register(&shirq_ras1);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 1\n");
+			pr_err("Error registering Shared IRQ 1\n");
 
 		/* shirq 2 */
 		shirq_ras2.regs.base = base;
 		ret = spear_shirq_register(&shirq_ras2);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 2\n");
+			pr_err("Error registering Shared IRQ 2\n");
 
 		/* shirq 3 */
 		shirq_ras3.regs.base = base;
 		ret = spear_shirq_register(&shirq_ras3);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 3\n");
+			pr_err("Error registering Shared IRQ 3\n");
 
 		/* shirq 4 */
 		shirq_intrcomm_ras.regs.base = base;
 		ret = spear_shirq_register(&shirq_intrcomm_ras);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 4\n");
+			pr_err("Error registering Shared IRQ 4\n");
 	}
 
 	/* pmx initialization */
@@ -303,6 +305,5 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 
 	ret = pmx_register(&pmx_driver);
 	if (ret)
-		printk(KERN_ERR "padmux: registration failed. err no: %d\n",
-				ret);
+		pr_err("padmux: registration failed. err no: %d\n", ret);
 }
arch/arm/mach-spear3xx/spear320.c +6 -5
index deaaf19..7bd39c0 100644
@@ -11,6 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#define pr_fmt(fmt) "SPEAr320: " fmt
+
 #include <linux/ptrace.h>
 #include <asm/irq.h>
 #include <plat/shirq.h>
@@ -527,19 +529,19 @@ void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 		shirq_ras1.regs.base = base;
 		ret = spear_shirq_register(&shirq_ras1);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 1\n");
+			pr_err("Error registering Shared IRQ 1\n");
 
 		/* shirq 3 */
 		shirq_ras3.regs.base = base;
 		ret = spear_shirq_register(&shirq_ras3);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 3\n");
+			pr_err("Error registering Shared IRQ 3\n");
 
 		/* shirq 4 */
 		shirq_intrcomm_ras.regs.base = base;
 		ret = spear_shirq_register(&shirq_intrcomm_ras);
 		if (ret)
-			printk(KERN_ERR "Error registering Shared IRQ 4\n");
+			pr_err("Error registering Shared IRQ 4\n");
 	}
 
 	/* pmx initialization */
@@ -550,6 +552,5 @@ void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
 
 	ret = pmx_register(&pmx_driver);
 	if (ret)
-		printk(KERN_ERR "padmux: registration failed. err no: %d\n",
-				ret);
+		pr_err("padmux: registration failed. err no: %d\n", ret);
 }
arch/arm/mach-spear3xx/spear3xx.c +2 -0
index b1733c3..a236925 100644
@@ -11,6 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#define pr_fmt(fmt) "SPEAr3xx: " fmt
+
 #include <linux/types.h>
 #include <linux/amba/pl061.h>
 #include <linux/ptrace.h>
Signature · 1 line
1.7.10.rc2.10.gb47606
#5 lore raw

PATCH v2 5/7 ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture

In reply to Viresh Kumar

This patch adds a generic target for SPEAr3xx machines that can be configured via the device-tree. Currently the following devices are supported via the devicetree:

- VIC interrupts
- PL011 UART
- PL061 GPIO
- PL110 CLCD
- SP805 WDT
- Synopsys DW I2C
- Synopsys DW ethernet
- ST FSMC-NAND
- ST SPEAR-SMI
- ST SPEAR-KEYBOARD
- ST SPEAR-RTC
- ARASAN SDHCI-SPEAR
- SPEAR-EHCI
- SPEAR-OHCI

Other peripheral devices will follow in later patches.

---
 Documentation/arm/SPEAr/overview.txt            |   13 +-
 Documentation/devicetree/bindings/arm/spear.txt |   18 +++
 arch/arm/Makefile                               |    6 +-
 arch/arm/boot/dts/spear300-evb.dts              |  179 +++++++++++++++++++++++
 arch/arm/boot/dts/spear300.dtsi                 |   74 ++++++++++
 arch/arm/boot/dts/spear310-evb.dts              |  107 ++++++++++++++
 arch/arm/boot/dts/spear310.dtsi                 |   75 ++++++++++
 arch/arm/boot/dts/spear320-evb.dts              |  108 ++++++++++++++
 arch/arm/boot/dts/spear320.dtsi                 |   92 ++++++++++++
 arch/arm/boot/dts/spear3xx.dtsi                 |  145 ++++++++++++++++++
 arch/arm/mach-spear3xx/Kconfig                  |   40 ++---
 arch/arm/mach-spear3xx/Makefile                 |   19 +--
 arch/arm/mach-spear3xx/Makefile.boot            |    4 +
 arch/arm/mach-spear3xx/clock.c                  |  129 ++++++++--------
 arch/arm/mach-spear3xx/include/mach/generic.h   |   48 +++---
 arch/arm/mach-spear3xx/include/mach/irqs.h      |    6 +-
 arch/arm/mach-spear3xx/include/mach/spear300.h  |    4 +-
 arch/arm/mach-spear3xx/include/mach/spear310.h  |    4 +-
 arch/arm/mach-spear3xx/include/mach/spear320.h  |    4 +-
 arch/arm/mach-spear3xx/spear300.c               |   85 ++++++++---
 arch/arm/mach-spear3xx/spear300_evb.c           |   75 ----------
 arch/arm/mach-spear3xx/spear310.c               |  121 +++++++++++++--
 arch/arm/mach-spear3xx/spear310_evb.c           |   81 ----------
 arch/arm/mach-spear3xx/spear320.c               |  122 +++++++++++++--
 arch/arm/mach-spear3xx/spear320_evb.c           |   79 ----------
 arch/arm/mach-spear3xx/spear3xx.c               |  136 +++++++++--------
 arch/arm/plat-spear/Kconfig                     |    5 +-
 arch/arm/plat-spear/Makefile                    |    2 +-
 28 files changed, 1273 insertions(+), 508 deletions(-)
 create mode 100644 arch/arm/boot/dts/spear300-evb.dts
 create mode 100644 arch/arm/boot/dts/spear300.dtsi
 create mode 100644 arch/arm/boot/dts/spear310-evb.dts
 create mode 100644 arch/arm/boot/dts/spear310.dtsi
 create mode 100644 arch/arm/boot/dts/spear320-evb.dts
 create mode 100644 arch/arm/boot/dts/spear320.dtsi
 create mode 100644 arch/arm/boot/dts/spear3xx.dtsi
 delete mode 100644 arch/arm/mach-spear3xx/spear300_evb.c
 delete mode 100644 arch/arm/mach-spear3xx/spear310_evb.c
 delete mode 100644 arch/arm/mach-spear3xx/spear320_evb.c
Documentation/arm/SPEAr/overview.txt +7 -6
index 253a35c..28a9af9 100644
@@ -17,14 +17,14 @@ Introduction
   SPEAr (Platform)
 	- SPEAr3XX (3XX SOC series, based on ARM9)
 		- SPEAr300 (SOC)
-			- SPEAr300_EVB (Evaluation Board)
+			- SPEAr300 Evaluation Board
 		- SPEAr310 (SOC)
-			- SPEAr310_EVB (Evaluation Board)
+			- SPEAr310 Evaluation Board
 		- SPEAr320 (SOC)
-			- SPEAr320_EVB (Evaluation Board)
+			- SPEAr320 Evaluation Board
 	- SPEAr6XX (6XX SOC series, based on ARM9)
 		- SPEAr600 (SOC)
-			- SPEAr600_EVB (Evaluation Board)
+			- SPEAr600 Evaluation Board
 	- SPEAr13XX (13XX SOC series, based on ARM CORTEXA9)
 		- SPEAr1300 (SOC)
 
@@ -51,10 +51,11 @@ Introduction
   Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for
   spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine
   specific files, like spear300.c, spear310.c, spear320.c and spear600.c.
-  mach-spear* also contains board specific files for each machine type.
+  mach-spear* doesn't contains board specific files as they fully support
+  Flattened Device Tree.
 
 
   Document Author
   ---------------
 
-  Viresh Kumar, (c) 2010 ST Microelectronics
+  Viresh Kumar <[email protected]>, (c) 2010-2012 ST Microelectronics
Documentation/devicetree/bindings/arm/spear.txt +18 -0
index f8e54f0..aa5f355 100644
@@ -6,3 +6,21 @@ Boards with the ST SPEAr600 SoC shall have the following properties:
 Required root node property:
 
 compatible = "st,spear600";
+
+Boards with the ST SPEAr300 SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "st,spear300";
+
+Boards with the ST SPEAr310 SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "st,spear310";
+
+Boards with the ST SPEAr320 SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "st,spear320";
arch/arm/Makefile +3 -3
index 047a207..0f0acd9 100644
@@ -192,9 +192,9 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
 machine-$(CONFIG_ARCH_VT8500)		:= vt8500
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
-machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
-machine-$(CONFIG_MACH_SPEAR310)		:= spear3xx
-machine-$(CONFIG_MACH_SPEAR320)		:= spear3xx
+machine-$(CONFIG_MACH_SPEAR300_DT)	:= spear3xx
+machine-$(CONFIG_MACH_SPEAR310_DT)	:= spear3xx
+machine-$(CONFIG_MACH_SPEAR320_DT)	:= spear3xx
 machine-$(CONFIG_MACH_SPEAR600)		:= spear6xx
 machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
 
arch/arm/boot/dts/spear300-evb.dts new file +179 -0

179 lines not on this page · raw message

arch/arm/boot/dts/spear300.dtsi new file +74 -0

74 lines not on this page · raw message

arch/arm/boot/dts/spear310-evb.dts new file +107 -0

107 lines not on this page · raw message

arch/arm/boot/dts/spear310.dtsi new file +75 -0

75 lines not on this page · raw message

arch/arm/boot/dts/spear320-evb.dts new file +108 -0

108 lines not on this page · raw message

arch/arm/boot/dts/spear320.dtsi new file +92 -0

92 lines not on this page · raw message

arch/arm/boot/dts/spear3xx.dtsi new file +145 -0

145 lines not on this page · raw message

arch/arm/mach-spear3xx/Kconfig +10 -30
index 2cee6b0..2817b46 100644
@@ -2,42 +2,22 @@
 # SPEAr3XX Machine configuration file
 #
 
-if ARCH_SPEAR3XX
+if ARCH_SPEAR3XX_DT
 
 menu "SPEAr3xx Implementations"
-config BOARD_SPEAR300_EVB
-	bool "SPEAr300 Evaluation Board"
-	select MACH_SPEAR300
+config MACH_SPEAR300_DT
+	bool "SPEAr300 Machine support with Device Tree"
 	help
-	  Supports ST SPEAr300 Evaluation Board
+	  Supports ST SPEAr300 machine configured via the device-tree
 
-config BOARD_SPEAR310_EVB
-	bool "SPEAr310 Evaluation Board"
-	select MACH_SPEAR310
+config MACH_SPEAR310_DT
+	bool "SPEAr310 Machine support with Device Tree"
 	help
-	  Supports ST SPEAr310 Evaluation Board
+	  Supports ST SPEAr310 machine configured via the device-tree
 
-config BOARD_SPEAR320_EVB
-	bool "SPEAr320 Evaluation Board"
-	select MACH_SPEAR320
+config MACH_SPEAR320_DT
+	bool "SPEAr320 Machine support with Device Tree"
 	help
-	  Supports ST SPEAr320 Evaluation Board
-
+	  Supports ST SPEAr320 machine configured via the device-tree
 endmenu
-
-config MACH_SPEAR300
-	bool "SPEAr300"
-	help
-	  Supports ST SPEAr300 Machine
-
-config MACH_SPEAR310
-	bool "SPEAr310"
-	help
-	  Supports ST SPEAr310 Machine
-
-config MACH_SPEAR320
-	bool "SPEAr320"
-	help
-	  Supports ST SPEAr320 Machine
-
 endif #ARCH_SPEAR3XX
arch/arm/mach-spear3xx/Makefile +4 -15
index b248624..25526b6 100644
@@ -3,24 +3,13 @@
 #
 
 # common files
-obj-y	+= spear3xx.o clock.o
+obj-$(CONFIG_ARCH_SPEAR3XX_DT)	+= spear3xx.o clock.o
 
 # spear300 specific files
-obj-$(CONFIG_MACH_SPEAR300) += spear300.o
-
-# spear300 boards files
-obj-$(CONFIG_BOARD_SPEAR300_EVB) += spear300_evb.o
-
+obj-$(CONFIG_MACH_SPEAR300_DT) += spear300.o
 
 # spear310 specific files
-obj-$(CONFIG_MACH_SPEAR310) += spear310.o
-
-# spear310 boards files
-obj-$(CONFIG_BOARD_SPEAR310_EVB) += spear310_evb.o
-
+obj-$(CONFIG_MACH_SPEAR310_DT) += spear310.o
 
 # spear320 specific files
-obj-$(CONFIG_MACH_SPEAR320) += spear320.o
-
-# spear320 boards files
-obj-$(CONFIG_BOARD_SPEAR320_EVB) += spear320_evb.o
+obj-$(CONFIG_MACH_SPEAR320_DT) += spear320.o
arch/arm/mach-spear3xx/Makefile.boot +4 -0
index 4674a4c..fe371b7 100644
@@ -1,3 +1,7 @@
 zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_SPEAR300_DT)	+= spear300-evb.dtb
+dtb-$(CONFIG_MACH_SPEAR310_DT)	+= spear310-evb.dtb
+dtb-$(CONFIG_MACH_SPEAR320_DT)	+= spear320-evb.dtb
arch/arm/mach-spear3xx/clock.c +72 -57

233 lines not on this page · raw message

arch/arm/mach-spear3xx/include/mach/generic.h +20 -28

95 lines not on this page · raw message

arch/arm/mach-spear3xx/include/mach/irqs.h +3 -3
index 6e26544..90ed5ef 100644
@@ -129,9 +129,9 @@
  * Use the lowest number for the GPIO virtual IRQs base on which subarchs
  * we have compiled in
  */
-#if defined(CONFIG_MACH_SPEAR310)
+#if defined(CONFIG_MACH_SPEAR310_DT)
 #define SPEAR3XX_GPIO_INT_BASE			(SPEAR3XX_VIRQ_START + 18)
-#elif defined(CONFIG_MACH_SPEAR320)
+#elif defined(CONFIG_MACH_SPEAR320_DT)
 #define SPEAR3XX_GPIO_INT_BASE			(SPEAR3XX_VIRQ_START + 17)
 #else
 #define SPEAR3XX_GPIO_INT_BASE			(SPEAR3XX_VIRQ_START + 9)
@@ -140,7 +140,7 @@
 #define SPEAR300_GPIO1_INT_BASE			(SPEAR3XX_GPIO_INT_BASE + 8)
 #define SPEAR3XX_PLGPIO_COUNT	102
 
-#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
+#if defined(CONFIG_MACH_SPEAR310_DT) || defined(CONFIG_MACH_SPEAR320_DT)
 #define SPEAR3XX_PLGPIO_INT_BASE		(SPEAR3XX_GPIO_INT_BASE + 8)
 #define SPEAR3XX_GPIO_INT_END			(SPEAR3XX_PLGPIO_INT_BASE + \
 							SPEAR3XX_PLGPIO_COUNT)
arch/arm/mach-spear3xx/include/mach/spear300.h +2 -2
index 3b6ea07..260794d 100644
@@ -11,7 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
-#ifdef	CONFIG_MACH_SPEAR300
+#ifdef	CONFIG_MACH_SPEAR300_DT
 
 #ifndef __MACH_SPEAR300_H
 #define __MACH_SPEAR300_H
@@ -51,4 +51,4 @@
 
 #endif /* __MACH_SPEAR300_H */
 
-#endif /* CONFIG_MACH_SPEAR300 */
+#endif /* CONFIG_MACH_SPEAR300_DT */
arch/arm/mach-spear3xx/include/mach/spear310.h +2 -2
index 1567d0da..bc9c06d 100644
@@ -11,7 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
-#ifdef	CONFIG_MACH_SPEAR310
+#ifdef	CONFIG_MACH_SPEAR310_DT
 
 #ifndef __MACH_SPEAR310_H
 #define __MACH_SPEAR310_H
@@ -55,4 +55,4 @@
 
 #endif /* __MACH_SPEAR310_H */
 
-#endif /* CONFIG_MACH_SPEAR310 */
+#endif /* CONFIG_MACH_SPEAR310_DT */
arch/arm/mach-spear3xx/include/mach/spear320.h +2 -2
index 8cfa83f..e6ac0da 100644
@@ -11,7 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
-#ifdef	CONFIG_MACH_SPEAR320
+#ifdef	CONFIG_MACH_SPEAR320_DT
 
 #ifndef __MACH_SPEAR320_H
 #define __MACH_SPEAR320_H
@@ -64,4 +64,4 @@
 
 #endif /* __MACH_SPEAR320_H */
 
-#endif /* CONFIG_MACH_SPEAR320 */
+#endif /* CONFIG_MACH_SPEAR300_DT */
arch/arm/mach-spear3xx/spear300.c +62 -23

118 lines not on this page · raw message

arch/arm/mach-spear3xx/spear300_evb.c deleted +0 -75

75 lines not on this page · raw message

arch/arm/mach-spear3xx/spear310.c +106 -15

152 lines not on this page · raw message

arch/arm/mach-spear3xx/spear310_evb.c deleted +0 -81

81 lines not on this page · raw message

arch/arm/mach-spear3xx/spear320.c +107 -15

153 lines not on this page · raw message

arch/arm/mach-spear3xx/spear320_evb.c deleted +0 -79

79 lines not on this page · raw message

arch/arm/mach-spear3xx/spear3xx.c +67 -69

168 lines not on this page · raw message

arch/arm/plat-spear/Kconfig +3 -2
index 1bb3dbc..a6ff4c8 100644
@@ -8,10 +8,11 @@ choice
 	prompt "ST SPEAr Family"
 	default ARCH_SPEAR3XX
 
-config ARCH_SPEAR3XX
-	bool "SPEAr3XX"
+config ARCH_SPEAR3XX_DT
+	bool "ST SPEAr3xx with Device Tree"
 	select ARM_VIC
 	select CPU_ARM926T
+	select USE_OF
 	help
 	  Supports for ARM's SPEAR3XX family
 
arch/arm/plat-spear/Makefile +1 -1
index e0f2e5b..4b906bb 100644
@@ -5,4 +5,4 @@
 # Common support
 obj-y	:= clock.o restart.o time.o
 
-obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
+obj-$(CONFIG_ARCH_SPEAR3XX_DT)	+= shirq.o padmux.o
Signature · 1 line
1.7.10.rc2.10.gb47606
#6 lore raw

PATCH v2 5/7 ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture

Quoted 19 lines · Viresh Kumar

This patch adds a generic target for SPEAr3xx machines that can be configured via the device-tree. Currently the following devices are supported via the devicetree:

- VIC interrupts
- PL011 UART
- PL061 GPIO
- PL110 CLCD
- SP805 WDT
- Synopsys DW I2C
- Synopsys DW ethernet
- ST FSMC-NAND
- ST SPEAR-SMI
- ST SPEAR-KEYBOARD
- ST SPEAR-RTC
- ARASAN SDHCI-SPEAR
- SPEAR-EHCI
- SPEAR-OHCI

Quoted 1 line

Other peripheral devices will follow in later patches.

Hi Viresh,

I found a few small issues here, nothing serious:

arch/arm/Makefile machine-$(CONFIG_ARCH_VEXPRESS) := vexpress · line 199

Quoted 12 lines
arch/arm/Makefile +3 -3
@@ -192,9 +192,9 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
 machine-$(CONFIG_ARCH_VT8500)		:= vt8500
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
-machine-$(CONFIG_MACH_SPEAR300)		:= spear3xx
-machine-$(CONFIG_MACH_SPEAR310)		:= spear3xx
-machine-$(CONFIG_MACH_SPEAR320)		:= spear3xx
+machine-$(CONFIG_MACH_SPEAR300_DT)	:= spear3xx
+machine-$(CONFIG_MACH_SPEAR310_DT)	:= spear3xx
+machine-$(CONFIG_MACH_SPEAR320_DT)	:= spear3xx
 machine-$(CONFIG_MACH_SPEAR600)		:= spear6xx
 machine-$(CONFIG_ARCH_ZYNQ)		:= zynq

Since you're actually removing the non-DT support, I don't see a point in renaming the config symbols. Your patch should become quite a bit smaller if you leave them the way they are now.

Quoted 5 lines
arch/arm/boot/dts/spear300.dtsi new file +5 -0
+/ {
+	ahb {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "simple-bus";

arch/arm/boot/dts/spear300.dtsi line 30

Quoted 10 lines
arch/arm/boot/dts/spear300.dtsi new file +10 -0
+		ranges = <0x60000000 0x60000000 0x50000000
+			  0xd0000000 0xd0000000 0x30000000>;
+
+		clcd at 60000000 {
+			compatible = "arm,clcd-pl110", "arm,primecell";
+			reg = <0x60000000 0x1000>;
+			interrupt-parent = <&vic>;
+			interrupts = <30>;
+			status = "disabled";
+		};

You can move the interrupt-parent property that points to vic into the root node to define vic as the default parent so you don't have to list it individually in all the nodes using it.

Quoted 14 lines
arch/arm/boot/dts/spear310-evb.dts new file +14 -0
+
+			serial at d0000000 {
+			       status = "okay";
+			};
+
+			serial at b2000000 {
+			       status = "okay";
+			};
+
+			serial at b2080000 {
+			       status = "okay";
+			};
+
+			serial at b2100000 {

arch/arm/boot/dts/spear310-evb.dts line 100

Quoted 10 lines
arch/arm/boot/dts/spear310-evb.dts new file +10 -0
+			       status = "okay";
+			};
+
+			serial at b2180000 {
+			       status = "okay";
+			};
+
+			serial at b2200000 {
+			       status = "okay";
+			};

Does spear310-evb really connect all seven serial ports?

arch/arm/mach-spear3xx/spear300.c static struct spear_shirq shirq_ras1 = { · line 447

Quoted 5 lines
arch/arm/mach-spear3xx/spear300.c +5 -0
+/* Add SPEAr300 auxdata to pass platform data */
+static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
+	SPEAR3XX_AUXDATA_LOOKUP,
+	{}
+};

I don't really like the use of macros in this way. Better copy the contents here, especially if you don't expect to add more stuff to that macro.

arch/arm/mach-spear3xx/spear300.c void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, · line 472

Quoted 10 lines
arch/arm/mach-spear3xx/spear300.c +9 -1
-/* spear300 routine
+	if (of_machine_is_compatible("st,spear300-evb")) {
+		/* pmx initialization */
+		pmx_driver.mode = &spear300_photo_frame_mode;
+		pmx_driver.devs = spear300_evb_pmx_devs;
+		pmx_driver.devs_count = ARRAY_SIZE(spear300_evb_pmx_devs);
+	} else {
+		pr_err("Invalid board\n");
+		return;
+	}

I would not report the board as invalid if it doesn't match your list. Just keep going here in the hope that the board does work with its device tree contents.

Quoted 15 lines
arch/arm/mach-spear3xx/spear3xx.c +15 -0
+
+/* Following will create static virtual/physical mappings */
+struct map_desc spear3xx_io_desc[] __initdata = {
+	{
+		.virtual	= VA_SPEAR3XX_ICM1_UART_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ML1_VIC_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = { · line 491

Quoted 10 lines
arch/arm/mach-spear3xx/spear3xx.c +10 -0
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ICM3_MISC_REG_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	},
+};

Note: there no real reason to just map 4K pages here, or to compute the virtual addresses using the IO_ADDRESS macro. Using larger mappings mean you have more efficient TLB lookup for any I/O windows that are located closely together.

I would actually write this something like

struct map_desc spear3xx_io_desc[] __initdata = {
	{
		.virtual = 0xf0000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
		.length	 = SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf1000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM4_BASE),
		.length  = 3 * SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf4000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_ML1_2_BASE),
		.length  = 2 * SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf6000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
		.length  = SZ_16M,
		.type	 = MT_DEVICE,
	},
};

This would cover almost all of your devices with just seven TLB entries, and ioremap can now find the right virtual addresses automatically.

Arnd

#7 lore raw

PATCH v2 5/7 ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture

On 3/28/2012 5:57 PM, Arnd Bergmann wrote:

Hi Arnd,

Thanks for reviewing. :)

All comments accepted.

Quoted 1 line

Does spear310-evb really connect all seven serial ports?

Yes, since it was an evaluation board, it contained all of them.

Quoted 20 lines
Quoted 20 lines

+/* Following will create static virtual/physical mappings */

Quoted 19 lines
arch/arm/mach-spear3xx/spear3xx.c +19 -0
+struct map_desc spear3xx_io_desc[] __initdata = {
+	{
+		.virtual	= VA_SPEAR3XX_ICM1_UART_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ML1_VIC_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	}, {
+		.virtual	= VA_SPEAR3XX_ICM3_MISC_REG_BASE,
+		.pfn		= __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
Quoted 8 lines
Quoted 4 lines

arch/arm/mach-spear3xx/spear3xx.c struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = { · line 491

Quoted 4 lines
arch/arm/mach-spear3xx/spear3xx.c +4 -0
+		.length		= SZ_4K,
+		.type		= MT_DEVICE
+	},
+};

Note: there no real reason to just map 4K pages here, or to compute the virtual addresses using the IO_ADDRESS macro. Using larger mappings mean you have more efficient TLB lookup for any I/O windows that are located closely together.

Agreed.

Quoted 25 lines

I would actually write this something like

struct map_desc spear3xx_io_desc[] __initdata = {
	{
		.virtual = 0xf0000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
		.length	 = SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf1000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM4_BASE),
		.length  = 3 * SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf4000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_ML1_2_BASE),
		.length  = 2 * SZ_16M,
		.type	 = MT_DEVICE,
	}, {
		.virtual = 0xf6000000,
		.pfn	 = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
		.length  = SZ_16M,
		.type	 = MT_DEVICE,
	},
};
Quoted 2 lines

This would cover almost all of your devices with just seven TLB entries, and ioremap can now find the right virtual addresses automatically.

But there are few concerns.
Firstly, i wasn't aware that ioremap will reuse these mappings. I believed that it will create new mappings and this is what i saw till 2-6.37. What will happen if iounmap is called?

Over that, board would not be using all the devices present in SoC. So, we don't really need to map everything. And so above wouldn't be valid there.

To avoid holes, that were created in my original mappings, i can pick your idea of dropping IO_ADDRESS() in .virtual field and use tightly aligned virtual address for all peripherals.

Like: UART - 4K - 0xf0000000 - 0xf0001000

      SPI - 4K -  0xf0001000 - 0xf0002000

      ...
Signature · 1 line
viresh
#8 lore raw

PATCH v2 5/7 ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture

Quoted 4 lines · Viresh Kumar

But there are few concerns.
Firstly, i wasn't aware that ioremap will reuse these mappings. I believed that it will create new mappings and this is what i saw till 2-6.37. What will happen if iounmap is called?

Yes, it was a fairly recent change. iounmap on one of these areas will do nothing.

Quoted 3 lines

Over that, board would not be using all the devices present in SoC. So, we don't really need to map everything. And so above wouldn't be valid there.

That should not really be a concern, you only waste a little bit of the vmalloc space that you gained recently when ioremap was changed. Nothing should ever be able to get to those pointers other than by calling ioremap, so it doesn't hurt to have them mapped, except for the very unlikely scenario that you get a wild pointer dereference in the kernel that would otherwise result in an oops.

Quoted 6 lines

To avoid holes, that were created in my original mappings, i can pick your idea of dropping IO_ADDRESS() in .virtual field and use tightly aligned virtual address for all peripherals.

Like: UART - 4K - 0xf0000000 - 0xf0001000

      SPI - 4K -  0xf0001000 - 0xf0002000

Well, if you use the 4k mappings here, you won't benefit from reduced TLB pressure through section maps, although you still get rid of IO_ADDRESS. I would not put any devices into the static mapping, other than those you need to access before mm_init() or when you can actually use the section mapping.

Arnd

#9 lore raw

PATCH v2 5/7 ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture

Quoted 6 lines · Arnd Bergmann

That should not really be a concern, you only waste a little bit of the vmalloc space that you gained recently when ioremap was changed. Nothing should ever be able to get to those pointers other than by calling ioremap, so it doesn't hurt to have them mapped, except for the very unlikely scenario that you get a wild pointer dereference in the kernel that would otherwise result in an oops.

Ok. I will create two 16M mappings for now:

PHYSICAL VIRTUAL
0xD0000000 - 0xD1000000 0xFD000000
0xFC000000 - 0xFD000000 0xFC000000

Signature · 1 line
viresh
#10 lore raw

PATCH v2 6/7 SPEAr: Add PL080 DMA support for 3xx and 6xx

In reply to Viresh Kumar

Both SPEAr3xx and SPEAr6xx families have one instance of ARM PL080 DMA controller. This patch adds in support for that.

---
 arch/arm/boot/dts/spear300-evb.dts            |    4 +
 arch/arm/boot/dts/spear310-evb.dts            |    4 +
 arch/arm/boot/dts/spear320-evb.dts            |    4 +
 arch/arm/boot/dts/spear3xx.dtsi               |    8 +
 arch/arm/boot/dts/spear600-evb.dts            |    4 +
 arch/arm/boot/dts/spear600.dtsi               |    8 +
 arch/arm/mach-spear3xx/clock.c                |    2 +-
 arch/arm/mach-spear3xx/include/mach/generic.h |    6 +-
 arch/arm/mach-spear3xx/spear300.c             |  191 +++++++++++++
 arch/arm/mach-spear3xx/spear310.c             |  190 +++++++++++++
 arch/arm/mach-spear3xx/spear320.c             |  190 +++++++++++++
 arch/arm/mach-spear3xx/spear3xx.c             |   19 ++
 arch/arm/mach-spear6xx/clock.c                |    2 +-
 arch/arm/mach-spear6xx/spear6xx.c             |  372 ++++++++++++++++++++++++-
 arch/arm/plat-spear/Makefile                  |    2 +-
 arch/arm/plat-spear/include/plat/pl080.h      |   21 ++
 arch/arm/plat-spear/pl080.c                   |   79 ++++++
 17 files changed, 1101 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/plat-spear/include/plat/pl080.h
 create mode 100644 arch/arm/plat-spear/pl080.c
arch/arm/boot/dts/spear300-evb.dts +4 -0
index f2ee991..eaecc29 100644
@@ -29,6 +29,10 @@
 			status = "okay";
 		};
 
+		dma at fc400000 {
+			status = "okay";
+		};
+
 		fsmc: flash at 94000000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear310-evb.dts +4 -0
index ec19d7b..c86af33 100644
@@ -25,6 +25,10 @@
 	};
 
 	ahb {
+		dma at fc400000 {
+			status = "okay";
+		};
+
 		fsmc: flash at 44000000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear320-evb.dts +4 -0
index 5681a97..d43de71 100644
@@ -29,6 +29,10 @@
 			status = "okay";
 		};
 
+		dma at fc400000 {
+			status = "okay";
+		};
+
 		fsmc: flash at 4c000000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear3xx.dtsi +8 -0
index a31e52e..c3f3c41 100644
@@ -38,6 +38,14 @@
 			#interrupt-cells = <1>;
 		};
 
+		dma at fc400000 {
+			compatible = "arm,pl080", "arm,primecell";
+			reg = <0xfc400000 0x1000>;
+			interrupt-parent = <&vic>;
+			interrupts = <8>;
+			status = "disabled";
+		};
+
 		gmac: eth at e0800000 {
 			compatible = "st,spear600-gmac";
 			reg = <0xe0800000 0x8000>;
arch/arm/boot/dts/spear600-evb.dts +4 -0
index 636292e..790a7a8 100644
@@ -24,6 +24,10 @@
 	};
 
 	ahb {
+		dma at fc400000 {
+			status = "okay";
+		};
+
 		gmac: ethernet at e0800000 {
 			phy-mode = "gmii";
 			status = "okay";
arch/arm/boot/dts/spear600.dtsi +8 -0
index ebe0885..d777e3a 100644
@@ -45,6 +45,14 @@
 			#interrupt-cells = <1>;
 		};
 
+		dma at fc400000 {
+			compatible = "arm,pl080", "arm,primecell";
+			reg = <0xfc400000 0x1000>;
+			interrupt-parent = <&vic1>;
+			interrupts = <10>;
+			status = "disabled";
+		};
+
 		gmac: ethernet at e0800000 {
 			compatible = "st,spear600-gmac";
 			reg = <0xe0800000 0x8000>;
arch/arm/mach-spear3xx/clock.c +1 -1
index 6833d08..4eaff9b 100644
@@ -701,7 +701,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from ahb clk */
 	CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
 	CLKDEV_INIT("d0180000.i2c", NULL, &i2c_clk),
-	CLKDEV_INIT("dma", NULL, &dma_clk),
+	CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
 	CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
 	CLKDEV_INIT("e0800000.eth", NULL, &gmac_clk),
 	CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
arch/arm/mach-spear3xx/include/mach/generic.h +5 -1
index 8af11da..153f68b 100644
@@ -14,6 +14,7 @@
 #ifndef __MACH_GENERIC_H
 #define __MACH_GENERIC_H
 
+#include <linux/amba/pl08x.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
@@ -33,11 +34,14 @@
 /* Add spear3xx family device structure declarations here */
 extern struct sys_timer spear3xx_timer;
 extern struct pl022_ssp_controller pl022_plat_data;
+extern struct pl08x_platform_data pl080_plat_data;
 
 /* SPEAr3xx auxdata to pass platform data */
 #define SPEAR3XX_AUXDATA_LOOKUP					\
 	OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, \
-			&pl022_plat_data)
+			&pl022_plat_data),			\
+	OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, \
+			&pl080_plat_data)
 
 /* Add spear3xx family function declarations here */
 void __init spear_setup_timer(void);
arch/arm/mach-spear3xx/spear300.c +191 -0

209 lines not on this page · raw message

arch/arm/mach-spear3xx/spear310.c +190 -0

202 lines not on this page · raw message

arch/arm/mach-spear3xx/spear320.c +190 -0

202 lines not on this page · raw message

arch/arm/mach-spear3xx/spear3xx.c +19 -0
index f074638..9585cec 100644
@@ -17,7 +17,9 @@
 #include <linux/amba/pl08x.h>
 #include <linux/of_irq.h>
 #include <linux/io.h>
+#include <asm/hardware/pl080.h>
 #include <asm/hardware/vic.h>
+#include <plat/pl080.h>
 #include <mach/generic.h>
 #include <mach/hardware.h>
 
@@ -465,6 +467,23 @@ struct pl022_ssp_controller pl022_plat_data = {
 	.num_chipselect = 2,
 };
 
+/* dmac device registration */
+struct pl08x_platform_data pl080_plat_data = {
+	.memcpy_channel = {
+		.bus_id = "memcpy",
+		.cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
+			PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
+			PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
+			PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
+			PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
+			PL080_CONTROL_PROT_SYS),
+	},
+	.lli_buses = PL08X_AHB1,
+	.mem_buses = PL08X_AHB1,
+	.get_signal = pl080_get_signal,
+	.put_signal = pl080_put_signal,
+};
+
 /* Following will create static virtual/physical mappings */
 struct map_desc spear3xx_io_desc[] __initdata = {
 	{
arch/arm/mach-spear6xx/clock.c +1 -1
index 5a46980..adadef2 100644
@@ -657,7 +657,7 @@ static struct clk_lookup spear_clk_lookups[] = {
 	/* clock derived from ahb clk */
 	CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
 	CLKDEV_INIT("d0200000.i2c", NULL, &i2c_clk),
-	CLKDEV_INIT("dma", NULL, &dma_clk),
+	CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
 	CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
 	CLKDEV_INIT("gmac", NULL, &gmac_clk),
 	CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
arch/arm/mach-spear6xx/spear6xx.c +371 -1

395 lines not on this page · raw message

arch/arm/plat-spear/Makefile +1 -1
index 4b906bb..cc87823 100644
@@ -3,6 +3,6 @@
 #
 
 # Common support
-obj-y	:= clock.o restart.o time.o
+obj-y	:= clock.o restart.o time.o pl080.o
 
 obj-$(CONFIG_ARCH_SPEAR3XX_DT)	+= shirq.o padmux.o
arch/arm/plat-spear/include/plat/pl080.h new file +21 -0
new file mode 100644
index 0000000..e14a3e4
@@ -0,0 +1,21 @@
+/*
+ * arch/arm/plat-spear/include/plat/pl080.h
+ *
+ * DMAC pl080 definitions for SPEAr platform
+ *
+ * Copyright (C) 2012 ST Microelectronics
+ * Viresh Kumar <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __PLAT_PL080_H
+#define __PLAT_PL080_H
+
+struct pl08x_dma_chan;
+int pl080_get_signal(struct pl08x_dma_chan *ch);
+void pl080_put_signal(struct pl08x_dma_chan *ch);
+
+#endif /* __PLAT_PL080_H */
arch/arm/plat-spear/pl080.c new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.7.10.rc2.10.gb47606
#11 lore raw

PATCH v2 7/7 SPEAr: Update defconfigs

In reply to Viresh Kumar

Recently device tree support is added for SPEAr3xx & SPEAr6xx and we must upgrade defconfig for that to get compiled. This patches does it.

There are few more rearrangements done in defconfig automatically, when i run make savedefconfig.

---
 arch/arm/configs/spear3xx_defconfig |   52 +++++++++++++++++++++++++++--------
 arch/arm/configs/spear6xx_defconfig |   41 +++++++++++++++++++++------
 2 files changed, 74 insertions(+), 19 deletions(-)
arch/arm/configs/spear3xx_defconfig +41 -11
index fea7e1f..1fba278 100644
@@ -2,33 +2,67 @@ CONFIG_EXPERIMENTAL=y
 CONFIG_SYSVIPC=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODVERSIONS=y
+CONFIG_PARTITION_ADVANCED=y
 CONFIG_PLAT_SPEAR=y
-CONFIG_BOARD_SPEAR300_EVB=y
-CONFIG_BOARD_SPEAR310_EVB=y
-CONFIG_BOARD_SPEAR320_EVB=y
+CONFIG_MACH_SPEAR300_DT=y
+CONFIG_MACH_SPEAR310_DT=y
+CONFIG_MACH_SPEAR320_DT=y
 CONFIG_BINFMT_MISC=y
+CONFIG_NET=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_MTD=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_FSMC=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=16384
+CONFIG_NETDEVICES=y
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+CONFIG_STMMAC_ETH=y
+# CONFIG_WLAN is not set
 CONFIG_INPUT_FF_MEMLESS=y
 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_SPEAR=y
 # CONFIG_INPUT_MOUSE is not set
+# CONFIG_LEGACY_PTYS is not set
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-# CONFIG_LEGACY_PTYS is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=8192
+CONFIG_I2C=y
+CONFIG_I2C_DESIGNWARE_PLATFORM=y
+CONFIG_SPI=y
+CONFIG_SPI_PL022=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_PL061=y
 # CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_ARM_SP805_WATCHDOG=y
+CONFIG_FB=y
+CONFIG_FB_ARMCLCD=y
 # CONFIG_HID_SUPPORT is not set
-# CONFIG_USB_SUPPORT is not set
+CONFIG_USB=y
+# CONFIG_USB_DEVICE_CLASS is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SPEAR=y
+CONFIG_RTC_CLASS=y
+CONFIG_DMADEVICES=y
+CONFIG_AMBA_PL08X=y
+CONFIG_DMATEST=m
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_SECURITY=y
@@ -39,8 +73,6 @@ CONFIG_MSDOS_FS=m
 CONFIG_VFAT_FS=m
 CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
 CONFIG_TMPFS=y
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="utf8"
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ASCII=m
@@ -48,6 +80,4 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_SPINLOCK=y
-CONFIG_DEBUG_SPINLOCK_SLEEP=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_CRC32 is not set
arch/arm/configs/spear6xx_defconfig +33 -8

76 lines not on this page · raw message

Signature · 1 line
1.7.10.rc2.10.gb47606