2023-05-14 17:33:51

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 00/10] riscv: add Bouffalolab bl808 support

This series adds Bouffalolab uart driver and basic devicetrees for
Bouffalolab bl808 SoC and Sipeed M1s dock board.

Since v2:
- fix dt_binding_check and dtbs_check warnings
- use uart_port_tx_limited() helper in uart driver
- collect Acked-by/Reviewed-by tag
- uart0 -> uart3
- update "riscv,ndev" property
- mv vendor prefix binding as the first patch
- add compatible string for bouffalolab bl808 plic

Since v1:
- use FIELD_PREP and FIELD_GET macro
- rewrite bflb_uart_tx_chars()
- add vendor prefix for bouffalolab
- add dt binding for bl808 compatibles
- enable SOC_BOUFFALOLAB in defconfig
- collect Reviewed-by tag
- modify commit-msg as suggested


Jisheng Zhang (10):
dt-bindings: vendor-prefixes: add bouffalolab
dt-bindings: interrupt-controller: Add bouffalolab bl808 plic
dt-bindings: serial: add documentation for Bouffalolab UART Driver
serial: bflb_uart: add Bouffalolab UART Driver
riscv: add the Bouffalolab SoC family Kconfig option
dt-bindings: riscv: Add bouffalolab bl808 board compatibles
riscv: dts: bouffalolab: add the bl808 SoC base device tree
riscv: dts: bouffalolab: add Sipeed M1s SoM and Dock devicetree
MAINTAINERS: riscv: add entry for Bouffalolab SoC
riscv: defconfig: enable BOUFFALOLAB SoC

.../sifive,plic-1.0.0.yaml | 1 +
.../bindings/riscv/bouffalolab.yaml | 29 +
.../serial/bouffalolab,bl808-uart.yaml | 47 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
MAINTAINERS | 7 +
arch/riscv/Kconfig.socs | 5 +
arch/riscv/boot/dts/Makefile | 1 +
arch/riscv/boot/dts/bouffalolab/Makefile | 2 +
.../dts/bouffalolab/bl808-sipeed-m1s-dock.dts | 25 +
.../dts/bouffalolab/bl808-sipeed-m1s.dtsi | 21 +
arch/riscv/boot/dts/bouffalolab/bl808.dtsi | 73 +++
arch/riscv/configs/defconfig | 1 +
drivers/tty/serial/Kconfig | 18 +
drivers/tty/serial/Makefile | 1 +
drivers/tty/serial/bflb_uart.c | 586 ++++++++++++++++++
include/uapi/linux/serial_core.h | 3 +
16 files changed, 822 insertions(+)
create mode 100644 Documentation/devicetree/bindings/riscv/bouffalolab.yaml
create mode 100644 Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml
create mode 100644 arch/riscv/boot/dts/bouffalolab/Makefile
create mode 100644 arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s-dock.dts
create mode 100644 arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s.dtsi
create mode 100644 arch/riscv/boot/dts/bouffalolab/bl808.dtsi
create mode 100644 drivers/tty/serial/bflb_uart.c

--
2.40.0



2023-05-14 17:34:03

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 07/10] riscv: dts: bouffalolab: add the bl808 SoC base device tree

Add a baisc dtsi for the bouffalolab bl808 SoC.

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
---
arch/riscv/boot/dts/bouffalolab/bl808.dtsi | 73 ++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 arch/riscv/boot/dts/bouffalolab/bl808.dtsi

diff --git a/arch/riscv/boot/dts/bouffalolab/bl808.dtsi b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
new file mode 100644
index 000000000000..b1132b8cf9e8
--- /dev/null
+++ b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2022 Jisheng Zhang <[email protected]>
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+ compatible = "bouffalolab,bl808";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cpus {
+ timebase-frequency = <1000000>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu0: cpu@0 {
+ compatible = "thead,c906", "riscv";
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-block-size = <64>;
+ d-cache-sets = <256>;
+ d-cache-size = <32768>;
+ i-cache-block-size = <64>;
+ i-cache-sets = <128>;
+ i-cache-size = <32768>;
+ mmu-type = "riscv,sv39";
+ riscv,isa = "rv64imafdc";
+
+ cpu0_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <1>;
+ };
+ };
+ };
+
+ xtal: xtal-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ /* This value must be overridden by the board */
+ clock-frequency = <0>;
+ };
+
+ soc {
+ compatible = "simple-bus";
+ ranges;
+ interrupt-parent = <&plic>;
+ dma-noncoherent;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ uart3: serial@30002000 {
+ compatible = "bouffalolab,bl808-uart";
+ reg = <0x30002000 0x1000>;
+ interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&xtal>;
+ status = "disabled";
+ };
+
+ plic: interrupt-controller@e0000000 {
+ compatible = "bouffalolab,bl808-plic", "thead,c900-plic";
+ reg = <0xe0000000 0x4000000>;
+ interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ riscv,ndev = <82>;
+ };
+ };
+};
--
2.40.0


