Skip to contentSkip to conversation

serial: 8250: add support for MediaTek BTIF controller

PATCH In review [email protected] 3 participants 10 messages Aug 2, 2017 – Aug 11, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover serial: 8250: add support for MediaTek BTIF controller

From: Sean Wang <[email protected]>

This patchset introduces the support for MediaTek BTIF controller.

MediaTek BTIF controller is the serial interface similar to UART but it works only as the digital device which is mainly used to communicate with the connectivity module also called CONNSYS inside the SoC which could be mostly found on those MediaTek SoCs with Bluetooth feature.

And the controller is made as being compatible with the 8250 register layout so it tends to be integrated with existing 8250 core driver and have no requirement for the modem configuration additionally such as the baud rate calculation and assignment.

Sean Wang (2):
dt-bindings: serial: Add MediaTek BTIF controller bindings
tty: serial: 8250: Add MediaTek BTIF controller on MT7622 and MT7623
SoC

 .../devicetree/bindings/serial/mtk-btif.txt        |  26 +++
 drivers/tty/serial/8250/8250_btif.c                | 224 +++++++++++++++++++++
 drivers/tty/serial/8250/Kconfig                    |   9 +
 drivers/tty/serial/8250/Makefile                   |   1 +
 4 files changed, 260 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-btif.txt
 create mode 100644 drivers/tty/serial/8250/8250_btif.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 dt-bindings: serial: Add MediaTek BTIF controller bindings

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek BTIF controller which could be found on MT7622 and MT7623 SoC.

---
 .../devicetree/bindings/serial/mtk-btif.txt        | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-btif.txt
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +26 -0
new file mode 100644
index 0000000..80c1f5a
@@ -0,0 +1,26 @@
+Device-Tree bindings for MediaTek BTIF controller found on those
+MediaTek SoCs with Bluetooth feature
+
+Required properties:
+- compatible: Should be one of:
+	- "mediatek,mt7622-btif" : for MT7622 SoC
+	- "mediatek,mt7623-btif" : for MT7623 SoC
+- reg: The base address of the BTIF register bank;
+- interrupts: A single interrupt specifier;
+- clocks: list of clock specifiers, corresponding to
+	  entries in clock-names property;
+- clock-names: should contain "main" entries.
+
+Optional properties:
+- mediatek,loopback: Boolean; if defined, indicates that BTIF controller
+	running on the loopback mode.
+
+Example:
+
+	btif: btif at 1100c000 {
+		compatible = "mediatek,mt7623-btif";
+		reg = <0 0x1100c000 0 0x1000>;
+		interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_BTIF>;
+		clock-names = "main";
+	};
Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 1/2] dt-bindings: serial: Add MediaTek BTIF controller bindings

Quoted 23 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek BTIF controller which could be found on MT7622 and MT7623 SoC.

---
 .../devicetree/bindings/serial/mtk-btif.txt        | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-btif.txt
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +6 -0
new file mode 100644
index 0000000..80c1f5a
@@ -0,0 +1,26 @@
+Device-Tree bindings for MediaTek BTIF controller found on those
+MediaTek SoCs with Bluetooth feature
+
+Required properties:
+- compatible: Should be one of:
+	- "mediatek,mt7622-btif" : for MT7622 SoC

Documentation/devicetree/bindings/serial/mtk-btif.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +10 -0
+	- "mediatek,mt7623-btif" : for MT7623 SoC
+- reg: The base address of the BTIF register bank;
+- interrupts: A single interrupt specifier;
+- clocks: list of clock specifiers, corresponding to
+	  entries in clock-names property;
+- clock-names: should contain "main" entries.
+
+Optional properties:
+- mediatek,loopback: Boolean; if defined, indicates that BTIF controller
+	running on the loopback mode.

I don't think this belongs in DT, but should be a module param or sysfs control.

