summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/max310x.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2013-06-29 10:44:18 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-27 02:53:27 +0400
commit21fc509f1194c2fa06eff4c72238210089c29453 (patch)
treecc458ad72251518283f0b2bd7d93671a338820bd /drivers/tty/serial/max310x.c
parent10d8b34a421716d55a4ff7c2d427c35e88b8fd60 (diff)
downloadlinux-21fc509f1194c2fa06eff4c72238210089c29453.tar.xz
serial: max310x: Add MAX3109 support
This patch adds support for MAX3109 (advanced dual universal asynchronous receiver-transmitter) into max310x driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/max310x.c')
-rw-r--r--drivers/tty/serial/max310x.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 4620289e9e49..a6c46427363b 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1,5 +1,5 @@
/*
- * Maxim (Dallas) MAX3107/8 serial driver
+ * Maxim (Dallas) MAX3107/8/9 serial driver
*
* Copyright (C) 2012-2013 Alexander Shiyan <shc_work@mail.ru>
*
@@ -13,9 +13,6 @@
* (at your option) any later version.
*/
-/* TODO: MAX3109 support (Dual) */
-/* TODO: MAX14830 support (Quad) */
-
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/device.h>
@@ -269,6 +266,9 @@
/* MAX3107 specific */
#define MAX3107_REV_ID (0xa0)
+/* MAX3109 specific */
+#define MAX3109_REV_ID (0xc0)
+
struct max310x_devtype {
char name[9];
int nr;
@@ -359,6 +359,25 @@ static int max3108_detect(struct device *dev)
return 0;
}
+static int max3109_detect(struct device *dev)
+{
+ struct max310x_port *s = dev_get_drvdata(dev);
+ unsigned int val = 0;
+ int ret;
+
+ ret = regmap_read(s->regmap, MAX310X_REVID_REG, &val);
+ if (ret)
+ return ret;
+
+ if (((val & MAX310x_REV_MASK) != MAX3109_REV_ID)) {
+ dev_err(dev,
+ "%s ID 0x%02x does not match\n", s->devtype->name, val);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
static void max310x_power(struct uart_port *port, int on)
{
max310x_port_update(port, MAX310X_MODE1_REG,
@@ -382,6 +401,13 @@ static const struct max310x_devtype max3108_devtype = {
.power = max310x_power,
};
+static const struct max310x_devtype max3109_devtype = {
+ .name = "MAX3109",
+ .nr = 2,
+ .detect = max3109_detect,
+ .power = max310x_power,
+};
+
static bool max310x_reg_writeable(struct device *dev, unsigned int reg)
{
switch (reg & 0x1f) {
@@ -1226,6 +1252,7 @@ static SIMPLE_DEV_PM_OPS(max310x_pm_ops, max310x_suspend, max310x_resume);
static const struct spi_device_id max310x_id_table[] = {
{ "max3107", (kernel_ulong_t)&max3107_devtype, },
{ "max3108", (kernel_ulong_t)&max3108_devtype, },
+ { "max3109", (kernel_ulong_t)&max3109_devtype, },
{ }
};
MODULE_DEVICE_TABLE(spi, max310x_id_table);