2023-05-14 18:05:32

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver

Add bindings doc for Bouffalolab UART Driver

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
---
.../serial/bouffalolab,bl808-uart.yaml | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml

diff --git a/Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml b/Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml
new file mode 100644
index 000000000000..e1c2c8ac88ab
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Jisheng Zhang <[email protected]>
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/bouffalolab,uart.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bouffalolab UART Controller
+
+maintainers:
+ - Jisheng Zhang <[email protected]>
+
+allOf:
+ - $ref: serial.yaml#
+
+properties:
+ compatible:
+ const: bouffalolab,bl808-uart
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ uart0: serial@30002000 {
+ compatible = "bouffalolab,bl808-uart";
+ reg = <0x30002000 0x1000>;
+ interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&xtal>;
+ };
+...
--
2.40.0


2023-05-14 18:07:00

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 01/10] dt-bindings: vendor-prefixes: add bouffalolab

In the following commits, we will support bl808 SoC which is from
Bouffalo Lab Technology (Nanjing) Co., Ltd.

Add bouffalolab vendor prefix binding.

Link: https://en.bouffalolab.com/
Signed-off-by: Jisheng Zhang <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 82d39ab0231b..3566346f2f9e 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -200,6 +200,8 @@ patternProperties:
description: BOE Technology Group Co., Ltd.
"^bosch,.*":
description: Bosch Sensortec GmbH
+ "^bouffalolab,.*":
+ description: Bouffalo Lab Technology (Nanjing) Co., Ltd.
"^boundary,.*":
description: Boundary Devices Inc.
"^brcm,.*":
--
2.40.0


2023-05-14 18:08:27

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 06/10] dt-bindings: riscv: Add bouffalolab bl808 board compatibles

Several SoMs and boards are available that feature the Bouffalolab
bl808 SoC. Document the compatible strings.

Signed-off-by: Jisheng Zhang <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
---
.../bindings/riscv/bouffalolab.yaml | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/riscv/bouffalolab.yaml

diff --git a/Documentation/devicetree/bindings/riscv/bouffalolab.yaml b/Documentation/devicetree/bindings/riscv/bouffalolab.yaml
new file mode 100644
index 000000000000..3b25d1a5d04a
--- /dev/null
+++ b/Documentation/devicetree/bindings/riscv/bouffalolab.yaml
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/riscv/bouffalolab.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bouffalo Lab Technology SoC-based boards
+
+maintainers:
+ - Jisheng Zhang <[email protected]>
+
+description:
+ Bouffalo Lab Technology SoC-based boards
+
+properties:
+ $nodename:
+ const: '/'
+ compatible:
+ oneOf:
+ - description: Carrier boards for the Sipeed M1s SoM
+ items:
+ - enum:
+ - sipeed,m1s-dock
+ - const: sipeed,m1s
+ - const: bouffalolab,bl808
+
+additionalProperties: true
+
+...
--
2.40.0


2023-05-14 18:32:08

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver

On Mon, May 15, 2023 at 12:56:44AM +0800, Jisheng Zhang wrote:

> +$id: http://devicetree.org/schemas/serial/bouffalolab,uart.yaml#

$id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/serial/bouffalolab,bl808-uart.yaml#

Please test the bindings before submission - even dtbs_check catches
that one!
Otherwise, looks fine.

Thanks,
Conor.


Attachments:
(No filename) (415.00 B)
signature.asc (235.00 B)
Download all attachments

2023-05-14 19:09:47

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 06/10] dt-bindings: riscv: Add bouffalolab bl808 board compatibles

On Mon, May 15, 2023 at 12:56:47AM +0800, Jisheng Zhang wrote:

> +title: Bouffalo Lab Technology SoC-based boards

I know you're only propagating an existing pattern, but the "SoC-based"
looks rather odd!

