* [PATCH 1/8] gpio: pxa: add OF support
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
[not found] ` <1330582228-12424-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 6:10 ` [PATCH 2/8] serial: " Haojian Zhuang
` (6 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
gpio-pxa drivers needs to parse two properties: mrvl,gpio-irq0 and
mrvl,gpio-irq1.
There may be 3 irqs in gpio devices in arch-pxa. The first one may
be only for gpio0, the second on may be only for gpio1, and the last
one may be the irq mux for other gpios. In arch-mmp, there's only
one irq mux for all gpios.
Since irq mux is common, we only specify it in interrupts propery.
And we creates two properties mrvl,gpio-irq0 and mrvl,gpio-irq1 for
arch-pxa.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/gpio/gpio-pxa.c | 40 +++++++++++++++++++++++++++++++++++++---
1 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index b2d3ee1..7d8e1d0 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -18,6 +18,7 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/syscore_ops.h>
#include <linux/slab.h>
@@ -464,6 +465,39 @@ static int pxa_gpio_nums(void)
return count;
}
+#ifdef CONFIG_OF
+static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev,
+ int *irq0, int *irq1, int *irq_mux)
+{
+ struct device_node *np = pdev->dev.of_node;
+ const __be32 *irq;
+
+ irq = of_get_property(np, "mrvl,gpio-irq0", NULL);
+ if (irq)
+ *irq0 = be32_to_cpup(irq);
+ irq = of_get_property(np, "mrvl,gpio-irq1", NULL);
+ if (irq)
+ *irq1 = be32_to_cpup(irq);
+ *irq_mux = platform_get_irq(pdev, 0);
+ return 0;
+}
+#else
+static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev,
+ int *irq0, int *irq1, int *irq_mux)
+{
+ return 1;
+}
+#endif
+
+static int __devinit pxa_gpio_probe_irq(struct platform_device *pdev,
+ int *irq0, int *irq1, int *irq_mux)
+{
+ *irq0 = platform_get_irq_byname(pdev, "gpio0");
+ *irq1 = platform_get_irq_byname(pdev, "gpio1");
+ *irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
+ return 0;
+}
+
static int __devinit pxa_gpio_probe(struct platform_device *pdev)
{
struct pxa_gpio_chip *c;
@@ -476,9 +510,9 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev)
if (!pxa_last_gpio)
return -EINVAL;
- irq0 = platform_get_irq_byname(pdev, "gpio0");
- irq1 = platform_get_irq_byname(pdev, "gpio1");
- irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
+ ret = pxa_gpio_probe_dt(pdev, &irq0, &irq1, &irq_mux);
+ if (ret > 0)
+ ret = pxa_gpio_probe_irq(pdev, &irq0, &irq1, &irq_mux);
if ((irq0 > 0 && irq1 <= 0) || (irq0 <= 0 && irq1 > 0)
|| (irq_mux <= 0))
return -EINVAL;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/8] serial: pxa: add OF support
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 1/8] gpio: pxa: add OF support Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
[not found] ` <1330582228-12424-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 6:10 ` [PATCH 3/8] rtc: sa1100: " Haojian Zhuang
` (5 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
Parse uart device id from alias in DTS file.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/tty/serial/pxa.c | 57 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 5c8e3bb..380f15f 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -36,6 +36,7 @@
#include <linux/circ_buf.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
@@ -781,6 +782,39 @@ static const struct dev_pm_ops serial_pxa_pm_ops = {
};
#endif
+static struct of_device_id serial_pxa_dt_ids[] = {
+ { .compatible = "mrvl,pxa-uart", },
+ { .compatible = "mrvl,mmp-uart", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
+
+#ifdef CONFIG_OF
+static int serial_pxa_probe_dt(struct platform_device *pdev,
+ struct uart_pxa_port *sport)
+{
+ struct device_node *np = pdev->dev.of_node;
+ int ret;
+
+ if (!np)
+ return 1;
+
+ ret = of_alias_get_id(np, "serial");
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
+ return ret;
+ }
+ sport->port.line = ret;
+ return 0;
+}
+#else
+static int serial_pxa_probe_dt(struct platform_device *pdev,
+ struct uart_pxa_port *sport)
+{
+ return 1;
+}
+#endif
+
static int serial_pxa_probe(struct platform_device *dev)
{
struct uart_pxa_port *sport;
@@ -792,7 +826,7 @@ static int serial_pxa_probe(struct platform_device *dev)
if (!mmres || !irqres)
return -ENODEV;
- sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL);
+ sport = kzalloc(sizeof(struct uart_pxa_port) + 8, GFP_KERNEL);
if (!sport)
return -ENOMEM;
@@ -808,20 +842,18 @@ static int serial_pxa_probe(struct platform_device *dev)
sport->port.irq = irqres->start;
sport->port.fifosize = 64;
sport->port.ops = &serial_pxa_pops;
- sport->port.line = dev->id;
sport->port.dev = &dev->dev;
sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
sport->port.uartclk = clk_get_rate(sport->clk);
- switch (dev->id) {
- case 0: sport->name = "FFUART"; break;
- case 1: sport->name = "BTUART"; break;
- case 2: sport->name = "STUART"; break;
- case 3: sport->name = "HWUART"; break;
- default:
- sport->name = "???";
- break;
- }
+ ret = serial_pxa_probe_dt(dev, sport);
+ if (ret > 0)
+ sport->port.line = dev->id;
+ else if (ret < 0)
+ goto err_clk;
+ sport->name = (char *)((unsigned int)sport + 8);
+ /* name can't exceed 8 bytes */
+ sprintf(sport->name, "UART%d", sport->port.line + 1);
sport->port.membase = ioremap(mmres->start, resource_size(mmres));
if (!sport->port.membase) {
@@ -829,7 +861,7 @@ static int serial_pxa_probe(struct platform_device *dev)
goto err_clk;
}
- serial_pxa_ports[dev->id] = sport;
+ serial_pxa_ports[sport->port.line] = sport;
uart_add_one_port(&serial_pxa_reg, &sport->port);
platform_set_drvdata(dev, sport);
@@ -866,6 +898,7 @@ static struct platform_driver serial_pxa_driver = {
#ifdef CONFIG_PM
.pm = &serial_pxa_pm_ops,
#endif
+ .of_match_table = serial_pxa_dt_ids,
},
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/8] rtc: sa1100: add OF support
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 1/8] gpio: pxa: add OF support Haojian Zhuang
2012-03-01 6:10 ` [PATCH 2/8] serial: " Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
[not found] ` <1330582228-12424-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 6:10 ` [PATCH 4/8] i2c: pxa: " Haojian Zhuang
` (4 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
There're two interrupts are used in rtc-sa1100 devices. The RTC-alarm
interrupt is specified as default interrupt. The RTC-1Hz interrupt is
specified as "mrvl,rtc-irqhz" property in DTS file.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/rtc/rtc-sa1100.c | 54 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 962510c..09f05d5 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -30,6 +30,7 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/of.h>
#include <linux/pm.h>
#include <linux/bitops.h>
@@ -228,28 +229,64 @@ static const struct rtc_class_ops sa1100_rtc_ops = {
.alarm_irq_enable = sa1100_rtc_alarm_irq_enable,
};
+static struct of_device_id sa1100_rtc_dt_ids[] = {
+ { .compatible = "mrvl,sa1100-rtc", },
+ { .compatible = "mrvl,mmp-rtc", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
+
+#ifdef CONFIG_OF
+static int sa1100_rtc_probe_dt(struct platform_device *pdev,
+ struct sa1100_rtc *info)
+{
+ info->irq_alarm = platform_get_irq(pdev, 0);
+ info->irq_1hz = platform_get_irq(pdev, 1);
+ if (info->irq_1hz < 0 || info->irq_alarm < 0)
+ return -ENODEV;
+ return 0;
+}
+#else
+static int sa1100_rtc_probe_dt(struct platform_device *pdev,
+ struct sa1100_rtc *info)
+{
+ return 1;
+}
+#endif
+
+static int sa1100_rtc_probe_irq(struct platform_device *pdev,
+ struct sa1100_rtc *info)
+{
+ info->irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz");
+ info->irq_alarm = platform_get_irq_byname(pdev, "rtc alarm");
+ if (info->irq_1hz < 0 || info->irq_alarm < 0)
+ return -ENODEV;
+ return 0;
+}
+
static int sa1100_rtc_probe(struct platform_device *pdev)
{
struct rtc_device *rtc;
struct sa1100_rtc *info;
- int irq_1hz, irq_alarm, ret = 0;
-
- irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz");
- irq_alarm = platform_get_irq_byname(pdev, "rtc alarm");
- if (irq_1hz < 0 || irq_alarm < 0)
- return -ENODEV;
+ int ret = 0;
info = kzalloc(sizeof(struct sa1100_rtc), GFP_KERNEL);
if (!info)
return -ENOMEM;
+ ret = sa1100_rtc_probe_dt(pdev, info);
+ if (ret > 0)
+ ret = sa1100_rtc_probe_irq(pdev, info);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get rtc irq\n");
+ goto err_clk;
+ }
+
info->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(info->clk)) {
dev_err(&pdev->dev, "failed to find rtc clock source\n");
ret = PTR_ERR(info->clk);
goto err_clk;
}
- info->irq_1hz = irq_1hz;
- info->irq_alarm = irq_alarm;
spin_lock_init(&info->lock);
platform_set_drvdata(pdev, info);
@@ -357,6 +394,7 @@ static struct platform_driver sa1100_rtc_driver = {
#ifdef CONFIG_PM
.pm = &sa1100_rtc_pm_ops,
#endif
+ .of_match_table = sa1100_rtc_dt_ids,
},
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/8] i2c: pxa: add OF support
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
` (2 preceding siblings ...)
2012-03-01 6:10 ` [PATCH 3/8] rtc: sa1100: " Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
[not found] ` <1330582228-12424-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-03-01 6:10 ` [PATCH 5/8] ARM: mmp: enable rtc clk in pxa168 Haojian Zhuang
` (3 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
Append these properties in below.
mrvl,i2c-polling
mrvl,i2c-mode
Still keep slave, slave_addr and class in platform data.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/i2c/busses/i2c-pxa.c | 101 ++++++++++++++++++++++++++++++++---------
1 files changed, 79 insertions(+), 22 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index d603646..883d14f 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -29,6 +29,8 @@
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/i2c-pxa.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/of_i2c.h>
#include <linux/platform_device.h>
#include <linux/err.h>
@@ -1044,23 +1046,64 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
.functionality = i2c_pxa_functionality,
};
-static int i2c_pxa_probe(struct platform_device *dev)
+static struct of_device_id i2c_pxa_dt_ids[] = {
+ { .compatible = "mrvl,pxa-i2c", .data = &pxa_reg_layout[REGS_PXA2XX] },
+ { .compatible = "mrvl,pwri2c", .data = &pxa_reg_layout[REGS_PXA3XX] },
+ { .compatible = "mrvl,mmp-twsi", .data = &pxa_reg_layout[REGS_PXA2XX] },
+ {}
+};
+MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
+
+#ifdef CONFIG_OF
+static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
+ enum pxa_i2c_types *i2c_types)
{
- struct pxa_i2c *i2c;
- struct resource *res;
- struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
- const struct platform_device_id *id = platform_get_device_id(dev);
- enum pxa_i2c_types i2c_type = id->driver_data;
- int ret;
- int irq;
+ struct device_node *np = pdev->dev.of_node;
+ const struct of_device_id *of_id =
+ of_match_device(i2c_pxa_dt_ids, &pdev->dev);
+ const char *status;
+ int len;
+
+ if (of_get_property(np, "mrvl,i2c-polling", NULL))
+ i2c->use_pio = 1;
+ status = of_get_property(np, "mrvl,i2c-mode", &len);
+ if (status && len > 0)
+ if (!strcmp(status, "fast"))
+ i2c->fast_mode = 1;
+ *i2c_types = ((u32)(of_id->data) - (u32)&pxa_reg_layout[0])
+ / sizeof(struct pxa_reg_layout);
+ return 0;
+}
+#else
+static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
+ enum pxa_i2c_types *i2c_types)
+{
+ return 1;
+}
+#endif
- res = platform_get_resource(dev, IORESOURCE_MEM, 0);
- irq = platform_get_irq(dev, 0);
- if (res == NULL || irq < 0)
- return -ENODEV;
+static int i2c_pxa_probe_pdata(struct platform_device *pdev,
+ struct pxa_i2c *i2c,
+ enum pxa_i2c_types *i2c_types)
+{
+ struct i2c_pxa_platform_data *plat = pdev->dev.platform_data;
+ const struct platform_device_id *id = platform_get_device_id(pdev);
- if (!request_mem_region(res->start, resource_size(res), res->name))
- return -ENOMEM;
+ *i2c_types = id->driver_data;
+ if (plat) {
+ i2c->use_pio = plat->use_pio;
+ i2c->fast_mode = plat->fast_mode;
+ }
+ return 0;
+}
+
+static int i2c_pxa_probe(struct platform_device *dev)
+{
+ struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
+ enum pxa_i2c_types i2c_type;
+ struct pxa_i2c *i2c;
+ struct resource *res = NULL;
+ int ret, irq;
i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
if (!i2c) {
@@ -1068,6 +1111,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
goto emalloc;
}
+ ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type);
+ if (ret > 0)
+ ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
+ if (ret < 0)
+ goto eclk;
+
+ res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+ irq = platform_get_irq(dev, 0);
+ if (res == NULL || irq < 0) {
+ ret = -ENODEV;
+ goto eclk;
+ }
+
+ if (!request_mem_region(res->start, resource_size(res), res->name)) {
+ ret = -ENOMEM;
+ goto eclk;
+ }
+
i2c->adap.owner = THIS_MODULE;
i2c->adap.retries = 5;
@@ -1109,21 +1170,16 @@ static int i2c_pxa_probe(struct platform_device *dev)
i2c->slave_addr = I2C_PXA_SLAVE_ADDR;
-#ifdef CONFIG_I2C_PXA_SLAVE
if (plat) {
+#ifdef CONFIG_I2C_PXA_SLAVE
i2c->slave_addr = plat->slave_addr;
i2c->slave = plat->slave;
- }
#endif
-
- clk_enable(i2c->clk);
-
- if (plat) {
i2c->adap.class = plat->class;
- i2c->use_pio = plat->use_pio;
- i2c->fast_mode = plat->fast_mode;
}
+ clk_enable(i2c->clk);
+
if (i2c->use_pio) {
i2c->adap.algo = &i2c_pxa_pio_algorithm;
} else {
@@ -1234,6 +1290,7 @@ static struct platform_driver i2c_pxa_driver = {
.name = "pxa2xx-i2c",
.owner = THIS_MODULE,
.pm = I2C_PXA_DEV_PM_OPS,
+ .of_match_table = i2c_pxa_dt_ids,
},
.id_table = i2c_pxa_id_table,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/8] ARM: mmp: enable rtc clk in pxa168
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
` (3 preceding siblings ...)
2012-03-01 6:10 ` [PATCH 4/8] i2c: pxa: " Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
2012-03-01 6:10 ` [PATCH 6/8] ARM: mmp: append OF support on pxa168 Haojian Zhuang
` (2 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
Enable clk of rtc-sa1100 device in pxa168.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
arch/arm/mach-mmp/pxa168.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 9f61256..aa62d0c 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -65,6 +65,7 @@ static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000);
static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
+static APBC_CLK(rtc, PXA168_RTC, 8, 32768);
static APMU_CLK(nand, NAND, 0x19b, 156000000);
static APMU_CLK(lcd, LCD, 0x7f, 312000000);
@@ -93,6 +94,7 @@ static struct clk_lookup pxa168_clkregs[] = {
INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
+ INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
};
static int __init pxa168_init(void)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 6/8] ARM: mmp: append OF support on pxa168
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
` (4 preceding siblings ...)
2012-03-01 6:10 ` [PATCH 5/8] ARM: mmp: enable rtc clk in pxa168 Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
2012-03-01 6:10 ` [PATCH 7/8] ARM: dts: append DTS file of pxa168 Haojian Zhuang
2012-03-01 6:10 ` [PATCH 8/8] Document: devicetree: add OF documents for arch-mmp Haojian Zhuang
7 siblings, 0 replies; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
Enable PXA168 and aspenite support.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
arch/arm/mach-mmp/Kconfig | 10 ++++++
arch/arm/mach-mmp/Makefile | 1 +
arch/arm/mach-mmp/mmp-dt.c | 75 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-mmp/mmp-dt.c
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 323d4c9..5a90b9a 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -2,6 +2,16 @@ if ARCH_MMP
menu "Marvell PXA168/910/MMP2 Implmentations"
+config MACH_MMP_DT
+ bool "Support MMP2 platforms from device tree"
+ select CPU_PXA168
+ select CPU_PXA910
+ select USE_OF
+ help
+ Include support for Marvell MMP2 based platforms using
+ the device tree. Needn't select any other machine while
+ MACH_MMP_DT is enabled.
+
config MACH_ASPENITE
bool "Marvell's PXA168 Aspenite Development Board"
select CPU_PXA168
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index ba254a7..4fc0ff5 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_MACH_TTC_DKB) += ttc_dkb.o
obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o
obj-$(CONFIG_MACH_FLINT) += flint.o
obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
+obj-$(CONFIG_MACH_MMP_DT) += mmp-dt.o
obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
obj-$(CONFIG_MACH_GPLUGD) += gplugd.o
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
new file mode 100644
index 0000000..6707539
--- /dev/null
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -0,0 +1,75 @@
+/*
+ * linux/arch/arm/mach-mmp/mmp-dt.c
+ *
+ * Copyright (C) 2012 Marvell Technology Group Ltd.
+ * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * publishhed by the Free Software Foundation.
+ */
+
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+#include <mach/irqs.h>
+
+#include "common.h"
+
+extern struct sys_timer pxa168_timer;
+extern void __init icu_init_irq(void);
+
+static const struct of_dev_auxdata mmp_auxdata_lookup[] __initconst = {
+ OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL),
+ OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
+ {}
+};
+
+static int __init mmp_intc_add_irq_domain(struct device_node *np,
+ struct device_node *parent)
+{
+ irq_domain_add_simple(np, 0);
+ return 0;
+}
+
+static int __init mmp_gpio_add_irq_domain(struct device_node *np,
+ struct device_node *parent)
+{
+ irq_domain_add_simple(np, IRQ_GPIO_START);
+ return 0;
+}
+
+static const struct of_device_id mmp_irq_match[] __initconst = {
+ { .compatible = "mrvl,mmp-intc", .data = mmp_intc_add_irq_domain, },
+ { .compatible = "mrvl,mmp-gpio", .data = mmp_gpio_add_irq_domain, },
+ {}
+};
+
+static void __init mmp_dt_init(void)
+{
+
+ of_irq_init(mmp_irq_match);
+
+ of_platform_populate(NULL, of_default_bus_match_table,
+ mmp_auxdata_lookup, NULL);
+}
+
+static const char *pxa168_dt_board_compat[] __initdata = {
+ "mrvl,pxa168-aspenite",
+ NULL,
+};
+
+DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
+ .map_io = mmp_map_io,
+ .init_irq = icu_init_irq,
+ .timer = &pxa168_timer,
+ .init_machine = mmp_dt_init,
+ .dt_compat = pxa168_dt_board_compat,
+MACHINE_END
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 7/8] ARM: dts: append DTS file of pxa168
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
` (5 preceding siblings ...)
2012-03-01 6:10 ` [PATCH 6/8] ARM: mmp: append OF support on pxa168 Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
2012-03-01 6:10 ` [PATCH 8/8] Document: devicetree: add OF documents for arch-mmp Haojian Zhuang
7 siblings, 0 replies; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
DTS files of both PXA168 and aspenite are appended.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
arch/arm/boot/dts/pxa168-aspenite.dts | 38 +++++++++++++
arch/arm/boot/dts/pxa168.dtsi | 96 +++++++++++++++++++++++++++++++++
2 files changed, 134 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/boot/dts/pxa168-aspenite.dts
create mode 100644 arch/arm/boot/dts/pxa168.dtsi
diff --git a/arch/arm/boot/dts/pxa168-aspenite.dts b/arch/arm/boot/dts/pxa168-aspenite.dts
new file mode 100644
index 0000000..e762fac
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168-aspenite.dts
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Marvell Technology Group Ltd.
+ * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * publishhed by the Free Software Foundation.
+ */
+
+/dts-v1/;
+/include/ "pxa168.dtsi"
+
+/ {
+ model = "Marvell PXA168 Aspenite Development Board";
+ compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168";
+
+ chosen {
+ bootargs = "console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on";
+ };
+
+ memory {
+ reg = <0x00000000 0x04000000>;
+ };
+
+ soc {
+ apb@d4000000 {
+ uart1: uart@d4017000 {
+ status = "okay";
+ };
+ twsi1: i2c@d4011000 {
+ status = "okay";
+ };
+ rtc: rtc@d4010000 {
+ status = "okay";
+ };
+ };
+ };
+};
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
new file mode 100644
index 0000000..e624c10
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Marvell Technology Group Ltd.
+ * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * publishhed by the Free Software Foundation.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+ aliases {
+ serial0 = &uart1;
+ serial1 = &uart2;
+ serial2 = &uart3;
+ };
+
+ intc: intc-interrupt-controller@d4282000 {
+ compatible = "mrvl,mmp-intc", "mrvl,intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ reg = <0xd4282000 0x1000>;
+ };
+
+ soc {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ interrupt-parent = <&intc>;
+ ranges;
+
+ apb@d4000000 { /* APB */
+ compatible = "mrvl,apb-bus", "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xd4000000 0x00200000>;
+ ranges;
+
+ uart1: uart@d4017000 {
+ compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
+ reg = <0xd4017000 0x1000>;
+ interrupts = <27>;
+ status = "disabled";
+ };
+
+ uart2: uart@d4018000 {
+ compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
+ reg = <0xd4018000 0x1000>;
+ interrupts = <28>;
+ status = "disabled";
+ };
+
+ uart3: uart@d4026000 {
+ compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
+ reg = <0xd4026000 0x1000>;
+ interrupts = <29>;
+ status = "disabled";
+ };
+
+ gpio: gpio@d4019000 {
+ compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio";
+ reg = <0xd4019000 0x1000>;
+ interrupts = <49>;
+ gpio-controller;
+ #gpio-cells = <1>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ mrvl,gpio-irq0 = <17>;
+ mrvl,gpio-irq1 = <18>;
+ };
+
+ twsi1: i2c@d4011000 {
+ compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
+ reg = <0xd4011000 0x1000>;
+ interrupts = <7>;
+ mrvl,i2c-mode = "fast";
+ status = "disabled";
+ };
+
+ twsi2: i2c@d4025000 {
+ compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
+ reg = <0xd4025000 0x1000>;
+ interrupts = <58>;
+ status = "disabled";
+ };
+
+ rtc: rtc@d4010000 {
+ compatible = "mrvl,mmp-rtc";
+ reg = <0xd4010000 0x1000>;
+ interrupts = <6 5>;
+ status = "disabled";
+ };
+ };
+ };
+};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 8/8] Document: devicetree: add OF documents for arch-mmp
2012-03-01 6:10 [PATCH 0/8] ARM: mmp: support OF on pxa168 Haojian Zhuang
` (6 preceding siblings ...)
2012-03-01 6:10 ` [PATCH 7/8] ARM: dts: append DTS file of pxa168 Haojian Zhuang
@ 2012-03-01 6:10 ` Haojian Zhuang
7 siblings, 0 replies; 17+ messages in thread
From: Haojian Zhuang @ 2012-03-01 6:10 UTC (permalink / raw)
To: arnd, linux-arm-kernel, devicetree-discuss, grant.likely, linux,
eric.y.miao
Cc: Haojian Zhuang
Add OF support in Document/devicetree directory.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
Documentation/devicetree/bindings/arm/mrvl.txt | 6 +++
.../devicetree/bindings/gpio/mrvl-gpio.txt | 27 ++++++++++++++
Documentation/devicetree/bindings/i2c/mrvl-i2c.txt | 37 ++++++++++++++++++++
.../devicetree/bindings/rtc/sa1100-rtc.txt | 15 ++++++++
4 files changed, 85 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/mrvl.txt
create mode 100644 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
create mode 100644 Documentation/devicetree/bindings/i2c/mrvl-i2c.txt
create mode 100644 Documentation/devicetree/bindings/rtc/sa1100-rtc.txt
diff --git a/Documentation/devicetree/bindings/arm/mrvl.txt b/Documentation/devicetree/bindings/arm/mrvl.txt
new file mode 100644
index 0000000..d8de933
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mrvl.txt
@@ -0,0 +1,6 @@
+Marvell Platforms Device Tree Bindings
+----------------------------------------------------
+
+PXA168 Aspenite Board
+Required root node properties:
+ - compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168";
diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
new file mode 100644
index 0000000..c2c7995
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
@@ -0,0 +1,27 @@
+* Marvell PXA GPIO controller
+
+Required properties:
+- compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio"
+- reg : Address and length of the register set for the device
+- interrupts : Should be the port interrupt shared by all gpio pins, if
+ one number.
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be one. It is the pin number.
+
+Recommended properties:
+- mrvl,gpio-irq0: Should be interrupt number of gpio0 in pxa2xx/pxa3xx/pxa95x.
+- mrvl,gpio-irq1: should be interrupt number of gpio1 in pxa2xx/pxa3xx/pxa95x.
+
+Example:
+
+ gpio: gpio@d4019000 {
+ compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio";
+ reg = <0xd4019000 0x1000>;
+ interrupts = <49>;
+ gpio-controller;
+ #gpio-cells = <1>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ mrvl,gpio-irq0 = <17>;
+ mrvl,gpio-irq1 = <18>;
+ };
diff --git a/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt
new file mode 100644
index 0000000..699c7ce
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt
@@ -0,0 +1,37 @@
+* I2C
+
+Required properties :
+
+ - reg : Offset and length of the register set for the device
+ - compatible : should be "mrvl,mmp-twsi" where CHIP is the name of a
+ compatible processor, e.g. pxa168, pxa910, mmp2, mmp3.
+ For the pxa2xx/pxa3xx, an additional node "mrvl,pxa-i2c" is required
+ as shown in the example below.
+
+Recommended properties :
+
+ - interrupts : <a b> where a is the interrupt number and b is a
+ field that represents an encoding of the sense and level
+ information for the interrupt. This should be encoded based on
+ the information in section 2) depending on the type of interrupt
+ controller you have.
+ - interrupt-parent : the phandle for the interrupt controller that
+ services interrupts for this device.
+ - mrvl,i2c-polling : Disable interrupt of i2c controller. Polling
+ status register of i2c controller instead.
+ - mrvl,i2c-mode : "fast" means fast mode of i2c controller.
+
+Examples:
+ twsi1: i2c@d4011000 {
+ compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
+ reg = <0xd4011000 0x1000>;
+ interrupts = <7>;
+ mrvl,i2c-mode = "fast";
+ };
+
+ twsi2: i2c@d4025000 {
+ compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
+ reg = <0xd4025000 0x1000>;
+ interrupts = <58>;
+ };
+
diff --git a/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt
new file mode 100644
index 0000000..f3a0118
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt
@@ -0,0 +1,15 @@
+* Marvell Real Time Clock controller
+
+Required properties:
+- compatible: should be "mrvl,sa1100-rtc"
+- reg: physical base address of the controller and length of memory mapped
+ region.
+- interrupts: Should be two. The first interrupt number is the rtc alarm
+ interrupt and the second interrupt number is the rtc hz interrupt.
+
+Example:
+ rtc: rtc@d4010000 {
+ compatible = "mrvl,mmp-rtc";
+ reg = <0xd4010000 0x1000>;
+ interrupts = <6 5>;
+ };
--
1.7.0.4
^ permalink raw reply related [flat|nested] 17+ messages in thread