Documentation/devicetree/bindings/serial/mtk-btif.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +4 -0
+
+Example:
+
+	btif: btif at 1100c000 {

bluetooth at ...

Quoted 9 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +6 -0
+		compatible = "mediatek,mt7623-btif";
+		reg = <0 0x1100c000 0 0x1000>;
+		interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_BTIF>;
+		clock-names = "main";
+	};
Signature · 1 line
2.7.4
author
#3 lore raw

Re: [PATCH 1/2] dt-bindings: serial: Add MediaTek BTIF controller bindings

Quoted 29 lines · Rob Herring
Quoted 28 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek BTIF controller which could be found on MT7622 and MT7623 SoC.

---
 .../devicetree/bindings/serial/mtk-btif.txt        | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-btif.txt
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +11 -0
new file mode 100644
index 0000000..80c1f5a
@@ -0,0 +1,26 @@
+Device-Tree bindings for MediaTek BTIF controller found on those
+MediaTek SoCs with Bluetooth feature
+
+Required properties:
+- compatible: Should be one of:
+	- "mediatek,mt7622-btif" : for MT7622 SoC
+	- "mediatek,mt7623-btif" : for MT7623 SoC
+- reg: The base address of the BTIF register bank;
+- interrupts: A single interrupt specifier;
+- clocks: list of clock specifiers, corresponding to
+	  entries in clock-names property;
Quoted 9 lines

Documentation/devicetree/bindings/serial/mtk-btif.txt line 16

Quoted 5 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +5 -0
+- clock-names: should contain "main" entries.
+
+Optional properties:
+- mediatek,loopback: Boolean; if defined, indicates that BTIF controller
+	running on the loopback mode.

I don't think this belongs in DT, but should be a module param or sysfs control.

the loopback actually is one of hardware setups so i add it as one property in the dt or could you kindly guide me how to make judgment accurately for listing those changes as either dt or a module param?

Quoted 7 lines

Documentation/devicetree/bindings/serial/mtk-btif.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +4 -0
+
+Example:
+
+	btif: btif at 1100c000 {

bluetooth at ...

btif not bluetooth, which is just the interface hardware allowing the the main processor communicating with the bluetooth hardware built in the SoC, and is really like to the uart used by legacy bluetooth. So i will add bluetooth as the another node.

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +6 -0
+		compatible = "mediatek,mt7623-btif";
+		reg = <0 0x1100c000 0 0x1000>;
+		interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_BTIF>;
+		clock-names = "main";
+	};
Signature · 1 line
2.7.4
maintainer
#4 lore raw

Re: [PATCH 1/2] dt-bindings: serial: Add MediaTek BTIF controller bindings

Quoted 39 lines · Sean Wang
Quoted 29 lines · Rob Herring
Quoted 28 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek BTIF controller which could be found on MT7622 and MT7623 SoC.

---
 .../devicetree/bindings/serial/mtk-btif.txt        | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-btif.txt
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +11 -0
new file mode 100644
index 0000000..80c1f5a
@@ -0,0 +1,26 @@
+Device-Tree bindings for MediaTek BTIF controller found on those
+MediaTek SoCs with Bluetooth feature
+
+Required properties:
+- compatible: Should be one of:
+   - "mediatek,mt7622-btif" : for MT7622 SoC
+   - "mediatek,mt7623-btif" : for MT7623 SoC
+- reg: The base address of the BTIF register bank;
+- interrupts: A single interrupt specifier;
+- clocks: list of clock specifiers, corresponding to
+     entries in clock-names property;
Quoted 9 lines

Documentation/devicetree/bindings/serial/mtk-btif.txt line 16

Quoted 5 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +5 -0
+- clock-names: should contain "main" entries.
+
+Optional properties:
+- mediatek,loopback: Boolean; if defined, indicates that BTIF controller
+   running on the loopback mode.

I don't think this belongs in DT, but should be a module param or sysfs control.

Quoted 3 lines

