Skip to contentSkip to conversation

Assorted PXA3xx DT patches

PATCH Superseded Daniel Mack 5 participants 19 messages Jul 25, 2012 – Jul 26, 2012

Subsystems (8)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Assorted PXA3xx DT patches

This is a series of 7 patches that add basic support for booting PXA3xx boards from devicetrees. I'm able to mount a rootfs and use all irq/gpio based functions as well as the NAND, USB and RTC drivers.

There are some major pieces left to work on though:

- the pinctrl driver
- the pxafb driver
- the ssp/audio implementations

Is somebody working on any of these?

Let me know what you think.

Daniel Mack (7):
RTC: add DT bindings to pxa-rtc
MMC: pxa-mci: add DT bindings
MTD: pxa3xx-nand: add devicetree bindings
ARM: pxa: add devicetree code for irq handling
ARM: pxa3xx: skip default device initialization when booting via DT
ARM: pxa3xx: add generic DT machine code
ARM: pxa: add .dtsi files

 Documentation/devicetree/bindings/mmc/pxa-mmc.txt  |   24 ++++
 .../devicetree/bindings/mtd/pxa3xx-nand.txt        |   31 +++++
 Documentation/devicetree/bindings/rtc/pxa-rtc.txt  |   12 ++
 arch/arm/boot/dts/pxa2xx.dtsi                      |  132 ++++++++++++++++++++
 arch/arm/boot/dts/pxa3xx.dtsi                      |   26 ++++
 arch/arm/mach-pxa/Kconfig                          |   12 ++
 arch/arm/mach-pxa/Makefile                         |    3 +
 arch/arm/mach-pxa/irq.c                            |   73 +++++++++++
 arch/arm/mach-pxa/pxa-dt.c                         |   61 +++++++++
 arch/arm/mach-pxa/pxa3xx.c                         |   21 +++-
 drivers/mmc/host/pxamci.c                          |   50 ++++++++
 drivers/mtd/nand/pxa3xx_nand.c                     |   83 +++++++++---
 drivers/rtc/rtc-pxa.c                              |   11 ++
 13 files changed, 522 insertions(+), 17 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/pxa-mmc.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/pxa-rtc.txt
 create mode 100644 arch/arm/boot/dts/pxa2xx.dtsi
 create mode 100644 arch/arm/boot/dts/pxa3xx.dtsi
 create mode 100644 arch/arm/mach-pxa/pxa-dt.c
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/7 RTC: add DT bindings to pxa-rtc

This patch adds generic device tree bindings to the PXA RTC driver. Documentation for bindings were also added.

Cc Robert Jarzmik <[email protected]>
Cc Alessandro Zummo <[email protected]>
---
 Documentation/devicetree/bindings/rtc/pxa-rtc.txt |   12 ++++++++++++
 drivers/rtc/rtc-pxa.c                             |   11 +++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/pxa-rtc.txt
Documentation/devicetree/bindings/rtc/pxa-rtc.txt new file +12 -0
new file mode 100644
index 0000000..acba256
@@ -0,0 +1,12 @@
+* PXA RTC
+
+PXA specific RTC driver.
+
+Required properties:
+- compatible : Should be pxa-rtc
+
+Examples:
+
+rtc at 0 {
+    compatible = "mrvl,pxa-rtc";
+};
drivers/rtc/rtc-pxa.c +11 -0
index 0075c8f..50d062a 100644
@@ -27,6 +27,8 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <mach/hardware.h>
 
