serial: sc16is7xx: device tree improvements
Subsystems (2)
v2 cover serial: sc16is7xx: device tree improvements
From: Hugo Villeneuve <[email protected]>
Hello,
this patch series improves DT properties handling, and converts sc16is7xx bindings from text to YAML.
Patch 1 make sure we use the device_property APIs when configuring irda mode.
Patch 2 is the actual conversion of bindings to YAML. Conversion to YAML has been suggested by Andy Shevchenko during review for another patch series for the sc16is7xx:
Thank you.
Changes for V2:
- Fix YAML title entry (capitalize)
- Remove "|" from YAML clock-frequency property description
- Remove YAML labels from examples
- Fix reg warnings for YAML I2C examples
- Remove YAML clock-frequency type
- Set YAML gpio-controller property to true
- Remove redundant YAML clocks description
- Remove patches to add a 'nxp,' vendor prefix to 'irda-mode-ports' DT property (as suggested by Rob Herring)
Hugo Villeneuve (2):
serial: sc16is7xx: use device_property APIs when configuring irda mode
dt-bindings: sc16is7xx: convert to YAML
.../bindings/serial/nxp,sc16is7xx.txt | 118 ---------------- .../bindings/serial/nxp,sc16is7xx.yaml | 127 ++++++++++++++++++ drivers/tty/serial/sc16is7xx.c | 34 +++-- 3 files changed, 151 insertions(+), 128 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
base-commit: c980248179d655d33af47f0b0bec1ce8660994c6
Signature · 1 line
2.30.2
PATCH v2 1/2 serial: sc16is7xx: use device_property APIs when configuring irda mode
From: Hugo Villeneuve <[email protected]>
Convert driver to be property provider agnostic and allow it to be used on non-OF platforms.
--- drivers/tty/serial/sc16is7xx.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/tty/serial/sc16is7xx.c +24 -10
@@ -1408,6 +1408,29 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s) }#endif +static void sc16is7xx_setup_irda_ports (struct sc16is7xx_port *s) +{ +int i; +int ret; +int count; +u32 irda_port[2 ]; +struct device *dev = s->p[0 ].port.dev; + + count =device_property_count_u32 (dev,"irda-mode-ports" ); +if (count <0 || count >ARRAY_SIZE (irda_port)) +return ; + + ret =device_property_read_u32_array (dev,"irda-mode-ports" , + irda_port, count); +if (ret) +return ; + +for (i =0 ; i < count; i++) { +if (irda_port[i] < s->devtype->nr_uart) + s->p[irda_port[i]].irda_mode = true; + } +} +/* * Configure ports designated to operate as modem control lines. */
@@ -1590,16 +1613,7 @@ static int sc16is7xx_probe(struct device *dev,sc16is7xx_power (&s->p[i].port,0 ); } -if (dev->of_node) { -struct property *prop; -const __be32 *p; -u32 u; - -of_property_for_each_u32 (dev->of_node,"irda-mode-ports" , - prop, p, u) -if (u < devtype->nr_uart) - s->p[u].irda_mode = true; - } +sc16is7xx_setup_irda_ports (s); ret =sc16is7xx_setup_mctrl_ports (s);if (ret)
Signature · 1 line
2.30.2
PATCH v2 2/2 dt-bindings: sc16is7xx: convert to YAML
In reply to Hugo VilleneuveFrom: Hugo Villeneuve <[email protected]>
Convert binding from text format to YAML.
Additions to original text binding:
- add rs485 reference.
--- .../bindings/serial/nxp,sc16is7xx.txt | 118 ---------------- .../bindings/serial/nxp,sc16is7xx.yaml | 127 ++++++++++++++++++ 2 files changed, 127 insertions(+), 118 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt deleted +0 -118
@@ -1,118 +0,0 @@ -* NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART) -* i2c as bus - -Required properties: -- compatible: Should be one of the following: - - "nxp,sc16is740" for NXP SC16IS740, - - "nxp,sc16is741" for NXP SC16IS741, - - "nxp,sc16is750" for NXP SC16IS750, - - "nxp,sc16is752" for NXP SC16IS752, - - "nxp,sc16is760" for NXP SC16IS760, - - "nxp,sc16is762" for NXP SC16IS762. -- reg: I2C address of the SC16IS7xx device. -- interrupts: Should contain the UART interrupt -- clocks: Reference to the IC source clock. - OR (when there is no clock provider visible to the platform) -- clock-frequency: The source clock frequency for the IC. - -Optional properties: -- gpio-controller: Marks the device node as a GPIO controller. -- #gpio-cells: Should be two. The first cell is the GPIO number and - the second cell is used to specify the GPIO polarity: - 0 = active high, - 1 = active low. -- irda-mode-ports: An array that lists the indices of the port that - should operate in IrDA mode. -- nxp,modem-control-line-ports: An array that lists the indices of the port that - should have shared GPIO lines configured as - modem control lines. - -Example: - sc16is750: sc16is750@51 { - compatible = "nxp,sc16is750"; - reg = <0x51>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - gpio-controller; - #gpio-cells = <2>; - }; - - sc16is752: sc16is752@53 { - compatible = "nxp,sc16is752"; - reg = <0x53>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */ - gpio-controller; /* Port 0 as GPIOs */ - #gpio-cells = <2>; - }; - - sc16is752: sc16is752@54 { - compatible = "nxp,sc16is752"; - reg = <0x54>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */ - }; - -* spi as bus - -Required properties: -- compatible: Should be one of the following: - - "nxp,sc16is740" for NXP SC16IS740, - - "nxp,sc16is741" for NXP SC16IS741, - - "nxp,sc16is750" for NXP SC16IS750, - - "nxp,sc16is752" for NXP SC16IS752, - - "nxp,sc16is760" for NXP SC16IS760, - - "nxp,sc16is762" for NXP SC16IS762. -- reg: SPI chip select number. -- interrupts: Specifies the interrupt source of the parent interrupt - controller. The format of the interrupt specifier depends on the - parent interrupt controller. -- clocks: phandle to the IC source clock. - -Optional properties: -- gpio-controller: Marks the device node as a GPIO controller. -- #gpio-cells: Should be two. The first cell is the GPIO number and - the second cell is used to specify the GPIO polarity: - 0 = active high, - 1 = active low. -- irda-mode-ports: An array that lists the indices of the port that - should operate in IrDA mode. -- nxp,modem-control-line-ports: An array that lists the indices of the port that - should have shared GPIO lines configured as - modem control lines. - -Example: - sc16is750: sc16is750@0 { - compatible = "nxp,sc16is750"; - reg = <0>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - gpio-controller; - #gpio-cells = <2>; - }; - - sc16is752: sc16is752@1 { - compatible = "nxp,sc16is752"; - reg = <1>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */ - gpio-controller; /* Port 0 as GPIOs */ - #gpio-cells = <2>; - }; - - sc16is752: sc16is752@2 { - compatible = "nxp,sc16is752"; - reg = <2>; - clocks = <&clk20m>; - interrupt-parent = <&gpio3>; - interrupts = <7 IRQ_TYPE_EDGE_FALLING>; - nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */ - };
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH v2 2/2] dt-bindings: sc16is7xx: convert to YAML
Quoted 7 lines · Hugo Villeneuve
From: Hugo Villeneuve <[email protected]>
Convert binding from text format to YAML.
Additions to original text binding:
- add rs485 reference.
Quoted 8 lines
Signed-off-by Hugo Villeneuve <[email protected]>--- .../bindings/serial/nxp,sc16is7xx.txt | 118 ---------------- .../bindings/serial/nxp,sc16is7xx.yaml | 127 ++++++++++++++++++ 2 files changed, 127 insertions(+), 118 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml