[U-Boot] [PATCH v2 1/2] ns16550: replace with binding files from Linux kernel

Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Signed-off-by: Thomas Chou thomas@wytron.com.tw --- doc/device-tree-bindings/serial/8250.txt | 66 +++++++++++++++++++ doc/device-tree-bindings/serial/ns16550.txt | 10 --- doc/device-tree-bindings/serial/omap_serial.txt | 33 ++++++++++ .../serial/snps-dw-apb-uart.txt | 76 ++++++++++++++++++++++ 4 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 doc/device-tree-bindings/serial/8250.txt delete mode 100644 doc/device-tree-bindings/serial/ns16550.txt create mode 100644 doc/device-tree-bindings/serial/omap_serial.txt create mode 100644 doc/device-tree-bindings/serial/snps-dw-apb-uart.txt
diff --git a/doc/device-tree-bindings/serial/8250.txt b/doc/device-tree-bindings/serial/8250.txt new file mode 100644 index 0000000..91d5ab0 --- /dev/null +++ b/doc/device-tree-bindings/serial/8250.txt @@ -0,0 +1,66 @@ +* UART (Universal Asynchronous Receiver/Transmitter) + +Required properties: +- compatible : one of: + - "ns8250" + - "ns16450" + - "ns16550a" + - "ns16550" + - "ns16750" + - "ns16850" + - For Tegra20, must contain "nvidia,tegra20-uart" + - For other Tegra, must contain '"nvidia,<chip>-uart", + "nvidia,tegra20-uart"' where <chip> is tegra30, tegra114, tegra124, + tegra132, or tegra210. + - "nxp,lpc3220-uart" + - "ralink,rt2880-uart" + - "ibm,qpace-nwp-serial" + - "altr,16550-FIFO32" + - "altr,16550-FIFO64" + - "altr,16550-FIFO128" + - "fsl,16550-FIFO64" + - "fsl,ns16550" + - "serial" if the port type is unknown. +- reg : offset and length of the register set for the device. +- interrupts : should contain uart interrupt. +- clock-frequency : the input clock frequency for the UART + or + clocks phandle to refer to the clk used as per Documentation/devicetree + /bindings/clock/clock-bindings.txt + +Optional properties: +- current-speed : the current active speed of the UART. +- reg-offset : offset to apply to the mapbase from the start of the registers. +- reg-shift : quantity to shift the register offsets by. +- reg-io-width : the size (in bytes) of the IO accesses that should be + performed on the device. There are some systems that require 32-bit + accesses to the UART (e.g. TI davinci). +- used-by-rtas : set to indicate that the port is in use by the OpenFirmware + RTAS and should not be registered. +- no-loopback-test: set to indicate that the port does not implements loopback + test mode +- fifo-size: the fifo size of the UART. +- auto-flow-control: one way to enable automatic flow control support. The + driver is allowed to detect support for the capability even without this + property. + +Note: +* fsl,ns16550: + ------------ + Freescale DUART is very similar to the PC16552D (and to a + pair of NS16550A), albeit with some nonstandard behavior such as + erratum A-004737 (relating to incorrect BRK handling). + + Represents a single port that is compatible with the DUART found + on many Freescale chips (examples include mpc8349, mpc8548, + mpc8641d, p4080 and ls2085a). + +Example: + + uart@80230000 { + compatible = "ns8250"; + reg = <0x80230000 0x100>; + clock-frequency = <3686400>; + interrupts = <10>; + reg-shift = <2>; + }; diff --git a/doc/device-tree-bindings/serial/ns16550.txt b/doc/device-tree-bindings/serial/ns16550.txt deleted file mode 100644 index ef0b9ae..0000000 --- a/doc/device-tree-bindings/serial/ns16550.txt +++ /dev/null @@ -1,10 +0,0 @@ -NS16550 UART - -This UART driver supports many chip variants and is used in mamy SoCs. - -Required properties: -- compatible: "ns16550" or "nvidia,tegra20-uart" -- reg: start address and size of registers -- reg-shift: shift value indicating register size: 0=byte, 1=16bit,2=32bit etc. -- clock-frequency: input clock frequency for the UART (used to calculate the - baud rate divisor) diff --git a/doc/device-tree-bindings/serial/omap_serial.txt b/doc/device-tree-bindings/serial/omap_serial.txt new file mode 100644 index 0000000..7a71b5d --- /dev/null +++ b/doc/device-tree-bindings/serial/omap_serial.txt @@ -0,0 +1,33 @@ +OMAP UART controller + +Required properties: +- compatible : should be "ti,omap2-uart" for OMAP2 controllers +- compatible : should be "ti,omap3-uart" for OMAP3 controllers +- compatible : should be "ti,omap4-uart" for OMAP4 controllers +- compatible : should be "ti,am4372-uart" for AM437x controllers +- compatible : should be "ti,am3352-uart" for AM335x controllers +- compatible : should be "ti,dra742-uart" for DRA7x controllers +- reg : address and length of the register space +- interrupts or interrupts-extended : Should contain the uart interrupt + specifier or both the interrupt + controller phandle and interrupt + specifier. +- ti,hwmods : Must be "uart<n>", n being the instance number (1-based) + +Optional properties: +- clock-frequency : frequency of the clock input to the UART +- dmas : DMA specifier, consisting of a phandle to the DMA controller + node and a DMA channel number. +- dma-names : "rx" for receive channel, "tx" for transmit channel. + +Example: + + uart4: serial@49042000 { + compatible = "ti,omap3-uart"; + reg = <0x49042000 0x400>; + interrupts = <80>; + dmas = <&sdma 81 &sdma 82>; + dma-names = "tx", "rx"; + ti,hwmods = "uart4"; + clock-frequency = <48000000>; + }; diff --git a/doc/device-tree-bindings/serial/snps-dw-apb-uart.txt b/doc/device-tree-bindings/serial/snps-dw-apb-uart.txt new file mode 100644 index 0000000..12bbe9f --- /dev/null +++ b/doc/device-tree-bindings/serial/snps-dw-apb-uart.txt @@ -0,0 +1,76 @@ +* Synopsys DesignWare ABP UART + +Required properties: +- compatible : "snps,dw-apb-uart" +- reg : offset and length of the register set for the device. +- interrupts : should contain uart interrupt. + +Clock handling: +The clock rate of the input clock needs to be supplied by one of +- clock-frequency : the input clock frequency for the UART. +- clocks : phandle to the input clock + +The supplying peripheral clock can also be handled, needing a second property +- clock-names: tuple listing input clock names. + Required elements: "baudclk", "apb_pclk" + +Optional properties: +- snps,uart-16550-compatible : reflects the value of UART_16550_COMPATIBLE + configuration parameter. Define this if your UART does not implement the busy + functionality. +- resets : phandle to the parent reset controller. +- reg-shift : quantity to shift the register offsets by. If this property is + not present then the register offsets are not shifted. +- reg-io-width : the size (in bytes) of the IO accesses that should be + performed on the device. If this property is not present then single byte + accesses are used. +- dcd-override : Override the DCD modem status signal. This signal will always + be reported as active instead of being obtained from the modem status + register. Define this if your serial port does not use this pin. +- dsr-override : Override the DTS modem status signal. This signal will always + be reported as active instead of being obtained from the modem status + register. Define this if your serial port does not use this pin. +- cts-override : Override the CTS modem status signal. This signal will always + be reported as active instead of being obtained from the modem status + register. Define this if your serial port does not use this pin. +- ri-override : Override the RI modem status signal. This signal will always be + reported as inactive instead of being obtained from the modem status register. + Define this if your serial port does not use this pin. + +Example: + + uart@80230000 { + compatible = "snps,dw-apb-uart"; + reg = <0x80230000 0x100>; + clock-frequency = <3686400>; + interrupts = <10>; + reg-shift = <2>; + reg-io-width = <4>; + dcd-override; + dsr-override; + cts-override; + ri-override; + }; + +Example with one clock: + + uart@80230000 { + compatible = "snps,dw-apb-uart"; + reg = <0x80230000 0x100>; + clocks = <&baudclk>; + interrupts = <10>; + reg-shift = <2>; + reg-io-width = <4>; + }; + +Example with two clocks: + + uart@80230000 { + compatible = "snps,dw-apb-uart"; + reg = <0x80230000 0x100>; + clocks = <&baudclk>, <&apb_pclk>; + clock-names = "baudclk", "apb_pclk"; + interrupts = <10>; + reg-shift = <2>; + reg-io-width = <4>; + };

