summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_cadence.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/serial_cadence.c')
-rw-r--r--drivers/serial/serial_cadence.c70
1 files changed, 16 insertions, 54 deletions
diff --git a/drivers/serial/serial_cadence.c b/drivers/serial/serial_cadence.c
index 6454888e3c..ee162e541a 100644
--- a/drivers/serial/serial_cadence.c
+++ b/drivers/serial/serial_cadence.c
@@ -1,58 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
*/
+
#include <common.h>
#include <driver.h>
#include <init.h>
-#include <malloc.h>
-#include <notifier.h>
#include <io.h>
-#include <linux/err.h>
#include <linux/clk.h>
-
-#define CADENCE_UART_CONTROL 0x00
-#define CADENCE_UART_MODE 0x04
-#define CADENCE_UART_BAUD_GEN 0x18
-#define CADENCE_UART_CHANNEL_STS 0x2C
-#define CADENCE_UART_RXTXFIFO 0x30
-#define CADENCE_UART_BAUD_DIV 0x34
-
-#define CADENCE_CTRL_RXRES (1 << 0)
-#define CADENCE_CTRL_TXRES (1 << 1)
-#define CADENCE_CTRL_RXEN (1 << 2)
-#define CADENCE_CTRL_RXDIS (1 << 3)
-#define CADENCE_CTRL_TXEN (1 << 4)
-#define CADENCE_CTRL_TXDIS (1 << 5)
-#define CADENCE_CTRL_RSTTO (1 << 6)
-#define CADENCE_CTRL_STTBRK (1 << 7)
-#define CADENCE_CTRL_STPBRK (1 << 8)
-
-#define CADENCE_MODE_CLK_REF (0 << 0)
-#define CADENCE_MODE_CLK_REF_DIV (1 << 0)
-#define CADENCE_MODE_CHRL_6 (3 << 1)
-#define CADENCE_MODE_CHRL_7 (2 << 1)
-#define CADENCE_MODE_CHRL_8 (0 << 1)
-#define CADENCE_MODE_PAR_EVEN (0 << 3)
-#define CADENCE_MODE_PAR_ODD (1 << 3)
-#define CADENCE_MODE_PAR_SPACE (2 << 3)
-#define CADENCE_MODE_PAR_MARK (3 << 3)
-#define CADENCE_MODE_PAR_NONE (4 << 3)
-
-#define CADENCE_STS_REMPTY (1 << 1)
-#define CADENCE_STS_RFUL (1 << 2)
-#define CADENCE_STS_TEMPTY (1 << 3)
-#define CADENCE_STS_TFUL (1 << 4)
+#include <linux/err.h>
+#include <malloc.h>
+#include <notifier.h>
+#include <serial/cadence.h>
/*
* create default values for different platforms
@@ -214,7 +173,7 @@ static int cadence_clocksource_clock_change(struct notifier_block *nb,
return 0;
}
-static int cadence_serial_probe(struct device_d *dev)
+static int cadence_serial_probe(struct device *dev)
{
struct resource *iores;
struct console_device *cdev;
@@ -272,9 +231,16 @@ static __maybe_unused struct of_device_id cadence_serial_dt_ids[] = {
.compatible = "xlnx,xuartps",
.data = &cadence_r1p08_data,
}, {
+ .compatible = "cdns,uart-r1p12",
+ .data = &cadence_r1p08_data,
+ }, {
+ .compatible = "xlnx,zynqmp-uart",
+ .data = &cadence_r1p08_data,
+ }, {
/* sentinel */
}
};
+MODULE_DEVICE_TABLE(of, cadence_serial_dt_ids);
static struct platform_device_id cadence_serial_ids[] = {
{
@@ -285,15 +251,11 @@ static struct platform_device_id cadence_serial_ids[] = {
},
};
-static struct driver_d cadence_serial_driver = {
+static struct driver cadence_serial_driver = {
.name = "cadence_serial",
.probe = cadence_serial_probe,
.of_compatible = DRV_OF_COMPAT(cadence_serial_dt_ids),
.id_table = cadence_serial_ids,
};
-static int cadence_serial_init(void)
-{
- return platform_driver_register(&cadence_serial_driver);
-}
-console_initcall(cadence_serial_init);
+console_platform_driver(cadence_serial_driver);