@@ -396,6 +398,14 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id pxa_rtc_dt_ids[] = {
+	{ .compatible = "mrvl,pxa-rtc" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, pxa_rtc_dt_ids);
+#endif
+
 #ifdef CONFIG_PM
 static int pxa_rtc_suspend(struct device *dev)
 {
@@ -425,6 +435,7 @@ static struct platform_driver pxa_rtc_driver = {
 	.remove		= __exit_p(pxa_rtc_remove),
 	.driver		= {
 		.name	= "pxa-rtc",
+		.of_match_table = of_match_ptr(pxa_rtc_dt_ids),
 #ifdef CONFIG_PM
 		.pm	= &pxa_rtc_pm_ops,
 #endif
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/7 RTC: add DT bindings to pxa-rtc

Documentation/devicetree/bindings/rtc/pxa-rtc.txt line 12

Quoted 12 lines · Daniel Mack
Documentation/devicetree/bindings/rtc/pxa-rtc.txt new file +12 -0
+* PXA RTC
+
+PXA specific RTC driver.
+
+Required properties:
+- compatible : Should be pxa-rtc
+
+Examples:
+
+rtc at 0 {
+    compatible = "mrvl,pxa-rtc";
+};

The description doesn't match the example here, I think you should change both to marvell,pxa-rtc.

Arnd

#3 lore raw

PATCH 1/7 RTC: add DT bindings to pxa-rtc

In reply to Daniel Mack

Hello.

Quoted 18 lines · Daniel Mack

This patch adds generic device tree bindings to the PXA RTC driver. Documentation for bindings were also added.

Cc Robert Jarzmik <[email protected]>
Cc Alessandro Zummo <[email protected]>
---
  Documentation/devicetree/bindings/rtc/pxa-rtc.txt |   12 ++++++++++++
  drivers/rtc/rtc-pxa.c                             |   11 +++++++++++
  2 files changed, 23 insertions(+)

create mode 100644 Documentation/devicetree/bindings/rtc/pxa-rtc.txt

Documentation/devicetree/bindings/rtc/pxa-rtc.txt new file +0 -0
new file mode 100644
index 0000000..acba256

Documentation/devicetree/bindings/rtc/pxa-rtc.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/rtc/pxa-rtc.txt new file +10 -0
@@ -0,0 +1,12 @@
+* PXA RTC
+
+PXA specific RTC driver.
+
+Required properties:
+- compatible : Should be pxa-rtc
+
+Examples:
+
+rtc at 0 {

Don't use the address postfix when the node doesn't have "reg" property.

Documentation/devicetree/bindings/rtc/pxa-rtc.txt line 12

Quoted 2 lines
Documentation/devicetree/bindings/rtc/pxa-rtc.txt new file +2 -0
+    compatible = "mrvl,pxa-rtc";
+};

WBR, Sergei

#4 lore raw

PATCH 2/7 MMC: pxa-mci: add DT bindings

In reply to Daniel Mack
Cc Nicolas Pitre <[email protected]>
Cc Chris Ball <[email protected]>
---
 Documentation/devicetree/bindings/mmc/pxa-mmc.txt |   24 ++++++++++
 drivers/mmc/host/pxamci.c                         |   50 +++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/pxa-mmc.txt
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +24 -0
new file mode 100644
index 0000000..8f0ea58
@@ -0,0 +1,24 @@
+* PXA MMC drivers
+
+Driver bindings for the PXA MCI (MMC/SDIO) interfaces
+
+Required properties:
+- compatible: Should be "mrvl,pxa-mmc".
+- reg: Should contain registers location and length
+- interrupts: Should contain the interrupt
+- vmmc-supply: A regulator for VMMC
+
+Optional properties:
+- mrvl,detect-delay-ms: sets the detection delay timeout in ms.
+- mrvl,gpio-card-detect: GPIO spec for the card detect pin
+- mrvl,gpio-card-readonly: GPIO spec for the card write protection pin
+- mrvl,gpio-power: GPIO spec for the card power enable pin
+
+Examples:
+
+mmc0: mmc at 41100000 {
+	compatible = "mrvl,pxa-mmc";
+	reg = <0x41100000 0x1000>;
+	interrupts = <23>;
+};
+
drivers/mmc/host/pxamci.c +50 -0

74 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 2/7 MMC: pxa-mci: add DT bindings

Hi Daniel,

Quoted 20 lines · Daniel Mack
Cc Nicolas Pitre <[email protected]>
Cc Chris Ball <[email protected]>
---
 Documentation/devicetree/bindings/mmc/pxa-mmc.txt |   24 ++++++++++
 drivers/mmc/host/pxamci.c                         |   50 +++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/pxa-mmc.txt
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +5 -0
new file mode 100644
index 0000000..8f0ea58
@@ -0,0 +1,24 @@
+* PXA MMC drivers
+
+Driver bindings for the PXA MCI (MMC/SDIO) interfaces
+
+Required properties:

Documentation/devicetree/bindings/mmc/pxa-mmc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +10 -0
+- compatible: Should be "mrvl,pxa-mmc".
+- reg: Should contain registers location and length
+- interrupts: Should contain the interrupt
+- vmmc-supply: A regulator for VMMC
+
+Optional properties:
+- mrvl,detect-delay-ms: sets the detection delay timeout in ms.
+- mrvl,gpio-card-detect: GPIO spec for the card detect pin
+- mrvl,gpio-card-readonly: GPIO spec for the card write protection pin
+- mrvl,gpio-power: GPIO spec for the card power enable pin

Please see Documentation/devicetree/bindings/mmc/mmc.txt. It looks like you should be using cd-gpios and wp-gpios, and you should refer to mmc.txt instead of specifying reg/interrupts, with:

This file documents differences between the core properties in mmc.txt and the properties used by the pxa-mmc driver.

I saw Arnd mention that we're moving from "mrvl," to "marvell,", but maybe that's not finalized yet. (And there are other drivers using mrvl, so it'll presumably involve a large renaming patch.)

Quoted 83 lines
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +8 -0
+Examples:
+
+mmc0: mmc at 41100000 {
+	compatible = "mrvl,pxa-mmc";
+	reg = <0x41100000 0x1000>;
+	interrupts = <23>;
+};
+
drivers/mmc/host/pxamci.c +49 -0
index cb2dc0e..39ddc00 100644
@@ -30,6 +30,9 @@
 #include <linux/regulator/consumer.h>
 #include <linux/gpio.h>
 #include <linux/gfp.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/of_device.h>
 
 #include <asm/sizes.h>
 
@@ -573,6 +576,48 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid)
 	return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id pxa_mmc_dt_ids[] = {
+        { .compatible = "mrvl,pxa-mmc" },
+        { }
+};
+
+MODULE_DEVICE_TABLE(of, pxa_mmc_dt_ids);
+
+static int __devinit pxamci_of_init(struct platform_device *pdev)
+{
+        struct device_node *np = pdev->dev.of_node;
+        struct pxamci_platform_data *pdata;
+        u32 tmp;
+
+        if (!np)
+                return 0;
+
+        pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+        if (!pdata)
+                return -ENOMEM;
+
+	pdata->gpio_card_detect =
+		of_get_named_gpio(np, "pxa-mmc,gpio-card-detect", 0);
+	pdata->gpio_card_ro =
+		of_get_named_gpio(np, "pxa-mmc,gpio-card-readonly", 0);
+	pdata->gpio_power =
+		of_get_named_gpio(np, "pxa-mmc,gpio-power", 0);
+
+	if (of_property_read_u32(np, "pxa-mmc,detect-delay-ms", &tmp) == 0)
+		pdata->detect_delay_ms = tmp;
+
+        pdev->dev.platform_data = pdata;
+
+        return 0;
+}
+#else
+static int __devinit pxamci_of_init(struct platform_device *pdev)
+{
+        return 0;
+}
+#endif
+
 static int pxamci_probe(struct platform_device *pdev)
 {
 	struct mmc_host *mmc;
@@ -580,6 +625,10 @@ static int pxamci_probe(struct platform_device *pdev)
 	struct resource *r, *dmarx, *dmatx;
 	int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1;
 
+	ret = pxamci_of_init(pdev);
+	if (ret)
+		return ret;
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
 	if (!r || irq < 0)

drivers/mmc/host/pxamci.c static struct platform_driver pxamci_driver = { · line 918

Quoted 4 lines
drivers/mmc/host/pxamci.c +1 -0
@@ -866,6 +915,7 @@ static struct platform_driver pxamci_driver = {
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(pxa_mmc_dt_ids),

Have you tried compiling without CONFIG_OF? This doesn't look to be inside #ifdef CONFIG_OF, which I think would cause a compile error.

drivers/mmc/host/pxamci.c static struct platform_driver pxamci_driver = { · line 921

Quoted 3 lines
drivers/mmc/host/pxamci.c +0 -0
 #ifdef CONFIG_PM
 		.pm	= &pxamci_pm_ops,
 #endif

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#6 lore raw

PATCH 2/7 MMC: pxa-mci: add DT bindings

Quoted 38 lines · Chris Ball

Hi Daniel,

Quoted 20 lines · Daniel Mack
Cc Nicolas Pitre <[email protected]>
Cc Chris Ball <[email protected]>
---
 Documentation/devicetree/bindings/mmc/pxa-mmc.txt |   24 ++++++++++
 drivers/mmc/host/pxamci.c                         |   50 +++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mmc/pxa-mmc.txt
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +5 -0
new file mode 100644
index 0000000..8f0ea58
@@ -0,0 +1,24 @@
+* PXA MMC drivers
+
+Driver bindings for the PXA MCI (MMC/SDIO) interfaces
+
+Required properties:

Documentation/devicetree/bindings/mmc/pxa-mmc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +10 -0
+- compatible: Should be "mrvl,pxa-mmc".
+- reg: Should contain registers location and length
+- interrupts: Should contain the interrupt
+- vmmc-supply: A regulator for VMMC
+
+Optional properties:
+- mrvl,detect-delay-ms: sets the detection delay timeout in ms.
+- mrvl,gpio-card-detect: GPIO spec for the card detect pin
+- mrvl,gpio-card-readonly: GPIO spec for the card write protection pin
+- mrvl,gpio-power: GPIO spec for the card power enable pin

Please see Documentation/devicetree/bindings/mmc/mmc.txt. It looks like you should be using cd-gpios and wp-gpios, and you should refer to mmc.txt instead of specifying reg/interrupts, with:

Quoted 2 lines

This file documents differences between the core properties in mmc.txt and the properties used by the pxa-mmc driver.

Ok, will do. Thanks for the review!

Quoted 3 lines

I saw Arnd mention that we're moving from "mrvl," to "marvell,", but maybe that's not finalized yet. (And there are other drivers using mrvl, so it'll presumably involve a large renaming patch.)

I have no strong opinion on that, really. But as this is a new driver, we can as well do it right in the first place.

[snip]

Quoted 8 lines

Documentation/devicetree/bindings/mmc/pxa-mmc.txt static struct platform_driver pxamci_driver = { · line 918

Quoted 5 lines
Documentation/devicetree/bindings/mmc/pxa-mmc.txt new file +1 -0
@@ -866,6 +915,7 @@ static struct platform_driver pxamci_driver = {
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(pxa_mmc_dt_ids),

Have you tried compiling without CONFIG_OF? This doesn't look to be inside #ifdef CONFIG_OF, which I think would cause a compile error.

of_match_ptr() validates to NULL for !CONFIG_OF. Quite nice :)

Daniel

#7 lore raw

PATCH 3/7 MTD: pxa3xx-nand: add devicetree bindings

In reply to Daniel Mack

This patch contains a hack to get the DMA resources of the device when probed from a devicetree node. This can be removed once a generic DMA controller framework lands.

A mtd_part_parser_data is passed mtd_device_parse_register which contains a reference to the device node, so MTD partitions can be added as children.

Cc David Woodhouse <[email protected]>
---
 .../devicetree/bindings/mtd/pxa3xx-nand.txt        |   31 ++++++++
 drivers/mtd/nand/pxa3xx_nand.c                     |   83 ++++++++++++++++----
 2 files changed, 100 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt
Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +31 -0
new file mode 100644
index 0000000..6e28cef
@@ -0,0 +1,31 @@
+PXA3xx NAND DT bindings
+
+Required properties:
+
+ - compatible:		Should be "mrvl,pxa3xx-nand"
+ - reg: 		The register base for the controller
+ - interrupts:		The interrupt to map
+ - #address-cells:	Set to <1> if the node includes partitions
+
+Optional properties:
+
+ - mrvl,nand-enable-arbiter:	Set to enable the bus arbiter
+ - mrvl,nand-keep-config:	Set to keep the NAND controller config as set
+				by the bootloader
+ - num-cs:			Number of chipselect lines to usw
+
+Example:
+
+	nand0: nand at 43100000 {
+		compatible = "mrvl,pxa3xx-nand";
+		reg = <0x43100000 90>;
+		interrupts = <45>;
+		#address-cells = <1>;
+		
+		mrvl,nand-enable-arbiter;
+		mrvl,nand-keep-config;
+		num-cs = <1>;
+
+		/* partitions (optional) */
+	};
+
drivers/mtd/nand/pxa3xx_nand.c +69 -14

122 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#8 lore raw

PATCH 3/7 MTD: pxa3xx-nand: add devicetree bindings

Dear Daniel Mack,

Quoted 34 lines

This patch contains a hack to get the DMA resources of the device when probed from a devicetree node. This can be removed once a generic DMA controller framework lands.

A mtd_part_parser_data is passed mtd_device_parse_register which contains a reference to the device node, so MTD partitions can be added as children.

Cc David Woodhouse <[email protected]>
---
 .../devicetree/bindings/mtd/pxa3xx-nand.txt        |   31 ++++++++
 drivers/mtd/nand/pxa3xx_nand.c                     |   83
++++++++++++++++---- 2 files changed, 100 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file mode 100644
index 0000000..6e28cef

Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +11 -0
@@ -0,0 +1,31 @@
+PXA3xx NAND DT bindings
+
+Required properties:
+
+ - compatible:		Should be "mrvl,pxa3xx-nand"
+ - reg: 		The register base for the controller
+ - interrupts:		The interrupt to map
+ - #address-cells:	Set to <1> if the node includes partitions
+
+Optional properties:
+

Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt line 21

Quoted 10 lines
Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +10 -0
+ - mrvl,nand-enable-arbiter:	Set to enable the bus arbiter
+ - mrvl,nand-keep-config:	Set to keep the NAND controller config as set
+				by the bootloader
+ - num-cs:			Number of chipselect lines to usw
+
+Example:
+
+	nand0: nand at 43100000 {
+		compatible = "mrvl,pxa3xx-nand";
+		reg = <0x43100000 90> ;

0x90 maybe?

Quoted 32 lines
Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +10 -0
+		interrupts = <45>;
+		#address-cells = <1>;
+
+		mrvl,nand-enable-arbiter;
+		mrvl,nand-keep-config;
+		num-cs = <1>;
+
+		/* partitions (optional) */
+	};
+
(quoted diff) +0 -0

b/drivers/mtd/nand/pxa3xx_nand.c index 252aaef..fb592a9 100644

drivers/mtd/nand/pxa3xx_nand.c +2 -5
@@ -22,6 +22,8 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <mach/dma.h>
 #include <plat/pxa3xx_nand.h>
@@ -1081,21 +1083,29 @@ static int alloc_nand_resource(struct
 platform_device *pdev) }
 	clk_enable(info->clk);
 
-	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-	if (r == NULL) {
-		dev_err(&pdev->dev, "no resource defined for data DMA\n");
-		ret = -ENXIO;
-		goto fail_put_clk;

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct · line 1093

Quoted 10 lines
drivers/mtd/nand/pxa3xx_nand.c +8 -2
-	}
-	info->drcmr_dat = r->start;
+	/*
+	 * This is a dirty hack to make this driver work from devicetree
+	 * bindings. It can be removed once we have a prober DMA controller
+	 * framework for DT.
+	 */
+	if (pdev->dev.of_node && cpu_is_pxa3xx()) {
+		info->drcmr_dat = 97;
+		info->drcmr_cmd = 99;

cpu_is_() stuff should begone ... besides, what are these numbers here?

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev)

Quoted 4 lines
drivers/mtd/nand/pxa3xx_nand.c +4 -0
+	} else {
+		r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+		if (r == NULL) {
+			dev_err(&pdev->dev, "no resource defined for data 

DMA\n");

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev)

Quoted 12 lines
drivers/mtd/nand/pxa3xx_nand.c +6 -5
+			ret = -ENXIO;
+			goto fail_put_clk;
+		}
 
-	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
-	if (r == NULL) {
-		dev_err(&pdev->dev, "no resource defined for command DMA\n");
-		ret = -ENXIO;
-		goto fail_put_clk;
+		r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+		if (r == NULL) {
+			dev_err(&pdev->dev, "no resource defined for command 

DMA\n");

Quoted 26 lines
drivers/mtd/nand/pxa3xx_nand.c +17 -1
+			ret = -ENXIO;
+			goto fail_put_clk;
+		}
 	}
-	info->drcmr_cmd = r->start;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
@@ -1200,12 +1210,55 @@ static int pxa3xx_nand_remove(struct
 platform_device *pdev) return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id pxa3xx_nand_dt_ids[] = {
+	{ .compatible = "mrvl,pxa3xx-nand" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
+
+static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
+{
+	struct pxa3xx_nand_platform_data *pdata;
+	struct device_node *np = pdev->dev.of_node;
+	const struct of_device_id *of_id =
+			of_match_device(pxa3xx_nand_dt_ids, &pdev->dev);
+

drivers/mtd/nand/pxa3xx_nand.c static int pxa3xx_nand_remove(struct · line 1236

Quoted 10 lines
drivers/mtd/nand/pxa3xx_nand.c +10 -0
+	if (!of_id)
+		return 0;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	if (of_get_property(np, "mrvl,nand-enable-arbiter", NULL))
+		pdata->enable_arbiter = 1;
+	if (of_get_property(np, "mrvl,nand-keep-config", NULL))

of_property_read_bool() please.

Quoted 47 lines
drivers/mtd/nand/pxa3xx_nand.c +22 -1
+		pdata->keep_config = 1;
+	of_property_read_u32(np, "num-cs", &pdata->num_cs);
+
+	pdev->dev.platform_data = pdata;
+
+	return 0;
+}
+#else
+static inline int pxa3xx_nand_probe_dt(struct platform_device *)
+{
+	return 0;
+}
+#endif
+
 static int pxa3xx_nand_probe(struct platform_device *pdev)
 {
 	struct pxa3xx_nand_platform_data *pdata;
+	struct mtd_part_parser_data ppdata = {};
 	struct pxa3xx_nand_info *info;
 	int ret, cs, probe_success;
 
+	ret = pxa3xx_nand_probe_dt(pdev);
+	if (ret)
+		return ret;
+
 	pdata = pdev->dev.platform_data;
 	if (!pdata) {
 		dev_err(&pdev->dev, "no platform data defined\n");
@@ -1229,8 +1282,9 @@ static int pxa3xx_nand_probe(struct platform_device
 *pdev) continue;
 		}
 
+		ppdata.of_node = pdev->dev.of_node;
 		ret = mtd_device_parse_register(info->host[cs]->mtd, NULL,
-						NULL, pdata->parts[cs],
+						&ppdata, pdata->parts[cs],
 						pdata->nr_parts[cs]);
 		if (!ret)
 			probe_success = 1;
@@ -1306,6 +1360,7 @@ static int pxa3xx_nand_resume(struct platform_device
 *pdev) static struct platform_driver pxa3xx_nand_driver = {
 	.driver = {
 		.name	= "pxa3xx-nand",
+		.of_match_table = of_match_ptr(pxa3xx_nand_dt_ids),
 	},
 	.probe		= pxa3xx_nand_probe,
 	.remove		= pxa3xx_nand_remove,
#9 lore raw

PATCH 3/7 MTD: pxa3xx-nand: add devicetree bindings

Quoted 16 lines · Marek Vasut
Quoted 5 lines
drivers/mtd/nand/pxa3xx_nand.c +0 -5
-     r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-     if (r == NULL) {
-             dev_err(&pdev->dev, "no resource defined for data DMA\n");
-             ret = -ENXIO;
-             goto fail_put_clk;

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev) · line 1093

Quoted 10 lines
drivers/mtd/nand/pxa3xx_nand.c +8 -2
-     }
-     info->drcmr_dat = r->start;
+     /*
+      * This is a dirty hack to make this driver work from devicetree
+      * bindings. It can be removed once we have a prober DMA controller
+      * framework for DT.
+      */
+     if (pdev->dev.of_node && cpu_is_pxa3xx()) {
+             info->drcmr_dat = 97;
+             info->drcmr_cmd = 99;
Quoted 1 line

cpu_is_() stuff should begone ... besides, what are these numbers here?

They are the numbers from the DMA resource. It's ugly but I think reasonable to do this here. We will clean it up soon, once the bindings are in place.

I did notice though the the two "info->drcmr_dat = r->start" assignments in the non-DT case are removed here. I think that's a bug.

Arnd

#10 lore raw

PATCH 3/7 MTD: pxa3xx-nand: add devicetree bindings

Quoted 17 lines · Arnd Bergmann
Quoted 16 lines · Marek Vasut
Quoted 15 lines
drivers/mtd/nand/pxa3xx_nand.c +8 -7
-     r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-     if (r == NULL) {
-             dev_err(&pdev->dev, "no resource defined for data DMA\n");
-             ret = -ENXIO;
-             goto fail_put_clk;
-     }
-     info->drcmr_dat = r->start;
+     /*
+      * This is a dirty hack to make this driver work from devicetree
+      * bindings. It can be removed once we have a prober DMA controller
+      * framework for DT.
+      */
+     if (pdev->dev.of_node && cpu_is_pxa3xx()) {
+             info->drcmr_dat = 97;
+             info->drcmr_cmd = 99;
Quoted 7 lines
Quoted 1 line

cpu_is_() stuff should begone ... besides, what are these numbers here?

They are the numbers from the DMA resource. It's ugly but I think reasonable to do this here. We will clean it up soon, once the bindings are in place.

I did notice though the the two "info->drcmr_dat = r->start" assignments in the non-DT case are removed here. I think that's a bug.

Eh, right you are. Fixed.

#11 lore raw

PATCH 3/7 MTD: pxa3xx-nand: add devicetree bindings

In reply to Marek Vasut
Quoted 9 lines · Marek Vasut
Quoted 8 lines

This patch contains a hack to get the DMA resources of the device when probed from a devicetree node. This can be removed once a generic DMA controller framework lands.

A mtd_part_parser_data is passed mtd_device_parse_register which contains a reference to the device node, so MTD partitions can be added as children.

Quoted 6 lines

Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt

Quoted 4 lines
Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +4 -0
+
+	nand0: nand at 43100000 {
+		compatible = "mrvl,pxa3xx-nand";
+		reg = <0x43100000 90> ;

0x90 maybe?

No, mach-pxa/devices.c has 0x53 which would be 83. I chose 90 because the register space up to 0x7c is unused. For some reason, lengths are more likely given in dec than in hex.

Quoted 37 lines
Quoted 37 lines
Documentation/devicetree/bindings/mtd/pxa3xx-nand.txt new file +10 -0
+		interrupts = <45>;
+		#address-cells = <1>;
+
+		mrvl,nand-enable-arbiter;
+		mrvl,nand-keep-config;
+		num-cs = <1>;
+
+		/* partitions (optional) */
+	};
+
(quoted diff) +0 -0

b/drivers/mtd/nand/pxa3xx_nand.c index 252aaef..fb592a9 100644

drivers/mtd/nand/pxa3xx_nand.c +4 -7
@@ -22,6 +22,8 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <mach/dma.h>
 #include <plat/pxa3xx_nand.h>
@@ -1081,21 +1083,29 @@ static int alloc_nand_resource(struct
 platform_device *pdev) }
 	clk_enable(info->clk);
 
-	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-	if (r == NULL) {
-		dev_err(&pdev->dev, "no resource defined for data DMA\n");
-		ret = -ENXIO;
-		goto fail_put_clk;
-	}
-	info->drcmr_dat = r->start;
+	/*
+	 * This is a dirty hack to make this driver work from devicetree
Quoted 8 lines

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev) · line 1093

Quoted 6 lines
drivers/mtd/nand/pxa3xx_nand.c +6 -0
+	 * bindings. It can be removed once we have a prober DMA controller
+	 * framework for DT.
+	 */
+	if (pdev->dev.of_node && cpu_is_pxa3xx()) {
+		info->drcmr_dat = 97;
+		info->drcmr_cmd = 99;

cpu_is_() stuff should begone ... besides, what are these numbers here?

Hmm? Did you read the comment above this block and in the commit log? The problem is that there is no generic DMA controller implementation for DT, so we have to live with such hacks until this changes.

Daniel

Quoted 105 lines

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev)

Quoted 5 lines
drivers/mtd/nand/pxa3xx_nand.c +4 -0
+	} else {
+		r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+		if (r == NULL) {
+			dev_err(&pdev->dev, "no resource defined for data 

DMA\n");

drivers/mtd/nand/pxa3xx_nand.c static int alloc_nand_resource(struct platform_device *pdev)

Quoted 12 lines
drivers/mtd/nand/pxa3xx_nand.c +6 -5
+			ret = -ENXIO;
+			goto fail_put_clk;
+		}
 
-	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
-	if (r == NULL) {
-		dev_err(&pdev->dev, "no resource defined for command DMA\n");
-		ret = -ENXIO;
-		goto fail_put_clk;
+		r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+		if (r == NULL) {
+			dev_err(&pdev->dev, "no resource defined for command 

DMA\n");

Quoted 26 lines
drivers/mtd/nand/pxa3xx_nand.c +17 -1
+			ret = -ENXIO;
+			goto fail_put_clk;
+		}
 	}
-	info->drcmr_cmd = r->start;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
@@ -1200,12 +1210,55 @@ static int pxa3xx_nand_remove(struct
 platform_device *pdev) return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id pxa3xx_nand_dt_ids[] = {
+	{ .compatible = "mrvl,pxa3xx-nand" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
+
+static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
+{
+	struct pxa3xx_nand_platform_data *pdata;
+	struct device_node *np = pdev->dev.of_node;
+	const struct of_device_id *of_id =
+			of_match_device(pxa3xx_nand_dt_ids, &pdev->dev);
+

drivers/mtd/nand/pxa3xx_nand.c static int pxa3xx_nand_remove(struct · line 1236

Quoted 10 lines
drivers/mtd/nand/pxa3xx_nand.c +10 -0
+	if (!of_id)
+		return 0;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	if (of_get_property(np, "mrvl,nand-enable-arbiter", NULL))
+		pdata->enable_arbiter = 1;
+	if (of_get_property(np, "mrvl,nand-keep-config", NULL))

of_property_read_bool() please.

Quoted 47 lines
drivers/mtd/nand/pxa3xx_nand.c +22 -1
+		pdata->keep_config = 1;
+	of_property_read_u32(np, "num-cs", &pdata->num_cs);
+
+	pdev->dev.platform_data = pdata;
+
+	return 0;
+}
+#else
+static inline int pxa3xx_nand_probe_dt(struct platform_device *)
+{
+	return 0;
+}
+#endif
+
 static int pxa3xx_nand_probe(struct platform_device *pdev)
 {
 	struct pxa3xx_nand_platform_data *pdata;
+	struct mtd_part_parser_data ppdata = {};
 	struct pxa3xx_nand_info *info;
 	int ret, cs, probe_success;
 
+	ret = pxa3xx_nand_probe_dt(pdev);
+	if (ret)
+		return ret;
+
 	pdata = pdev->dev.platform_data;
 	if (!pdata) {
 		dev_err(&pdev->dev, "no platform data defined\n");
@@ -1229,8 +1282,9 @@ static int pxa3xx_nand_probe(struct platform_device
 *pdev) continue;
 		}
 
+		ppdata.of_node = pdev->dev.of_node;
 		ret = mtd_device_parse_register(info->host[cs]->mtd, NULL,
-						NULL, pdata->parts[cs],
+						&ppdata, pdata->parts[cs],
 						pdata->nr_parts[cs]);
 		if (!ret)
 			probe_success = 1;
@@ -1306,6 +1360,7 @@ static int pxa3xx_nand_resume(struct platform_device
 *pdev) static struct platform_driver pxa3xx_nand_driver = {
 	.driver = {
 		.name	= "pxa3xx-nand",
+		.of_match_table = of_match_ptr(pxa3xx_nand_dt_ids),
 	},
 	.probe		= pxa3xx_nand_probe,
 	.remove		= pxa3xx_nand_remove,
#12 lore raw

PATCH 4/7 ARM: pxa: add devicetree code for irq handling

In reply to Daniel Mack

Properly register on-chip interrupt using the irqdomain logic. The number of interrupts is taken from the devicetree node.

---
 arch/arm/mach-pxa/irq.c    |   73 ++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-pxa/pxa3xx.c |   17 +++++++++--
 2 files changed, 88 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/irq.c +73 -0
index 5dae15e..a403d49 100644
@@ -17,6 +17,8 @@
 #include <linux/syscore_ops.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 
 #include <asm/exception.h>
 
@@ -202,3 +204,74 @@ struct syscore_ops pxa_irq_syscore_ops = {
 	.suspend	= pxa_irq_suspend,
 	.resume		= pxa_irq_resume,
 };
+
+#ifdef CONFIG_OF
+static struct irq_domain *pxa_irq_domain;
+
+static int pxa_irq_map(struct irq_domain *h, unsigned int virq,
+		       irq_hw_number_t hw)
+{
+	int irq, i = hw % 32;
+	void __iomem *base = irq_base(hw / 32);
+
+	/* initialize interrupt priority */
+	if (cpu_has_ipr())
+		__raw_writel(i | IPR_VALID, IRQ_BASE + IPR(i));
+
+	irq = PXA_IRQ(virq);
+	irq_set_chip_and_handler(irq, &pxa_internal_irq_chip,
+				 handle_level_irq);
+	irq_set_chip_data(virq, base);
+	set_irq_flags(virq, IRQF_VALID);
+
+	return 0;
+}
+
+static struct irq_domain_ops pxa_irq_ops = {
+	.map    = pxa_irq_map,
+	.xlate  = irq_domain_xlate_onecell,
+};
+
+static const struct of_device_id intc_ids[] __initconst = {
+	{ .compatible = "mrvl,pxa-intc", .data = NULL },
+	{}
+};
+
+void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
+{
+	struct device_node *node;
+	const struct of_device_id *of_id;
+	struct pxa_intc_conf *conf;
+	int nr_irqs, irq_base, ret;
+
+	node = of_find_matching_node(NULL, intc_ids);
+	if (!node) {
+		pr_err("Failed to find interrupt controller in arch-pxa\n");
+		return;
+	}
+	of_id = of_match_node(intc_ids, node);
+	conf = of_id->data;
+
+	ret = of_property_read_u32(node, "mrvl,intc-nr-irqs", &nr_irqs);
+	if (ret) {
+		pr_err("Not found mrvl,intc-nr-irqs property\n");
+		return;
+	}
+
+	irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
+	if (irq_base < 0) {
+		pr_err("Failed to allocate IRQ numbers\n");
+		return;
+	}
+
+	pxa_irq_domain = irq_domain_add_legacy(node, nr_irqs, 0, 0,
+					       &pxa_irq_ops, NULL);
+	if (!pxa_irq_domain)
+		panic("Unable to add PXA IRQ domain\n");
+
+	irq_set_default_host(pxa_irq_domain);
+	pxa_init_irq(nr_irqs, fn);
+
+	return;
+}
+#endif /* CONFIG_OF */
arch/arm/mach-pxa/pxa3xx.c +15 -2
index dffb7e8..1827d3c 100644
@@ -40,6 +40,8 @@
 #define PECR_IE(n)	((1 << ((n) * 2)) << 28)
 #define PECR_IS(n)	((1 << ((n) * 2)) << 29)
 
+extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int));
+
 static DEFINE_PXA3_CKEN(pxa3xx_ffuart, FFUART, 14857000, 1);
 static DEFINE_PXA3_CKEN(pxa3xx_btuart, BTUART, 14857000, 1);
 static DEFINE_PXA3_CKEN(pxa3xx_stuart, STUART, 14857000, 1);
@@ -382,7 +384,7 @@ static void __init pxa_init_ext_wakeup_irq(int (*fn)(struct irq_data *,
 	pxa_ext_wakeup_chip.irq_set_wake = fn;
 }
 
-void __init pxa3xx_init_irq(void)
+static void __init __pxa3xx_init_irq(void)
 {
 	/* enable CP6 access */
 	u32 value;
@@ -390,10 +392,21 @@ void __init pxa3xx_init_irq(void)
 	value |= (1 << 6);
 	__asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
 
-	pxa_init_irq(56, pxa3xx_set_wake);
 	pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
 }
 
+void __init pxa3xx_init_irq(void)
+{
+	__pxa3xx_init_irq();
+	pxa_init_irq(56, pxa3xx_set_wake);
+}
+
+void __init pxa3xx_dt_init_irq(void)
+{
+	__pxa3xx_init_irq();
+	pxa_dt_irq_init(pxa3xx_set_wake);
+}
+
 static struct map_desc pxa3xx_io_desc[] __initdata = {
 	{	/* Mem Ctl */
 		.virtual	= (unsigned long)SMEMC_VIRT,
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH 5/7 ARM: pxa3xx: skip default device initialization when booting via DT

In reply to Daniel Mack

When booting via DT, the default PXA devices must not have been probed before, otherwise the augmented information from the device tree is ignored.

---
 arch/arm/mach-pxa/pxa3xx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-pxa/pxa3xx.c +3 -1
index 1827d3c..4a9d04a 100644
@@ -19,6 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/of.h>
 #include <linux/syscore_ops.h>
 #include <linux/i2c/pxa-i2c.h>
 
@@ -479,7 +480,8 @@ static int __init pxa3xx_init(void)
 		register_syscore_ops(&pxa3xx_mfp_syscore_ops);
 		register_syscore_ops(&pxa3xx_clock_syscore_ops);
 
-		ret = platform_add_devices(devices, ARRAY_SIZE(devices));
+		if (!of_have_populated_dt())
+			ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	}
 
 	return ret;
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH 6/7 ARM: pxa3xx: add generic DT machine code

In reply to Daniel Mack

Add a DT_MACHINE_START entry for PXA3xx machines and a auxdata table for some of the devices. This file can be extended to also support pxa2xx boards.

---
 arch/arm/mach-pxa/Kconfig  |   12 +++++++++
 arch/arm/mach-pxa/Makefile |    3 +++
 arch/arm/mach-pxa/pxa-dt.c |   61 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
 create mode 100644 arch/arm/mach-pxa/pxa-dt.c
arch/arm/mach-pxa/Kconfig +12 -0
index fe2d1f8..8e6288d 100644
@@ -25,6 +25,18 @@ config PXA_V7_MACH_AUTO
 if !ARCH_PXA_V7
 comment "Intel/Marvell Dev Platforms (sorted by hardware release time)"
 
+config MACH_PXA3XX_DT
+	bool "Support PXA3xx platforms from device tree"
+	select PXA3xx
+	select CPU_PXA300
+	select POWER_SUPPLY
+	select HAVE_PWM
+	select USE_OF
+	help
+	  Include support for Marvell PXA3xx based platforms using
+	  the device tree. Needn't select any other machine while
+	  MACH_PXA3XX_DT is enabled.
+
 config ARCH_LUBBOCK
 	bool "Intel DBPXA250 Development Platform (aka Lubbock)"
 	select PXA25x
arch/arm/mach-pxa/Makefile +3 -0
index be0f7df..2bedc9e 100644
@@ -26,6 +26,9 @@ obj-$(CONFIG_CPU_PXA930)	+= pxa930.o
 
 # NOTE: keep the order of boards in accordance to their order in Kconfig
 
+# Device Tree support
+obj-$(CONFIG_MACH_PXA3XX_DT)	+= pxa-dt.o
+
 # Intel/Marvell Dev Platforms
 obj-$(CONFIG_ARCH_LUBBOCK)	+= lubbock.o
 obj-$(CONFIG_MACH_MAINSTONE)	+= mainstone.o
arch/arm/mach-pxa/pxa-dt.c new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 6/7 ARM: pxa3xx: add generic DT machine code

Quoted 10 lines · Daniel Mack

Add a DT_MACHINE_START entry for PXA3xx machines and a auxdata table for some of the devices. This file can be extended to also support pxa2xx boards.

---
 arch/arm/mach-pxa/Kconfig  |   12 +++++++++
 arch/arm/mach-pxa/Makefile |    3 +++
 arch/arm/mach-pxa/pxa-dt.c |   61 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)

The code looks good, but I wonder if it would be better to add it to the pxa3xx.c file instead. One more comment:

arch/arm/mach-pxa/pxa-dt.c line 48

Quoted 3 lines
arch/arm/mach-pxa/pxa-dt.c new file +3 -0
+static const char *pxa3xx_dt_board_compat[] __initdata = {
+       "mrvl,pxa3xx",
+};

We should try to avoid wildcards in compatible properties but rather be more specific. I would use separate values for pxa300/310/320/920/930/935 that you could all list here if they have the same auxdata lookup table.

Arnd

#16 lore raw

PATCH 6/7 ARM: pxa3xx: add generic DT machine code

Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Daniel Mack

Add a DT_MACHINE_START entry for PXA3xx machines and a auxdata table for some of the devices. This file can be extended to also support pxa2xx boards.

---
 arch/arm/mach-pxa/Kconfig  |   12 +++++++++
 arch/arm/mach-pxa/Makefile |    3 +++
 arch/arm/mach-pxa/pxa-dt.c |   61 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
Quoted 2 lines

The code looks good, but I wonder if it would be better to add it to the pxa3xx.c file instead. One more comment:

Well, I though having tham separated from the generic code will make things cleaner and also save us one #ifdef.

Quoted 7 lines

arch/arm/mach-pxa/pxa-dt.c line 48

Quoted 3 lines
arch/arm/mach-pxa/pxa-dt.c new file +3 -0
+static const char *pxa3xx_dt_board_compat[] __initdata = {
+       "mrvl,pxa3xx",
+};

We should try to avoid wildcards in compatible properties but rather be more specific. I would use separate values for pxa300/310/320/920/930/935 that you could all list here if they have the same auxdata lookup table.

Ok, makes sense. I'm not sure about 920/930/935, so I'll leave them out for now. Whoever successfully tests these can easly add that lines.

I'll wait for some more feedback and then resubmit the whole thing.

Thanks for the review, much appreciated.

Daniel

#17 lore raw

PATCH 6/7 ARM: pxa3xx: add generic DT machine code

Quoted 13 lines · Daniel Mack
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Daniel Mack

Add a DT_MACHINE_START entry for PXA3xx machines and a auxdata table for some of the devices. This file can be extended to also support pxa2xx boards.

---
 arch/arm/mach-pxa/Kconfig  |   12 +++++++++
 arch/arm/mach-pxa/Makefile |    3 +++
 arch/arm/mach-pxa/pxa-dt.c |   61 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
Quoted 5 lines
Quoted 2 lines

The code looks good, but I wonder if it would be better to add it to the pxa3xx.c file instead. One more comment:

Well, I though having tham separated from the generic code will make things cleaner and also save us one #ifdef.

For new platforms that are DT-only we usually keep everything in one file, but you're right that it makes some sense to have it separate while most people use non-DT board files.

Quoted 10 lines
Quoted 7 lines

arch/arm/mach-pxa/pxa-dt.c line 48

Quoted 3 lines
arch/arm/mach-pxa/pxa-dt.c new file +3 -0
+static const char *pxa3xx_dt_board_compat[] __initdata = {
+       "mrvl,pxa3xx",
+};

We should try to avoid wildcards in compatible properties but rather be more specific. I would use separate values for pxa300/310/320/920/930/935 that you could all list here if they have the same auxdata lookup table.

Ok, makes sense. I'm not sure about 920/930/935, so I'll leave them out for now. Whoever successfully tests these can easly add that lines.

Sounds good.

Arnd

#18 lore raw

PATCH 7/7 ARM: pxa: add .dtsi files

In reply to Daniel Mack

This adds .dtsi files to describe the PXA SoCs. pxa3xx simply augments pxa2xx. Not all devices are listed yet, and it will need some time to get all the drivers ported.

---
 arch/arm/boot/dts/pxa2xx.dtsi |  132 +++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/pxa3xx.dtsi |   26 ++++++++
 2 files changed, 158 insertions(+)
 create mode 100644 arch/arm/boot/dts/pxa2xx.dtsi
 create mode 100644 arch/arm/boot/dts/pxa3xx.dtsi
arch/arm/boot/dts/pxa2xx.dtsi new file +132 -0
new file mode 100644
index 0000000..1046158
@@ -0,0 +1,132 @@
+/*
+ * pxa2xx.dtsi - Device Tree Include file for Marvell PXA2xx family SoC
+ *
+ * Copyright (C) 2011 Marek Vasut <[email protected]>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell PXA2xx family SoC";
+	compatible = "marvell,pxa";
+	interrupt-parent = <&pxairq>;
+
+	aliases {
+		serial0 = &ffuart;
+		serial1 = &btuart;
+		serial2 = &stuart;
+		serial3 = &hwuart;
+		i2c0 = &pwri2c;
+		i2c1 = &pxai2c1;
+	};
+
+	cpus {
+		cpu at 0 {
+			compatible = "arm,xscale";
+		};
+	};
+
+	pxabus {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		pxairq: interrupt-controller at 40d00000 {
+			#interrupt-cells = <1>;
+			compatible = "mrvl,pxa-intc";
+			interrupt-controller;
+			interrupt-parent;
+			mrvl,intc-nr-irqs = <56>;
+			reg = <0x40d00000 0xd0>;
+		};
+
+		gpio: gpio at 40e00000 {
+			compatible = "mrvl,pxa-gpio";
+			#address-cells = <0x1>;
+			#size-cells = <0x1>;
+			reg = <0x40e00000 0x10000>;
+			gpio-controller;
+			#gpio-cells = <0x2>;
+			interrupts = <10>;
+			interrupt-names = "gpio_mux";
+			interrupt-controller;
+			#interrupt-cells = <0x2>;
+			ranges;
+
+			gcb0: gpio at 40e00000 {
+				reg = <0x40e00000 0x4>;
+			};
+
+			gcb1: gpio at 40e00004 {
+				reg = <0x40e00004 0x4>;
+			};
+
+			gcb2: gpio at 40e00008 {
+				reg = <0x40e00008 0x4>;
+			};
+			gcb3: gpio at 40e0000c {
+				reg = <0x40e0000c 0x4>;
+			};
+		};
+
+		ffuart: uart at 40100000 {
+			compatible = "mrvl,pxa-uart";
+			reg = <0x40100000 0x30>;
+			interrupts = <22>;
+			status = "disabled";
+		};
+
+		btuart: uart at 40200000 {
+			compatible = "mrvl,pxa-uart";
+			reg = <0x40200000 0x30>;
+			interrupts = <21>;
+			status = "disabled";
+		};
+
+		stuart: uart at 40700000 {
+			compatible = "mrvl,pxa-uart";
+			reg = <0x40700000 0x30>;
+			interrupts = <20>;
+			status = "disabled";
+		};
+
+		hwuart: uart at 41100000 {
+			compatible = "mrvl,pxa-uart";
+			reg = <0x41100000 0x30>;
+			interrupts = <7>;
+			status = "disabled";
+		};
+
+		pxai2c1: i2c at 40301680 {
+			compatible = "mrvl,pxa-i2c";
+			reg = <0x40301680 0x30>;
+			interrupts = <18>;
+			#address-cells = <0x1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		usb0: ohci at 4c000000 {
+			compatible = "mrvl,pxa-ohci";
+			reg = <0x4c000000 0x10000>;
+			interrupts = <3>;
+			status = "disabled";
+		};
+
+		mmc0: mmc at 41100000 {
+			compatible = "mrvl,pxa-mmc";
+			reg = <0x41100000 0x1000>;
+			interrupts = <23>;
+			status = "disabled";
+		};
+
+		rtc at 40900000 {
+			compatible = "mrvl,pxa-rtc";
+			reg = <0x40900000 0x3c>;
+			interrupts = <30 31>;
+		};
+	};
+};
arch/arm/boot/dts/pxa3xx.dtsi new file +26 -0
new file mode 100644
index 0000000..3b62793
@@ -0,0 +1,26 @@
+/* The pxa3xx skeleton simply augments the 2xx version */
+/include/ "pxa2xx.dtsi"
+
+/ {
+	model = "Marvell PXA3xx familiy SoC";
+
+	pxabus {
+		pwri2c: i2c at 40f500c0 {
+			compatible = "mrvl,pwri2c";
+			reg = <0x40f500c0 0x30>;
+			interrupts = <6>;
+			#address-cells = <0x1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		nand0: nand at 43100000 {
+			compatible = "mrvl,pxa3xx-nand";
+			reg = <0x43100000 90>;
+			interrupts = <45>;
+			#address-cells = <1>;
+			#size-cells = <1>;	
+			status = "disabled";
+		};
+	};
+};
Signature · 1 line
1.7.10.4