Zap the rockchip serial compatible string, because rockchip serial has "snps,dw-apb-uart" compatible string in the dts.
Signed-off-by: Thomas Chou thomas@wytron.com.tw --- drivers/serial/ns16550.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 3fab3f1..06ac005 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -424,11 +424,15 @@ const struct dm_serial_ops ns16550_serial_ops = { };
#if CONFIG_IS_ENABLED(OF_CONTROL) +/* + * Please consider existing compatible strings before adding a new + * one to keep this table compact. Or you may add a generic "ns16550" + * compatible string to your dts. + */ static const struct udevice_id ns16550_serial_ids[] = { { .compatible = "ns16550" }, { .compatible = "ns16550a" }, { .compatible = "nvidia,tegra20-uart" }, - { .compatible = "rockchip,rk3036-uart" }, { .compatible = "snps,dw-apb-uart" }, { .compatible = "ti,omap2-uart" }, { .compatible = "ti,omap3-uart" },

On 12/14/2015 05:45 AM, Thomas Chou wrote:
Zap the rockchip serial compatible string, because rockchip serial has "snps,dw-apb-uart" compatible string in the dts.
More importantly, the rockchip compatible value isn't defined in the binding.

On 14 December 2015 at 05:45, Thomas Chou thomas@wytron.com.tw wrote:
Zap the rockchip serial compatible string, because rockchip serial has "snps,dw-apb-uart" compatible string in the dts.
Signed-off-by: Thomas Chou thomas@wytron.com.tw
drivers/serial/ns16550.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Acked-by: Simon Glass sjg@chromium.org

