+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/serial_8250.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/pm_runtime.h>
+#include "8250.h"
+
+#define MTK_UART_RATE_FIX 0x0D /* UART Rate Fix Register */
+
+struct mtk8250_data {
+ int line;
+ struct clk *clk;
+};
+
+static void
+mtk8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
+{
+ if (!state)
+ pm_runtime_get_sync(port->dev);
+
+ serial8250_do_pm(port, state, old);
+
+ if (state)
+ pm_runtime_put_sync_suspend(port->dev);
+}
+
+static int mtk8250_probe_of(struct uart_port *p,
+ struct mtk8250_data *data)
+{
+ int err;
+ struct device_node *np = p->dev->of_node;
+
+ data->clk = of_clk_get(np, 0);
+ if (IS_ERR(data->clk)) {
+ pr_warn("Can't get timer clock");
+ return PTR_ERR(data->clk);
+ }
+
+ err = clk_prepare_enable(data->clk);
+ if (err) {
+ pr_warn("Can't prepare clock");
+ clk_put(data->clk);
+ return err;
+ }
+ p->uartclk = clk_get_rate(data->clk);
+
+ return 0;
+}
+static struct platform_driver mtk8250_platform_driver = {
+ .driver = {
+ .name = "mt6577-uart",
+ .owner = THIS_MODULE,
+ .pm = &mtk8250_pm_ops,--
+ .of_match_table = mtk8250_of_match,
+ },
+ .probe = mtk8250_probe,
+ .remove = mtk8250_remove,
+};
+module_platform_driver(mtk8250_platform_driver);