the loopback actually is one of hardware setups so i add it as one property in the dt or could you kindly guide me how to make judgment accurately for listing those changes as either dt or a module param?

It's just a debug mode, right? Generally a user shouldn't have to modify the DT to change settings. Only if you wanted a given board to always be in loopback would this make sense in DT.

Quoted 11 lines
Quoted 7 lines

Documentation/devicetree/bindings/serial/mtk-btif.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +4 -0
+
+Example:
+
+   btif: btif at 1100c000 {

bluetooth at ...

btif not bluetooth, which is just the interface hardware allowing the the main processor communicating with the bluetooth hardware built in the SoC, and is really like to the uart used by legacy bluetooth. So i will add bluetooth as the another node.

Right, I realized that after writing this. It should be "serial at ..." instead.

Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/serial/mtk-btif.txt new file +6 -1
+           compatible = "mediatek,mt7623-btif";
+           reg = <0 0x1100c000 0 0x1000>;
+           interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_LOW>;
+           clocks = <&pericfg CLK_PERI_BTIF>;
+           clock-names = "main";
+   };
--

2.7.4

#5 lore raw

PATCH 2/2 tty: serial: 8250: Add MediaTek BTIF controller on MT7622 and MT7623 SoC

In reply to [email protected]

From: Sean Wang <[email protected]>

MediaTek BTIF controller is the serial interface similar to UART but it works only as the digital device which is mainly used to communicate with the connectivity module also called CONNSYS inside the SoC which could be mostly found on those MediaTek SoCs with Bluetooth feature.

And the controller is made as being compatible with the 8250 register layout so it tends to be integrated with existing 8250 core driver and have no requirement for the modem configuration additionally such as the baud rate calculation and assignment.

---
 drivers/tty/serial/8250/8250_btif.c | 224 ++++++++++++++++++++++++++++++++++++
 drivers/tty/serial/8250/Kconfig     |   9 ++
 drivers/tty/serial/8250/Makefile    |   1 +
 3 files changed, 234 insertions(+)
 create mode 100644 drivers/tty/serial/8250/8250_btif.c