On Mon, Dec 14, 2015 at 08:45:09PM +0800, Thomas Chou wrote:
Zap the rockchip serial compatible string, because rockchip serial has "snps,dw-apb-uart" compatible string in the dts.
Signed-off-by: Thomas Chou thomas@wytron.com.tw Acked-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

On 12/14/2015 05:45 AM, Thomas Chou wrote:
Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Acked-by: Stephen Warren swarren@nvidia.com
(I assume that the new files are identical to the kernel versions, although I didn't validate this)
(Or, I'd give my ack to simply deleting doc/device-tree-bindings/ so the redundant copy doesn't have to be maintained).

Hi,
On 14 December 2015 at 10:03, Stephen Warren swarren@wwwdotorg.org wrote:
On 12/14/2015 05:45 AM, Thomas Chou wrote:
Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Acked-by: Stephen Warren swarren@nvidia.com
(I assume that the new files are identical to the kernel versions, although I didn't validate this)
(Or, I'd give my ack to simply deleting doc/device-tree-bindings/ so the redundant copy doesn't have to be maintained).
I think we should keep it for now, until there is a separate repo and we have had some success upstreaming our bindings.
Regards, Simon

On 2015年12月15日 01:03, Stephen Warren wrote:
On 12/14/2015 05:45 AM, Thomas Chou wrote:
Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Acked-by: Stephen Warren swarren@nvidia.com
(I assume that the new files are identical to the kernel versions, although I didn't validate this)
Yes, they are exactly identical to the kernel versions.
(Or, I'd give my ack to simply deleting doc/device-tree-bindings/ so the redundant copy doesn't have to be maintained).
Best regards, Thomas

On 14 December 2015 at 05:45, Thomas Chou thomas@wytron.com.tw wrote:
Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Signed-off-by: Thomas Chou thomas@wytron.com.tw
doc/device-tree-bindings/serial/8250.txt | 66 +++++++++++++++++++ doc/device-tree-bindings/serial/ns16550.txt | 10 --- doc/device-tree-bindings/serial/omap_serial.txt | 33 ++++++++++ .../serial/snps-dw-apb-uart.txt | 76 ++++++++++++++++++++++ 4 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 doc/device-tree-bindings/serial/8250.txt delete mode 100644 doc/device-tree-bindings/serial/ns16550.txt create mode 100644 doc/device-tree-bindings/serial/omap_serial.txt create mode 100644 doc/device-tree-bindings/serial/snps-dw-apb-uart.txt
Reviewed-by: Simon Glass sjg@chromium.org

On Mon, Dec 14, 2015 at 08:45:08PM +0800, Thomas Chou wrote:
Replace ns16550.txt with binding files from Linux kernel. As suggested by Stephen Warren, we should keep the directory structure, filenames, and file content identical to the bindings in the Linux kernel.
Signed-off-by: Thomas Chou thomas@wytron.com.tw Acked-by: Stephen Warren swarren@nvidia.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (4)
-
Simon Glass
-
Stephen Warren
-
Thomas Chou
-
Tom Rini