From: Thomas Abraham <thomas.abraham@linaro.org>
To: linux-serial@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org, alan@linux.intel.com,
grant.likely@secretlab.ca, linux-samsung-soc@vger.kernel.org,
kgene.kim@samsung.com, ben-linux@fluff.org
Subject: [PATCH v2 9/9] serial: samsung: add device tree support
Date: Mon, 10 Oct 2011 15:38:05 +0530 [thread overview]
Message-ID: <1318241285-23568-10-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1318241285-23568-1-git-send-email-thomas.abraham@linaro.org>
Add device tree based discovery support for Samsung's uart controller.
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
.../devicetree/bindings/serial/samsung_uart.txt | 14 ++++++++
drivers/tty/serial/samsung.c | 36 ++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/serial/samsung_uart.txt
diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.txt b/Documentation/devicetree/bindings/serial/samsung_uart.txt
new file mode 100644
index 0000000..2c8a17c
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/samsung_uart.txt
@@ -0,0 +1,14 @@
+* Samsung's UART Controller
+
+The Samsung's UART controller is used for interfacing SoC with serial communicaion
+devices.
+
+Required properties:
+- compatible: should be
+ - "samsung,exynos4210-uart", for UART's compatible with Exynos4210 uart ports.
+
+- reg: base physical address of the controller and length of memory mapped
+ region.
+
+- interrupts: interrupt number to the cpu. The interrupt specifier format depends
+ on the interrupt controller parent.
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c89987b..efe3756 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -42,6 +42,7 @@
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/cpufreq.h>
+#include <linux/of.h>
#include <asm/irq.h>
@@ -1163,10 +1164,26 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);
+
/* Device driver serial port probe */
+static const struct of_device_id s3c24xx_uart_dt_match[];
static int probe_index;
+static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
+ struct platform_device *pdev)
+{
+#ifdef CONFIG_OF
+ if (pdev->dev.of_node) {
+ const struct of_device_id *match;
+ match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node);
+ return (struct s3c24xx_serial_drv_data *)match->data;
+ }
+#endif
+ return (struct s3c24xx_serial_drv_data *)
+ platform_get_device_id(pdev)->driver_data;
+}
+
static int s3c24xx_serial_probe(struct platform_device *pdev)
{
struct s3c24xx_uart_port *ourport;
@@ -1176,8 +1193,11 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
ourport = &s3c24xx_serial_ports[probe_index];
- ourport->drv_data = (struct s3c24xx_serial_drv_data *)
- platform_get_device_id(pdev)->driver_data;
+ ourport->drv_data = s3c24xx_get_driver_data(pdev);
+ if (!ourport->drv_data) {
+ dev_err(&pdev->dev, "could not find driver data\n");
+ return -ENODEV;
+ }
ourport->info = ourport->drv_data->info;
ourport->cfg = (pdev->dev.platform_data) ?
@@ -1626,6 +1646,17 @@ static struct platform_device_id s3c24xx_serial_driver_ids[] = {
};
MODULE_DEVICE_TABLE(platform, s3c24xx_serial_driver_ids);
+#ifdef CONFIG_OF
+static const struct of_device_id s3c24xx_uart_dt_match[] = {
+ { .compatible = "samsung,exynos4210-uart",
+ .data = &exynos4210_serial_drv_data },
+ {},
+};
+MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match);
+#else
+#define s3c24xx_uart_dt_match NULL
+#endif
+
static struct platform_driver samsung_serial_driver = {
.probe = s3c24xx_serial_probe,
.remove = __devexit_p(s3c24xx_serial_remove),
@@ -1634,6 +1665,7 @@ static struct platform_driver samsung_serial_driver = {
.name = "samsung-uart",
.owner = THIS_MODULE,
.pm = SERIAL_SAMSUNG_PM_OPS,
+ .of_match_table = s3c24xx_uart_dt_match,
},
};
--
1.6.6.rc2
next prev parent reply other threads:[~2011-10-10 10:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 10:07 [PATCH v2 0/9] serial: samsung: rework clock lookup and add device tree support Thomas Abraham
2011-10-10 10:07 ` [PATCH v2 1/9] serial: samsung: Keep a copy of the location of platform data in driver's private data Thomas Abraham
[not found] ` <1318241285-23568-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-10-10 10:07 ` [PATCH v2 2/9] serial: samsung: move handling of fclk/n clock to platform code Thomas Abraham
2011-10-10 10:07 ` [PATCH v2 3/9] serial: samsung: switch to clkdev based clock lookup Thomas Abraham
2011-10-10 10:08 ` [PATCH v2 4/9] serial: samsung: remove struct 's3c24xx_uart_clksrc' and all uses of it Thomas Abraham
2011-10-24 11:37 ` Grant Likely
2011-10-10 10:08 ` [PATCH v2 5/9] serial: samsung: remove all uses of get_clksrc and set_clksrc Thomas Abraham
2011-10-10 10:08 ` [PATCH v2 6/9] arm: samsung: register uart clocks to clock lookup list Thomas Abraham
2011-10-10 10:08 ` [PATCH v2 7/9] serial: samsung: merge all SoC specific port reset functions Thomas Abraham
2011-10-10 10:08 ` [PATCH v2 8/9] serial: samsung: merge probe() function from all SoC specific extensions Thomas Abraham
2011-10-10 10:08 ` Thomas Abraham [this message]
2011-10-24 11:38 ` [PATCH v2 9/9] serial: samsung: add device tree support Grant Likely
2011-10-24 8:27 ` [PATCH v2 0/9] serial: samsung: rework clock lookup and " Kukjin Kim
2011-10-24 9:05 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318241285-23568-10-git-send-email-thomas.abraham@linaro.org \
--to=thomas.abraham@linaro.org \
--cc=alan@linux.intel.com \
--cc=ben-linux@fluff.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).