drivers/tty/serial/8250/8250_btif.c new file +224 -0
new file mode 100644
index 0000000..06433e9
@@ -0,0 +1,224 @@
+/*
+ * Driver for MediaTek BTIF Controller
+ *
+ * Copyright (C) 2017 Sean Wang <[email protected]>
+ *
+ * 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 <linux/clk.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/serial_8250.h>
+#include <linux/serial_reg.h>
+
+#include "8250.h"
+
+#define MTK_BTIF_TRI_LVL	0x60
+#define BTIF_LOOP		BIT(7)
+
+struct mtk_btif_data {
+	int			line;
+	struct clk		*main_clk;
+};
+
+static void
+mtk_btif_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 mtk_btif_probe_of(struct platform_device *pdev, struct uart_port *p,
+			     struct mtk_btif_data *data)
+{
+	int err;
+
+	data->main_clk = devm_clk_get(&pdev->dev, "main");
+	if (IS_ERR(data->main_clk)) {
+		dev_warn(&pdev->dev, "Can't get main clock\n");
+		return PTR_ERR(data->main_clk);
+	}
+
+	err = clk_prepare_enable(data->main_clk);
+	if (err) {
+		dev_warn(&pdev->dev, "Can't prepare main_clk\n");
+		clk_put(data->main_clk);
+		return err;
+	}
+
+	p->uartclk = clk_get_rate(data->main_clk);
+
+	return 0;
+}
+
+static int mtk_btif_runtime_suspend(struct device *dev)
+{
+	struct mtk_btif_data *data = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(data->main_clk);
+
+	return 0;
+}
+
+static int mtk_btif_runtime_resume(struct device *dev)
+{
+	struct mtk_btif_data *data = dev_get_drvdata(dev);
+	int err;
+
+	err = clk_prepare_enable(data->main_clk);
+	if (err) {
+		dev_warn(dev, "Can't enable main clock\n");
+		return err;
+	}
+
+	return 0;
+}
+
+static int mtk_btif_probe(struct platform_device *pdev)
+{
+	struct uart_8250_port uart = {};
+	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	struct mtk_btif_data *data;
+	int err;
+	u32 tmp;
+
+	if (!regs || !irq) {
+		dev_err(&pdev->dev, "no registers/irq defined\n");
+		return -EINVAL;
+	}
+
+	uart.port.membase = devm_ioremap(&pdev->dev, regs->start,
+					 resource_size(regs));
+	if (!uart.port.membase)
+		return -ENOMEM;
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	if (pdev->dev.of_node) {
+		err = mtk_btif_probe_of(pdev, &uart.port, data);
+		if (err)
+			return err;
+	} else {
+		return -ENODEV;
+	}
+
+	spin_lock_init(&uart.port.lock);
+	uart.port.mapbase = regs->start;
+	uart.port.irq = irq->start;
+	uart.port.pm = mtk_btif_do_pm;
+	uart.port.type = PORT_8250;
+	uart.port.flags = UPF_FIXED_TYPE;
+	uart.port.dev = &pdev->dev;
+	uart.port.iotype = UPIO_MEM32;
+	uart.port.regshift = 2;
+	uart.port.private_data = data;
+
+	platform_set_drvdata(pdev, data);
+
+	pm_runtime_enable(&pdev->dev);
+
+	if (!pm_runtime_enabled(&pdev->dev)) {
+		err = mtk_btif_runtime_resume(&pdev->dev);
+		if (err)
+			return err;
+	}
+
+	if (of_property_read_bool(pdev->dev.of_node, "mediatek,loopback")) {
+		dev_info(&pdev->dev, "btif is entering loopback mode\n");
+		tmp = readl(uart.port.membase + MTK_BTIF_TRI_LVL);
+		tmp |= BTIF_LOOP;
+		writel(tmp, uart.port.membase + MTK_BTIF_TRI_LVL);
+	}
+
+	data->line = serial8250_register_8250_port(&uart);
+	if (data->line < 0)
+		return data->line;
+
+	return 0;
+}
+
+static int mtk_btif_remove(struct platform_device *pdev)
+{
+	struct mtk_btif_data *data = platform_get_drvdata(pdev);
+
+	pm_runtime_get_sync(&pdev->dev);
+
+	serial8250_unregister_port(data->line);
+
+	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+
+	if (!pm_runtime_status_suspended(&pdev->dev))
+		mtk_btif_runtime_suspend(&pdev->dev);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int mtk_btif_suspend(struct device *dev)
+{
+	struct mtk_btif_data *data = dev_get_drvdata(dev);
+
+	serial8250_suspend_port(data->line);
+
+	return 0;
+}
+
+static int mtk_btif_resume(struct device *dev)
+{
+	struct mtk_btif_data *data = dev_get_drvdata(dev);
+
+	serial8250_resume_port(data->line);
+
+	return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops mtk_btif_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(mtk_btif_suspend, mtk_btif_resume)
+	SET_RUNTIME_PM_OPS(mtk_btif_runtime_suspend, mtk_btif_runtime_resume,
+			   NULL)
+};
+
+static const struct of_device_id mtk_btif_of_match[] = {
+	{ .compatible = "mediatek,mt7622-btif" },
+	{ .compatible = "mediatek,mt7623-btif" },
+	{ /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mtk_btif_of_match);
+
+static struct platform_driver mtk_btif_platform_driver = {
+	.driver = {
+		.name		= "mediatek-btif",
+		.pm		= &mtk_btif_pm_ops,
+		.of_match_table	= mtk_btif_of_match,
+	},
+	.probe			= mtk_btif_probe,
+	.remove			= mtk_btif_remove,
+};
+module_platform_driver(mtk_btif_platform_driver);
+
+MODULE_AUTHOR("Sean Wang <[email protected]>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("MediaTek BTIF controller driver");
drivers/tty/serial/8250/Kconfig +9 -0
index a1161ec..0e18cfc 100644
@@ -403,6 +403,15 @@ config SERIAL_8250_MT6577
 	  If you have a Mediatek based board and want to use the
 	  serial port, say Y to this option. If unsure, say N.
 
+config SERIAL_8250_BTIF
+	tristate "MediaTek BTIF controller support"
+	depends on SERIAL_8250 && ARCH_MEDIATEK
+	help
+	  Selecting this option will enable BTIF controller used by MediaTek
+	  Bluetooth to communicate with internal hardware module inside the
+	  SoC also being called CONNSYS which could be found on MediaTek SoCs
+	  with Bluetooth feature, say Y to this option. If unsure, say N.
+
 config SERIAL_8250_UNIPHIER
 	tristate "Support for UniPhier on-chip UART"
 	depends on SERIAL_8250
drivers/tty/serial/8250/Makefile +1 -0
index a44a99a..2fc73ce 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_SERIAL_8250_EM)		+= 8250_em.o
 obj-$(CONFIG_SERIAL_8250_OMAP)		+= 8250_omap.o
 obj-$(CONFIG_SERIAL_8250_LPC18XX)	+= 8250_lpc18xx.o
 obj-$(CONFIG_SERIAL_8250_MT6577)	+= 8250_mtk.o
+obj-$(CONFIG_SERIAL_8250_BTIF)		+= 8250_btif.o
 obj-$(CONFIG_SERIAL_8250_UNIPHIER)	+= 8250_uniphier.o
 obj-$(CONFIG_SERIAL_8250_INGENIC)	+= 8250_ingenic.o
 obj-$(CONFIG_SERIAL_8250_LPSS)		+= 8250_lpss.o
Signature · 1 line
2.7.4
#6 lore raw
In reply to [email protected]
Quoted 12 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

This patchset introduces the support for MediaTek BTIF controller.

MediaTek BTIF controller is the serial interface similar to UART but it
works only as the digital device which is mainly used to communicate with
the connectivity module also called CONNSYS inside the SoC which could be
mostly found on those MediaTek SoCs with Bluetooth feature.

Quoted 5 lines

And the controller is made as being compatible with the 8250 register layout so it tends to be integrated with existing 8250 core driver and have no requirement for the modem configuration additionally such as the
baud rate calculation and assignment.

Why it requires a separate driver?

8250_of is for DT enabled drivers.

Quoted 16 lines

Sean Wang (2):
? dt-bindings: serial: Add MediaTek BTIF controller bindings ? tty: serial: 8250: Add MediaTek BTIF controller on MT7622 and MT7623 ????SoC

?.../devicetree/bindings/serial/mtk-btif.txt????????|??26 +++ ?drivers/tty/serial/8250/8250_btif.c????????????????| 224
+++++++++++++++++++++
?drivers/tty/serial/8250/Kconfig????????????????????|???9 + ?drivers/tty/serial/8250/Makefile???????????????????|???1 + ?4 files changed, 260 insertions(+)
?create mode 100644 Documentation/devicetree/bindings/serial/mtk- btif.txt
?create mode 100644 drivers/tty/serial/8250/8250_btif.c

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
author
#7 lore raw
Quoted 20 lines · Andy Shevchenko
Quoted 12 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

This patchset introduces the support for MediaTek BTIF controller.

MediaTek BTIF controller is the serial interface similar to UART but it
works only as the digital device which is mainly used to communicate with
the connectivity module also called CONNSYS inside the SoC which could be
mostly found on those MediaTek SoCs with Bluetooth feature.

Quoted 5 lines

And the controller is made as being compatible with the 8250 register layout so it tends to be integrated with existing 8250 core driver and have no requirement for the modem configuration additionally such as the
baud rate calculation and assignment.

Quoted 4 lines

Why it requires a separate driver?

8250_of is for DT enabled drivers.

Hi, Andy

thanks for your information

the hardware is not completely identical to 8250 device,
it has extra registers belonged to platform control such as internal loopback, dma disable/enable, sleep/wakeup setup and so on, so I create it as a separate driver.

Sean

Quoted 17 lines
Quoted 16 lines

Sean Wang (2):
dt-bindings: serial: Add MediaTek BTIF controller bindings
tty: serial: 8250: Add MediaTek BTIF controller on MT7622 and MT7623
SoC

 .../devicetree/bindings/serial/mtk-btif.txt        |  26 +++
 drivers/tty/serial/8250/8250_btif.c                | 224
+++++++++++++++++++++
 drivers/tty/serial/8250/Kconfig                    |   9 +
 drivers/tty/serial/8250/Makefile                   |   1 +
 4 files changed, 260 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/mtk-
btif.txt
 create mode 100644 drivers/tty/serial/8250/8250_btif.c
#8 lore raw
Quoted 17 lines · Sean Wang
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

This patchset introduces the support for MediaTek BTIF controller.

MediaTek BTIF controller is the serial interface similar to UART but
it
works only as the digital device which is mainly used to communicate
with
the connectivity module also called CONNSYS inside the SoC which could
be
mostly found on those MediaTek SoCs with Bluetooth feature.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

And the controller is made as being compatible with the 8250 register
layout so it tends to be integrated with existing 8250 core driver and
have no requirement for the modem configuration additionally such as
the
baud rate calculation and assignment.

+Cc: Arnd.

Quoted 7 lines
Quoted 4 lines

Why it requires a separate driver?

8250_of is for DT enabled drivers.

Hi, Andy

Quoted 7 lines

thanks for your information

the hardware is not completely identical to 8250 device,? it has extra registers belonged to platform control such as internal loopback, dma disable/enable, sleep/wakeup setup and so on, so I create
it as a separate driver.

Over all 200+ LOCs I didn't see any of the above except loopback, which is one property that can be easily added to 8250_of.c.

Moreover, if you have more code coming I would suggest you to split 8250_of to library and driver parts and re-use stuff from there.

Arnd, what is your opinion about new 8250 OF based drivers?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
author
#9 lore raw

cover serial: 8250: add support for MediaTek BTIF controller

Quoted 44 lines · Andy Shevchenko
Quoted 17 lines · Sean Wang
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

This patchset introduces the support for MediaTek BTIF controller.

MediaTek BTIF controller is the serial interface similar to UART but
it
works only as the digital device which is mainly used to communicate
with
the connectivity module also called CONNSYS inside the SoC which could
be
mostly found on those MediaTek SoCs with Bluetooth feature.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

And the controller is made as being compatible with the 8250 register
layout so it tends to be integrated with existing 8250 core driver and
have no requirement for the modem configuration additionally such as
the
baud rate calculation and assignment.

+Cc: Arnd.

Quoted 7 lines
Quoted 4 lines

Why it requires a separate driver?

8250_of is for DT enabled drivers.

Hi, Andy

Quoted 7 lines

thanks for your information

the hardware is not completely identical to 8250 device, it has extra registers belonged to platform control such as internal loopback, dma disable/enable, sleep/wakeup setup and so on, so I create
it as a separate driver.

Quoted 8 lines

Over all 200+ LOCs I didn't see any of the above except loopback, which is one property that can be easily added to 8250_of.c.

Moreover, if you have more code coming I would suggest you to split 8250_of to library and driver parts and re-use stuff from there.

Arnd, what is your opinion about new 8250 OF based drivers?

Hi, Andy

many thanks for the detailed guidance.
I will turn into reusing 8250 OF stuff in the next version and look forward to any idea from Arnd how to do with 8250 OF driver to add specific programming/data for those devices using 8250 OF.

Sean