> +properties:
> + $nodename:
> + const: '/'
> + compatible:
> + oneOf:
> + - description: Carrier boards for the Sipeed M1s SoM
> + items:
> + - enum:
> + - sipeed,m1s-dock

BTW, do you know of any other m1s compatible docks?
I couldn't find any other ones via Google, so maybe it is just worth
swapping the enum here for another const.
Either is fine by me though.
Reviewed-by: Conor Dooley <[email protected]>

Thanks,
Conor.


Attachments:
(No filename) (712.00 B)
signature.asc (235.00 B)
Download all attachments

2023-05-15 01:09:11

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver

On Sun, May 14, 2023 at 07:17:27PM +0100, Conor Dooley wrote:
> On Mon, May 15, 2023 at 12:56:44AM +0800, Jisheng Zhang wrote:
>
> > +$id: http://devicetree.org/schemas/serial/bouffalolab,uart.yaml#
>
> $id: relative path/filename doesn't match actual path or filename
> expected: http://devicetree.org/schemas/serial/bouffalolab,bl808-uart.yaml#
>
> Please test the bindings before submission - even dtbs_check catches
> that one!

Aha, I knew the reason. I did run dt_binding_check and dtbs_check,
but then I read one of comments in v2 which suggests the renaming,
that's to say the dtbs_check is done before the renmaing. Sorry for
confusion


2023-05-15 07:32:24

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver

On Mon, 15 May 2023 00:56:44 +0800, Jisheng Zhang wrote:
> Add bindings doc for Bouffalolab UART Driver
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> Acked-by: Palmer Dabbelt <[email protected]>
> ---
> .../serial/bouffalolab,bl808-uart.yaml | 47 +++++++++++++++++++
> 1 file changed, 47 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
./Documentation/devicetree/bindings/serial/bouffalolab,bl808-uart.yaml: $id: relative path/filename doesn't match actual path or filename
expected: http://devicetree.org/schemas/serial/bouffalolab,bl808-uart.yaml#

See https://patchwork.ozlabs.org/patch/1781053

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.

2023-05-15 17:33:18

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver

On Mon, May 15, 2023 at 07:28:10AM +0800, Jisheng Zhang wrote:
> On Sun, May 14, 2023 at 07:17:27PM +0100, Conor Dooley wrote:
> > On Mon, May 15, 2023 at 12:56:44AM +0800, Jisheng Zhang wrote:
> >
> > > +$id: http://devicetree.org/schemas/serial/bouffalolab,uart.yaml#
> >
> > $id: relative path/filename doesn't match actual path or filename
> > expected: http://devicetree.org/schemas/serial/bouffalolab,bl808-uart.yaml#
> >
> > Please test the bindings before submission - even dtbs_check catches
> > that one!
>
> Aha, I knew the reason. I did run dt_binding_check and dtbs_check,
> but then I read one of comments in v2 which suggests the renaming,
> that's to say the dtbs_check is done before the renmaing. Sorry for
> confusion

No worries.
Serial aisde, rest of the series looks grand to me, perhaps you want to
resubmit the serial bits separately & I'll grab the riscv bits once the
serial side is sorted out?


Attachments:
(No filename) (954.00 B)
signature.asc (235.00 B)
Download all attachments

2023-05-18 16:18:26

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH v3 06/10] dt-bindings: riscv: Add bouffalolab bl808 board compatibles

On Sun, May 14, 2023 at 07:39:28PM +0100, Conor Dooley wrote:
> On Mon, May 15, 2023 at 12:56:47AM +0800, Jisheng Zhang wrote:
>
> > +title: Bouffalo Lab Technology SoC-based boards
>
> I know you're only propagating an existing pattern, but the "SoC-based"
> looks rather odd!
>
> > +properties:
> > + $nodename:
> > + const: '/'
> > + compatible:
> > + oneOf:
> > + - description: Carrier boards for the Sipeed M1s SoM
> > + items:
> > + - enum:
> > + - sipeed,m1s-dock
>
> BTW, do you know of any other m1s compatible docks?
> I couldn't find any other ones via Google, so maybe it is just worth

FWICT, there's no other m1s compatible docks, but in theory the SoM
can be used to build different docks, I just keep it as is since you
are fine with it too ;)

> swapping the enum here for another const.
> Either is fine by me though.
> Reviewed-by: Conor Dooley <[email protected]>
>
> Thanks,
> Conor.