From patchwork Thu May 18 15:22:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246991 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 229C1C7EE2A for ; Thu, 18 May 2023 15:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2AtHOqxA/hamg7HccbNEMniDPYL4L92Hyw5st9oITag=; b=j31PZj1DMoBXCP fXQNgsWWlEU5REVLvdV4WbEEHwP0WmwoYPxy1O9TrkHLuYaLx4lndbWIKjP6pJoeKovePJT6Q0bHv QOz5GFQscW6b21cN2PhBX12wdOk5uGM+d25XlyQzJYwly4+YyyTqXTkZy2GbAHGejUcf4Ri0G/UE8 dKP0PIFBhdIvVAGo81tJpamyXWGS0ysPdT3sHJN1q2tJ+hmpDqyLqtdzqeSV3jC38k4Pnobcpbsd7 tNNBNQmkg/1OgQAIimqhROTkDJKwPLMNWgkwPnmzE8ZQb7whqqwSqwgZOYHBXj8cNJmvD02B6nHVX h2qHIINIkT+y9gHW1ZvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdl-00DJps-0d; Thu, 18 May 2023 15:34:05 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdi-00DJp2-1m for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:03 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CA196503E; Thu, 18 May 2023 15:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D3FC433A1; Thu, 18 May 2023 15:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424040; bh=8o3w2PNumfMmW1nsxUiJwSK+1Wm7LHqx/wBqf4PFRQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUPCod8nmuFnBbgzwj18nPIcjTiXQu7I1k69OCF5REnqW7VzJIiOiHKg/4CwGx5Gz C086refVmixdfnGDGUXEccsOtrGlLURjLOe02aMuDMNmeZdAu999a0k0EeLYb++Ro0 Fh4BCqA7yo9rbf0O0INt0BRGWTdqM1bZy7yu0cabzvXog4JDImknRCe5jHnzt4lytZ KanHpnCUPmbfWFXf2hav/+kZ51HIGuOSRDW9HgKAtLzTHU3kxRBUr0AAOvSqlaKk6G wEa2xAdvIdoyYZ3Idna2IhUQVsKogjGrgkGtXx7MWOMVW/7zVvJB75fHeUthntzb4P avLs2VGEGiJaQ== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH v4 01/10] dt-bindings: vendor-prefixes: add bouffalolab Date: Thu, 18 May 2023 23:22:35 +0800 Message-Id: <20230518152244.2178-2-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083402_624637_94C9D169 X-CRM114-Status: UNSURE ( 9.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Conor Dooley Acked-by: Palmer Dabbelt Acked-by: Rob Herring --- 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,.*": From patchwork Thu May 18 15:22:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246992 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 966D6C7EE2A for ; Thu, 18 May 2023 15:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9I2szBUMjtJh2/nMndo0+7PjDJZ/L6MRWFjMVKLbvRM=; b=ayo0asRXOZED9w cJEr7cmJ0ZweZ0ilzBa+R4KmW+qyc2dif6vF2/0qrBtm5u9thCJ499qKtiA3d9YfB9MSPVV+weFM3 hyHiLrXc6ME6bom2CpvKSwKsr4Jbtd3j3gJ6zho/jA0Hyv2mOC7O+IiRT36yP7X2BCHxrz7w1TVM0 PcJnGIK77Twa1aKQ7m9LbwKwBraG1sdmyUEIYmq6fP8homvubu2bmrAArAis5Gi1KRHPbwJ3DPFJy sDVXadlw5lW75C2yr/LCM0cPaqRvPB84KIw87mHSFmOWGgVKuzf28z5CPDP1TOasSdqeXV7/fXkzv in4tK7YGQPQL3REOExAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdo-00DJqv-2c; Thu, 18 May 2023 15:34:08 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdl-00DJq6-2B for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:06 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 375CE65031; Thu, 18 May 2023 15:34:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D11CC4331E; Thu, 18 May 2023 15:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424044; bh=KhFw35m2V23D8HN1ygBHKhI3EF8W0NOzCuztPIKnTsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eA5EP9a1EX/AL2Rh89oknsf07RsvGhH0fkq99Wh0HqheV9G2opvXh8AM1iH+9Hk0t 5cxAavTGlnMBVhWpZ1xdTQq2+RzQoeFcOF6K4D8e55+z6KxUsNdH9r1zIyC7arsXZz xADm/rl5Yt96RPBn0sHDazRCrtRqHuUQNHMRtxLCqq5Zzlgcwy91f3f1DOjKeTH5XZ VJDmoiMdlon5zkAcRRhzW29xrKUYtCXe+Pk0o3emqgHlldE7oFRVNgL2C+kA+FQ8zb Rewx5sL4c3kLfMHVl/1jlJK/6Uf3J1fPqvz/jUJfCkXZIjLdatRL7PcfyBM7LmrGTP m8B7xxb1Fetlg== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Conor Dooley Subject: [PATCH v4 02/10] dt-bindings: interrupt-controller: Add bouffalolab bl808 plic Date: Thu, 18 May 2023 23:22:36 +0800 Message-Id: <20230518152244.2178-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083405_755975_095A343B X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add compatible string for bouffalolab bl808 plic. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley Reviewed-by: Samuel Holland --- .../bindings/interrupt-controller/sifive,plic-1.0.0.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml index f75736a061af..3f9439b0c163 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml @@ -65,6 +65,7 @@ properties: - items: - enum: - allwinner,sun20i-d1-plic + - bouffalolab,bl808-plic - const: thead,c900-plic - items: - const: sifive,plic-1.0.0 From patchwork Thu May 18 15:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246993 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55133C77B7A for ; Thu, 18 May 2023 15:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b5sQrDIFl54PH3kXO7lgokqGqaMgJgayrPueF8ezp+o=; b=DagwA2vkicBv7P lMOwBd0Sop/J9VyfrLeF9rbf6ccJ/cIEU3XP2cB6NOE5FlBB9hf+ycexA3Yzua5QF7i02R/HYk4uy KTLISykbGKsxN4kXLreb0cUvUC7Gp/sdBg4LF1Bw+AuD+kfz3jngRCwyE1BBbPHyXB4+uoozixM/s Kw9yC3IBFrYeI30oA3w2PcRznJZWLXMd11KQbrXj356Z1dTzpuLULYjwL3pCWgX7m2lEaJN3ik/27 2R09CP8RTzb/rhhISd6zIn2YtIUg8cNmH0jBqUIDvHHPDiZjdRoXKgsv1RZIRZKD/JV4Sv/FfVWYn xRx1QcEBwLrwJXOZDGqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfds-00DJsL-1O; Thu, 18 May 2023 15:34:12 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdp-00DJrP-2v for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:11 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 584F864534; Thu, 18 May 2023 15:34:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CA78C433D2; Thu, 18 May 2023 15:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424048; bh=zFBld/tZ7AocfQGxbusrEecyvSpoa50rSwNlH5iRWjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XitzRxz5Rw0UPEAf7onUmdsyr6vVL8LorK/a66OO02ggd2WVcaL4WokSqmKOZqkhP zZou1910bYLnFvJYJqMxtyPGX//KwAubDr0a/RBZsT9IYwitdjKWhHMev2b9mX/S01 9JsJkceJx50s3wF8p3q0N3jSu/CW0TCJmOKOy/ZF+iCENJfeFKEEkDsd/HIjuMcTgi PmhRUjNNM3y//fdiu2DK1qpQMC4DruKIm5CZW/DAUzOVv08ngc3MV+AJLzSoqfJFet GhU/RPQGMYyvkRZK5Y8ix0R9+j7KUuv/0Js3IpI/8nOGfo88SnYUOf1myVOGJrNLb9 2cjJFZjKRK4gQ== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Palmer Dabbelt Subject: [PATCH v4 03/10] dt-bindings: serial: add documentation for Bouffalolab UART Driver Date: Thu, 18 May 2023 23:22:37 +0800 Message-Id: <20230518152244.2178-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083409_988432_8D1AFED5 X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add bindings doc for Bouffalolab UART Driver Signed-off-by: Jisheng Zhang Acked-by: Palmer Dabbelt Reviewed-by: Conor Dooley --- .../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..0ef858e50efb --- /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 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/bouffalolab,bl808-uart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bouffalolab UART Controller + +maintainers: + - Jisheng Zhang + +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 + + uart0: serial@30002000 { + compatible = "bouffalolab,bl808-uart"; + reg = <0x30002000 0x1000>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&xtal>; + }; +... From patchwork Thu May 18 15:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246994 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49E32C77B7A for ; Thu, 18 May 2023 15:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+dsgqxwBrqN3mHXq/yJhR/N6euRhaI1yrY5qIpHaO5M=; b=NDpQGwltkTYwTS 4+aeoIVPuzLjAgVf0UkSlXBCkuE+CAwdac8B5j24dsAiHUpgAsLexalTZra/jFxqXhDe3M4JxGipr K+oRRxOwHPuERTXwGs9HnQun3i0KaA+LMd4iCg0OM1NkW84MwF1QMi4iJmq34wjtjE+UIR8gVBuBp I5yphh94D0lNAQHYoRNPVCzr8f0jbXbOSN5GEoabnAg5Wk80HodJYSb/RUQ3AB3lfVQCJxl4vO8EJ gSBMrIGpZTeBCzJXPIPn646ggOD5ly2Cz2B7VeIF7FP/qFuJyd79Cq/6yjZxVDLLYvSTPAGfC8Gf/ DIFkZJ6ox0c76yM8249w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdx-00DJuo-0U; Thu, 18 May 2023 15:34:17 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdt-00DJsz-2M for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:16 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2724965028; Thu, 18 May 2023 15:34:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2ACCC4339E; Thu, 18 May 2023 15:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424052; bh=Ik9a/pOpVq3VRm0rIlpIiP6uAAc66FLi4+A5HDVjeRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUWFXZt89Kpp/QVGWQrXZ37jLI1umGW1FARv1t0IhyhEQdzoO2QRyi1oYu9Mu0EIG ETaEYdAu+jc107fyODdCHQ9KcF5JiVYZOFaWxZcpxNQxggwLuVODvutMCSRVqyB+eC QsBWoNEsGBaYOkRvPVbFvEgaPCl78dzfQ3Iby6/68BADQCXhw7KN+k2IWFwDkp4oLK JTcbsP7xvnUzrIEx5YSoiZuZtfC04rG3oKUtfuBRHTyy8h7TKbONB+r4n6QWCKO7Ne s/DZI377o4sJAVda7yV+PY/FPZjXFO8MXQxAyDzUgdkUTUr2uGxSgpg/aJxUPsXNeu LSxpyi+g/kwDg== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v4 04/10] serial: bflb_uart: add Bouffalolab UART Driver Date: Thu, 18 May 2023 23:22:38 +0800 Message-Id: <20230518152244.2178-5-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083413_855089_3FC39DD9 X-CRM114-Status: GOOD ( 25.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add the driver for Bouffalolab UART IP which is found in Bouffalolab SoCs such as bl808. UART driver probe will create path named "/dev/ttySx". Signed-off-by: Jisheng Zhang --- drivers/tty/serial/Kconfig | 18 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/bflb_uart.c | 586 +++++++++++++++++++++++++++++++ include/uapi/linux/serial_core.h | 3 + 4 files changed, 608 insertions(+) create mode 100644 drivers/tty/serial/bflb_uart.c diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 398e5aac2e77..abc30a0713f5 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -179,6 +179,24 @@ config SERIAL_ATMEL_TTYAT Say Y if you have an external 8250/16C550 UART. If unsure, say N. +config SERIAL_BFLB + tristate "Bouffalolab serial port support" + select SERIAL_CORE + depends on COMMON_CLK + help + This enables the driver for the Bouffalolab's serial. + +config SERIAL_BFLB_CONSOLE + bool "Support for console on Bouffalolab serial port" + depends on SERIAL_BFLB=y + select SERIAL_CORE_CONSOLE + select SERIAL_EARLYCON + help + Say Y here if you wish to use a Bouffalolab UART as the + system console (the system console is the device which + receives all kernel messages and warnings and which allows + logins in single user mode) as /dev/ttySn. + config SERIAL_KGDB_NMI bool "Serial console over KGDB NMI debugger port" depends on KGDB_SERIAL_CONSOLE diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index cd9afd9e3018..5788a708d327 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_SERIAL_8250) += 8250/ obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_SERIAL_BFLB) += bflb_uart.o obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o obj-$(CONFIG_SERIAL_PXA_NON8250) += pxa.o obj-$(CONFIG_SERIAL_SA1100) += sa1100.o diff --git a/drivers/tty/serial/bflb_uart.c b/drivers/tty/serial/bflb_uart.c new file mode 100644 index 000000000000..3f80bba8599a --- /dev/null +++ b/drivers/tty/serial/bflb_uart.c @@ -0,0 +1,586 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Based on bflb_uart.c, by Bouffalolab team + * + * Copyright (C) 2022 Jisheng Zhang + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define UART_UTX_CONFIG 0x00 +#define UART_CR_UTX_EN BIT(0) +#define UART_CR_UTX_CTS_EN BIT(1) +#define UART_CR_UTX_FRM_EN BIT(2) +#define UART_CR_UTX_PRT_EN BIT(4) +#define UART_CR_UTX_PRT_SEL BIT(5) +#define UART_CR_UTX_BIT_CNT_D_MSK GENMASK(10, 8) +#define UART_CR_UTX_BIT_CNT_P_MSK GENMASK(12, 11) +#define UART_URX_CONFIG 0x04 +#define UART_CR_URX_EN BIT(0) +#define UART_CR_URX_PRT_EN BIT(4) +#define UART_CR_URX_PRT_SEL BIT(5) +#define UART_CR_URX_BIT_CNT_D_MSK GENMASK(10, 8) +#define UART_BIT_PRD 0x08 +#define UART_CR_UTX_BIT_PRD_MSK GENMASK(15, 0) +#define UART_CR_URX_BIT_PRD_MSK GENMASK(31, 16) +#define UART_DATA_CONFIG 0x0c +#define UART_CR_UART_BIT_INV BIT(0) +#define UART_URX_RTO_TIMER 0x18 +#define UART_CR_URX_RTO_VALUE_MSK GENMASK(7, 0) +#define UART_SW_MODE 0x1c +#define UART_INT_STS 0x20 +#define UART_UTX_END_INT BIT(0) +#define UART_URX_END_INT BIT(1) +#define UART_UTX_FIFO_INT BIT(2) +#define UART_URX_FIFO_INT BIT(3) +#define UART_URX_RTO_INT BIT(4) +#define UART_URX_PCE_INT BIT(5) +#define UART_UTX_FER_INT BIT(6) +#define UART_URX_FER_INT BIT(7) +#define UART_URX_LSE_INT BIT(8) +#define UART_INT_MASK 0x24 +#define UART_INT_CLEAR 0x28 +#define UART_INT_EN 0x2c +#define UART_STATUS 0x30 +#define UART_STS_UTX_BUS_BUSY BIT(0) +#define UART_FIFO_CONFIG_0 0x80 +#define UART_DMA_TX_EN BIT(0) +#define UART_DMA_RX_EN BIT(1) +#define UART_TX_FIFO_CLR BIT(2) +#define UART_RX_FIFO_CLR BIT(3) +#define UART_TX_FIFO_OVERFLOW BIT(4) +#define UART_TX_FIFO_UNDERFLOW BIT(5) +#define UART_RX_FIFO_OVERFLOW BIT(6) +#define UART_RX_FIFO_UNDERFLOW BIT(7) +#define UART_FIFO_CONFIG_1 0x84 +#define UART_TX_FIFO_CNT_MSK GENMASK(5, 0) +#define UART_RX_FIFO_CNT_MSK GENMASK(13, 8) +#define UART_TX_FIFO_TH_MSK GENMASK(20, 16) +#define UART_RX_FIFO_TH_MSK GENMASK(28, 24) +#define UART_FIFO_WDATA 0x88 +#define UART_FIFO_RDATA 0x8c +#define UART_FIFO_RDATA_MSK GENMASK(7, 0) + +#define BFLB_UART_MAXPORTS 8 +#define BFLB_UART_BAUD 2000000 +#define BFLB_UART_RX_FIFO_TH 7 +#define BFLB_UART_TX_FIFO_TH 15 +#define BFLB_UART_URX_RTO_TIME 0x4f + +struct bflb_uart_port { + struct uart_port port; + struct clk *clk; +}; + +static struct bflb_uart_port *bflb_uart_ports[BFLB_UART_MAXPORTS]; + +static inline u32 rdl(struct uart_port *port, u32 reg) +{ + return readl_relaxed(port->membase + reg); +} + +static inline void wrl(struct uart_port *port, u32 reg, u32 value) +{ + writel_relaxed(value, port->membase + reg); +} + +static inline void wrb(struct uart_port *port, u32 reg, u8 value) +{ + writeb_relaxed(value, port->membase + reg); +} + +static unsigned int bflb_uart_tx_empty(struct uart_port *port) +{ + return (rdl(port, UART_FIFO_CONFIG_1) & UART_TX_FIFO_CNT_MSK) ? TIOCSER_TEMT : 0; +} + +static unsigned int bflb_uart_get_mctrl(struct uart_port *port) +{ + return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; +} + +static void bflb_uart_set_mctrl(struct uart_port *port, unsigned int sigs) +{ +} + +static void bflb_uart_start_tx(struct uart_port *port) +{ + u32 val; + + val = rdl(port, UART_UTX_CONFIG); + val |= UART_CR_UTX_EN; + wrl(port, UART_UTX_CONFIG, val); + + val = rdl(port, UART_FIFO_CONFIG_1); + val &= ~UART_TX_FIFO_TH_MSK; + val |= FIELD_PREP(UART_TX_FIFO_TH_MSK, BFLB_UART_TX_FIFO_TH); + wrl(port, UART_FIFO_CONFIG_1, val); + + val = rdl(port, UART_INT_MASK); + val &= ~UART_UTX_FIFO_INT; + wrl(port, UART_INT_MASK, val); +} + +static void bflb_uart_stop_tx(struct uart_port *port) +{ + u32 val; + + val = rdl(port, UART_INT_MASK); + val |= UART_UTX_FIFO_INT; + wrl(port, UART_INT_MASK, val); +} + +static void bflb_uart_stop_rx(struct uart_port *port) +{ + u32 val; + + val = rdl(port, UART_URX_CONFIG); + val &= ~UART_CR_URX_EN; + wrl(port, UART_URX_CONFIG, val); + + val = rdl(port, UART_INT_MASK); + val |= UART_URX_FIFO_INT | UART_URX_RTO_INT | UART_URX_FER_INT; + wrl(port, UART_INT_MASK, val); +} + +static void bflb_uart_set_termios(struct uart_port *port, + struct ktermios *termios, + const struct ktermios *old) +{ + unsigned long flags; + u32 valt, valr, val; + unsigned int baud, min; + + spin_lock_irqsave(&port->lock, flags); + + /* set data length */ + val = tty_get_char_size(termios->c_cflag) - 1; + valt = FIELD_PREP(UART_CR_UTX_BIT_CNT_D_MSK, val); + + /* calculate parity */ + termios->c_cflag &= ~CMSPAR; /* no support mark/space */ + if (termios->c_cflag & PARENB) { + valt |= UART_CR_UTX_PRT_EN; + if (termios->c_cflag & PARODD) + valt |= UART_CR_UTX_PRT_SEL; + } + + valr = valt; + + /* calculate stop bits */ + if (termios->c_cflag & CSTOPB) + val = 2; + else + val = 1; + valt |= FIELD_PREP(UART_CR_UTX_BIT_CNT_P_MSK, val); + + /* flow control */ + if (termios->c_cflag & CRTSCTS) + valt |= UART_CR_UTX_CTS_EN; + + /* enable TX freerunning mode */ + valt |= UART_CR_UTX_FRM_EN; + + valt |= UART_CR_UTX_EN; + valr |= UART_CR_URX_EN; + + wrl(port, UART_UTX_CONFIG, valt); + wrl(port, UART_URX_CONFIG, valr); + + min = port->uartclk / (UART_CR_UTX_BIT_PRD_MSK + 1); + baud = uart_get_baud_rate(port, termios, old, min, 4000000); + + val = DIV_ROUND_CLOSEST(port->uartclk, baud) - 1; + val = FIELD_PREP(UART_CR_UTX_BIT_PRD_MSK, val); + val |= FIELD_PREP(UART_CR_URX_BIT_PRD_MSK, val); + wrl(port, UART_BIT_PRD, val); + + uart_update_timeout(port, termios->c_cflag, baud); + + spin_unlock_irqrestore(&port->lock, flags); +} + +static void bflb_uart_rx_chars(struct uart_port *port) +{ + u8 ch; + + while (rdl(port, UART_FIFO_CONFIG_1) & UART_RX_FIFO_CNT_MSK) { + ch = FIELD_GET(UART_FIFO_RDATA_MSK, rdl(port, UART_FIFO_RDATA)); + port->icount.rx++; + + if (uart_handle_sysrq_char(port, ch)) + continue; + uart_insert_char(port, 0, 0, ch, TTY_NORMAL); + } + + spin_unlock(&port->lock); + tty_flip_buffer_push(&port->state->port); + spin_lock(&port->lock); +} + +static void bflb_uart_tx_chars(struct uart_port *port) +{ + u8 ch; + + uart_port_tx_limited(port, ch, BFLB_UART_TX_FIFO_TH, + true, + wrl(port, UART_FIFO_WDATA, ch), + ({})); +} + +static irqreturn_t bflb_uart_interrupt(int irq, void *data) +{ + struct uart_port *port = data; + u32 isr, val; + + isr = rdl(port, UART_INT_STS); + wrl(port, UART_INT_CLEAR, isr); + + spin_lock(&port->lock); + + if (isr & UART_URX_FER_INT) { + /* RX FIFO error interrupt */ + val = rdl(port, UART_FIFO_CONFIG_0); + if (val & UART_RX_FIFO_OVERFLOW) + port->icount.overrun++; + + val |= UART_RX_FIFO_CLR; + wrl(port, UART_FIFO_CONFIG_0, val); + } + + if (isr & (UART_URX_FIFO_INT | UART_URX_RTO_INT)) + bflb_uart_rx_chars(port); + + if (isr & UART_UTX_FIFO_INT) + bflb_uart_tx_chars(port); + + spin_unlock(&port->lock); + + return IRQ_RETVAL(isr); +} + +static void bflb_uart_config_port(struct uart_port *port, int flags) +{ + port->type = PORT_BFLB; +} + +static int bflb_uart_startup(struct uart_port *port) +{ + unsigned long flags; + int ret; + u32 val; + + ret = devm_request_irq(port->dev, port->irq, bflb_uart_interrupt, + IRQF_SHARED, port->name, port); + if (ret) { + dev_err(port->dev, "fail to request serial irq %d, ret=%d\n", + port->irq, ret); + return ret; + } + + spin_lock_irqsave(&port->lock, flags); + + wrl(port, UART_INT_MASK, ~0); + + wrl(port, UART_DATA_CONFIG, 0); + wrl(port, UART_SW_MODE, 0); + wrl(port, UART_URX_RTO_TIMER, FIELD_PREP(UART_CR_URX_RTO_VALUE_MSK, BFLB_UART_URX_RTO_TIME)); + + val = rdl(port, UART_FIFO_CONFIG_1); + val &= ~UART_RX_FIFO_TH_MSK; + val |= FIELD_PREP(UART_RX_FIFO_TH_MSK, BFLB_UART_RX_FIFO_TH); + wrl(port, UART_FIFO_CONFIG_1, val); + + /* Unmask RX interrupts now */ + val = rdl(port, UART_INT_MASK); + val &= ~(UART_URX_FIFO_INT | UART_URX_RTO_INT | UART_URX_FER_INT); + wrl(port, UART_INT_MASK, val); + + val = rdl(port, UART_UTX_CONFIG); + val |= UART_CR_UTX_EN; + wrl(port, UART_UTX_CONFIG, val); + val = rdl(port, UART_URX_CONFIG); + val |= UART_CR_URX_EN; + wrl(port, UART_URX_CONFIG, val); + + spin_unlock_irqrestore(&port->lock, flags); + + return 0; +} + +static void bflb_uart_shutdown(struct uart_port *port) +{ + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); + /* mask all interrupts now */ + wrl(port, UART_INT_MASK, ~0); + spin_unlock_irqrestore(&port->lock, flags); +} + +static const char *bflb_uart_type(struct uart_port *port) +{ + return (port->type == PORT_BFLB) ? "BFLB UART" : NULL; +} + +static int bflb_uart_verify_port(struct uart_port *port, + struct serial_struct *ser) +{ + if (ser->type != PORT_UNKNOWN && ser->type != PORT_BFLB) + return -EINVAL; + return 0; +} + +static const struct uart_ops bflb_uart_ops = { + .tx_empty = bflb_uart_tx_empty, + .get_mctrl = bflb_uart_get_mctrl, + .set_mctrl = bflb_uart_set_mctrl, + .start_tx = bflb_uart_start_tx, + .stop_tx = bflb_uart_stop_tx, + .stop_rx = bflb_uart_stop_rx, + .startup = bflb_uart_startup, + .shutdown = bflb_uart_shutdown, + .set_termios = bflb_uart_set_termios, + .type = bflb_uart_type, + .config_port = bflb_uart_config_port, + .verify_port = bflb_uart_verify_port, +}; + +#ifdef CONFIG_SERIAL_BFLB_CONSOLE +static void bflb_console_putchar(struct uart_port *port, unsigned char ch) +{ + while (!(rdl(port, UART_FIFO_CONFIG_1) & UART_TX_FIFO_CNT_MSK)) + cpu_relax(); + wrb(port, UART_FIFO_WDATA, ch); +} + +/* + * Interrupts are disabled on entering + */ +static void bflb_uart_console_write(struct console *co, const char *s, + u_int count) +{ + struct uart_port *port = &bflb_uart_ports[co->index]->port; + u32 status, reg, mask; + + /* save then disable interrupts */ + mask = rdl(port, UART_INT_MASK); + reg = ~0; + wrl(port, UART_INT_MASK, reg); + + /* Make sure that tx is enabled */ + reg = rdl(port, UART_UTX_CONFIG); + reg |= UART_CR_UTX_EN; + wrl(port, UART_UTX_CONFIG, reg); + + uart_console_write(port, s, count, bflb_console_putchar); + + /* wait for TX done */ + do { + status = rdl(port, UART_STATUS); + } while ((status & UART_STS_UTX_BUS_BUSY)); + + /* restore IRQ mask */ + wrl(port, UART_INT_MASK, mask); +} + +static int bflb_uart_console_setup(struct console *co, char *options) +{ + struct uart_port *port; + struct bflb_uart_port *bp; + int baud = BFLB_UART_BAUD; + int bits = 8; + int parity = 'n'; + int flow = 'n'; + u32 val; + + if (co->index >= BFLB_UART_MAXPORTS || co->index < 0) + return -EINVAL; + + bp = bflb_uart_ports[co->index]; + if (!bp) + /* Port not initialized yet - delay setup */ + return -ENODEV; + + port = &bp->port; + + val = rdl(port, UART_UTX_CONFIG); + val |= UART_CR_UTX_EN; + wrl(port, UART_UTX_CONFIG, val); + + if (options) + uart_parse_options(options, &baud, &parity, &bits, &flow); + + return uart_set_options(port, co, baud, parity, bits, flow); +} + +static struct uart_driver bflb_uart_driver; +static struct console bflb_uart_console = { + .name = "ttyS", + .write = bflb_uart_console_write, + .device = uart_console_device, + .setup = bflb_uart_console_setup, + .flags = CON_PRINTBUFFER, + .index = -1, + .data = &bflb_uart_driver, +}; + +static int __init bflb_uart_console_init(void) +{ + register_console(&bflb_uart_console); + return 0; +} +console_initcall(bflb_uart_console_init); + +#define BFLB_UART_CONSOLE (&bflb_uart_console) + +static void bflb_uart_earlycon_write(struct console *co, const char *s, + unsigned int count) +{ + struct earlycon_device *dev = co->data; + + uart_console_write(&dev->port, s, count, bflb_console_putchar); +} + +static int __init bflb_uart_earlycon_setup(struct earlycon_device *dev, + const char *options) +{ + if (!dev->port.membase) + return -ENODEV; + + dev->con->write = bflb_uart_earlycon_write; + + return 0; +} +OF_EARLYCON_DECLARE(bflb_uart, "bouffalolab,bl808-uart", bflb_uart_earlycon_setup); + +#else + +#define BFLB_UART_CONSOLE NULL + +#endif /* CONFIG_SERIAL_BFLB_CONSOLE */ + +static struct uart_driver bflb_uart_driver = { + .owner = THIS_MODULE, + .driver_name = "bflb_uart", + .dev_name = "ttyS", + .nr = BFLB_UART_MAXPORTS, + .cons = BFLB_UART_CONSOLE, +}; + +static int bflb_uart_probe(struct platform_device *pdev) +{ + struct uart_port *port; + struct bflb_uart_port *bp; + struct resource *res; + int index, irq; + + index = of_alias_get_id(pdev->dev.of_node, "serial"); + if (unlikely(index < 0 || index >= BFLB_UART_MAXPORTS)) { + dev_err(&pdev->dev, "got a wrong serial alias id %d\n", index); + return -EINVAL; + } + + bp = devm_kzalloc(&pdev->dev, sizeof(*bp), GFP_KERNEL); + if (!bp) + return -ENOMEM; + + bflb_uart_ports[index] = bp; + platform_set_drvdata(pdev, bp); + port = &bp->port; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + port->membase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(port->membase)) + return PTR_ERR(port->membase); + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + port->mapbase = res->start; + port->irq = irq; + port->line = index; + port->type = PORT_BFLB; + port->iotype = UPIO_MEM; + port->fifosize = 32; + port->ops = &bflb_uart_ops; + port->flags = UPF_BOOT_AUTOCONF; + port->dev = &pdev->dev; + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_BFLB_CONSOLE); + + bp->clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(bp->clk)) + return PTR_ERR(bp->clk); + port->uartclk = clk_get_rate(bp->clk); + + return uart_add_one_port(&bflb_uart_driver, port); +} + +static int bflb_uart_remove(struct platform_device *pdev) +{ + struct bflb_uart_port *bp = platform_get_drvdata(pdev); + + uart_remove_one_port(&bflb_uart_driver, &bp->port); + bflb_uart_ports[bp->port.line] = NULL; + + return 0; +} + +static const struct of_device_id bflb_uart_match[] = { + { + .compatible = "bouffalolab,bl808-uart", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, bflb_uart_match); + +static struct platform_driver bflb_uart_platform_driver = { + .probe = bflb_uart_probe, + .remove = bflb_uart_remove, + .driver = { + .name = "bflb_uart", + .of_match_table = of_match_ptr(bflb_uart_match), + }, +}; + +static int __init bflb_uart_init(void) +{ + int ret; + + ret = uart_register_driver(&bflb_uart_driver); + if (ret) + return ret; + + ret = platform_driver_register(&bflb_uart_platform_driver); + if (ret) + uart_unregister_driver(&bflb_uart_driver); + + return ret; +} + +static void __exit bflb_uart_exit(void) +{ + platform_driver_unregister(&bflb_uart_platform_driver); + uart_unregister_driver(&bflb_uart_driver); +} + +module_init(bflb_uart_init); +module_exit(bflb_uart_exit); + +MODULE_DESCRIPTION("Bouffalolab UART driver"); +MODULE_AUTHOR("Jisheng Zhang "); +MODULE_LICENSE("GPL"); diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 281fa286555c..0651fcc8734f 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -279,4 +279,7 @@ /* Sunplus UART */ #define PORT_SUNPLUS 123 +/* Bouffalolab UART */ +#define PORT_BFLB 124 + #endif /* _UAPILINUX_SERIAL_CORE_H */ From patchwork Thu May 18 15:22:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246995 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 994FAC7EE25 for ; Thu, 18 May 2023 15:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CMGqztx/FmSQFz1LvI6ae7B0ZY5fWFh7c0Zh3/VGuZA=; b=dyGeB7B5Jr/mpC Ld5k2u9QeUl265lG367ygj6fcftA8prJfLRBTNkycUsP7BT/XjfzPfLBh0lJbgaxF+7wPtSqbrqlG uebnwXA2rKh+rxDhyVjzWR/6XBWNihE6nBDW8WsNacMr8t7U/WPZI2Hbd5pBDxljcuF6DLzkmjo9d fGDD/jelv1TP1noyG+YKGOmGe9k7QE2+Q9Mf1vv4VDYzFg4jRp3bLnjTFo9HUzWy3RmiAQVcoTh+/ rzs3UkerPRpA+IjkqUbSf3rkcB0RGN17gns9XQOYFvUmbuUh1yt8hfBBicAyITDy1zpQKKXP/+mrZ M5N7iY8QyHqfiXDqkZbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdz-00DJwB-2U; Thu, 18 May 2023 15:34:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfdx-00DJub-0L for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A3A7A65032; Thu, 18 May 2023 15:34:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96ECAC433A1; Thu, 18 May 2023 15:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424056; bh=mtrxumyq0ZRmNVTAnw5KH+BUNijjTRh/kWJxJPGHbDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SGbIB8w46x8K+bS/h1IrsArBKnSUDQbJusl259FltuEAMHQqWk3iv737Cdkla9WfR Y+5uxpZ02rQObZCuaFvWsEIiinWanCxu6jg/3qHNmGFoo5Z1x0h5lD4WeK690TkIla LncuBttq0p4NHcU2Qhdsbkb54XtzwUONOw2RtkU1MH9/12vAkY5lOZi/3i4OV+Rr/J Sy31Qa+4U1sa8gUSvbBYGwVjh43c88H8+MX8SuN/KkMa9aLTAu6L0AxiOblcs8eT9w Az6U5RvDBNn8sozrIWJwkPb70SXVvfDtjyFGVV/z2kZlIOffPPrufHk6WS4Q/th5E1 9QO4d4mtc/I6g== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH v4 05/10] riscv: add the Bouffalolab SoC family Kconfig option Date: Thu, 18 May 2023 23:22:39 +0800 Message-Id: <20230518152244.2178-6-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083417_187346_E7FD7FF4 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The Bouffalolab bl808 SoC contains three riscv CPUs, namely M0, D0 and LP. The D0 is 64bit RISC-V GC compatible, so can run linux. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley Acked-by: Palmer Dabbelt --- arch/riscv/Kconfig.socs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs index 1cf69f958f10..33220b5144bb 100644 --- a/arch/riscv/Kconfig.socs +++ b/arch/riscv/Kconfig.socs @@ -1,5 +1,10 @@ menu "SoC selection" +config ARCH_BOUFFALOLAB + bool "Bouffalolab SoCs" + help + This enables support for Bouffalolab SoC platforms. + config ARCH_MICROCHIP_POLARFIRE def_bool SOC_MICROCHIP_POLARFIRE From patchwork Thu May 18 15:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246996 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E859C7EE25 for ; Thu, 18 May 2023 15:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OE2ozi32KxOVVFJh0Y2I3DDY+C2dMpaZAmtg9GY+RnE=; b=sH1bl2Fz5miMTb m0kc/7VOJKWTrUNQPPwT/p8m28lFiWVqPjDk8/vqWUvDe4zQIOHZKMSX+V5TqPQphMaIRB+stFtsh EU+gWgsswWRpGqEfUlYotFmfVbZE16iSl863LWhoUkYDhoGJMpb/6gr0CUz4+DJy5gk/bGElLeq57 EQAcR6JDYwI+oYHeGtBs8zRHq//Sz1xdJ04TrE2GxNhHI75uEwV77KF58AsXu6LQ2UM7aBosYA6W0 8CLdehJh284a+6T+9OHZwyO+9DZvStubeMBbP16lWyQVl0J75mlZdgeUp00IXn23SzESwWPvJs3AG dTZLTJ/ZaTHSQXuVa+zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfe3-00DJyX-1S; Thu, 18 May 2023 15:34:23 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfe1-00DJwi-03 for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:22 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D45E65028; Thu, 18 May 2023 15:34:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87A11C433A4; Thu, 18 May 2023 15:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424060; bh=tjHJaA4aRTqHjDCA/IBwb6cvsxUrvZf4t9KhrAVlN68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+2e8i1lfdMXruROpTVyKaDJ/BPI9Ea/5vVZZEyGCrfBBlPT6gtw4l29LlhUgmTui kGstJMnnRklkzGtWGj/2rNoX2HiP7Q1t1wnyUtVPuFdaCwmL6a19JJp6itSOYx23JS Z49MrEa1cQloXMVH9moLwlowYTZdGI06hWjxWgBhEt4pdYu8HtXCXWjY6g7gwvNje5 neofy3LGe2CH6NNOCrAJjxnXvT+1cdXJvzRXT5WekdeIR0Yxm1FsCCIVQ1+tFlxyy/ bMTiVJ88uwM3d6lLYSwT4iLWR/K56JAC8XWcYyDvWiNzgvj8zMaD6vbhcRUiZE0+LT yI0Zl3R6xxZ7Q== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Palmer Dabbelt , Conor Dooley Subject: [PATCH v4 06/10] dt-bindings: riscv: Add bouffalolab bl808 board compatibles Date: Thu, 18 May 2023 23:22:40 +0800 Message-Id: <20230518152244.2178-7-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083421_091754_F14B3CA6 X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Several SoMs and boards are available that feature the Bouffalolab bl808 SoC. Document the compatible strings. Signed-off-by: Jisheng Zhang Acked-by: Palmer Dabbelt Reviewed-by: Conor Dooley --- .../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 + +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 + +... From patchwork Thu May 18 15:22:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246997 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A5DCC7EE25 for ; Thu, 18 May 2023 15:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2nvy/rlqmbGL5jsNHNYix6/vBaWNWxsj1DBpjMQv3wU=; b=SYOM0AxBi1X78J FIzI8iEGUIMu+QzXptl8sVuu18ldbPsvfWD56nyVy6AN95I3mTnsxt5DLElVAaahKjCsIAPTi3L4Q M/S/VNM1HrYw/pKSHF5TPd/SKfQFVgAISrzqLoAi0ugBlKJE/xGwetn946c0TP6ZVVHwmrHZx3dO3 pdC0Fv8lcq+WYepIRW27RN5pw6xz3QYzgItA/aAwy/Z1n+q/r3agWhC8vvKzzduyra21lZr65CpZq oX5JB9RWHJjDHnzDY49StnuYy9wGW1RgDrAFL17fNUQxe4gH43oJFFMB+Nwe+Jm5vAKPwuQIqBAjx 4K02JUMMTg97jPXAwKpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfe8-00DK2J-0N; Thu, 18 May 2023 15:34:28 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfe5-00DK0E-1f for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:26 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C8BB65028; Thu, 18 May 2023 15:34:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 765F6C433D2; Thu, 18 May 2023 15:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424064; bh=9ZVQaWxp1rntSaFGKdgAUvSryPweqDi/a9hnkE1Whk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4BGUnHoEQEDOGv3XS0kZ4uAw6KKAZfdXAGaQPtSUtMmLl3CSgyHra2G/dbS4zjEP 7IM/IREhAVbAdxAWoacPwlwRvTT1EDKdw6XiIPQIZWyeFM4l60NoHTqzAYpCmmF3Be nCizjtQqcqxf4ZsF38r6P5Nrobvb743GjexYMlsaWKqp99dktup1pgIxMi5kEimUwK fD7phZT913VUV2jDw9fP2QExGcyZk9NAdRUhr4+7sTiOxDlZ6rULA3bRoa0Foi+pXR 65byqHOuO8mVq2AGA8aCNe/HtxG8FRnNCs7QogZ74Neb7UKzV8J6SJSIJt4wMgFtwv WdjLR9z9joeCQ== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Palmer Dabbelt Subject: [PATCH v4 07/10] riscv: dts: bouffalolab: add the bl808 SoC base device tree Date: Thu, 18 May 2023 23:22:41 +0800 Message-Id: <20230518152244.2178-8-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083425_637981_7419EE4A X-CRM114-Status: GOOD ( 13.30 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add a baisc dtsi for the bouffalolab bl808 SoC. Signed-off-by: Jisheng Zhang Acked-by: Palmer Dabbelt --- 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..87906fe51db5 --- /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 + */ + +#include + +/ { + 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>; + }; + }; +}; From patchwork Thu May 18 15:22:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246998 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C60E6C7EE23 for ; Thu, 18 May 2023 15:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NiiJBXWz2Q8ZNZWQxpXbCmDG+r1JzXsDyHgyvfhmDDE=; b=prez2Y4UFvlD7p xrPx9khX4C6SypWSH9MauldlozigpFjHCBzZptS7gnuACZW0pFo3LybnISGtn34mtFqqHCwlJyqfm vQ/3sWpIbw+IK9UESjqsVBZpUsY+Kd2iecVIbnFOG9sNlSvd9xs7IKYxE0ScUo95h/iOP+C/Yp8bj VrSs7BXoVMwofH8tV5tzy0+cUNtYmplj+J0SHPw49qOLL8x3Y+3my6cl1vNbwQiK1cti8KiNulhmz 7DM+acw0mMENtQuxdh7uH5lmlDrLhQ6sSJxsn6J/8D+FYCXFJW4W3PkA8yxu9KYVNZFdLiPGLxDo8 BhiZDGnPO/ihzqkVBlrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfeC-00DK5k-2U; Thu, 18 May 2023 15:34:32 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfe9-00DK3Z-20 for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:31 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3C8816503C; Thu, 18 May 2023 15:34:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01436C433EF; Thu, 18 May 2023 15:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424068; bh=gEHB+BIFuaGSJHd+ja+x4RxCS37TdEdu060uta3gMMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FG5KSkJVORV1NRSO3ygKuqQNl8sXCDza7x0MkNP0DlPMo7lWgfRgPs7QVYfcMklOw cqzEUkUi+PsCYfcoQyTaJD6iA6RZg1jjvOrqdHssGWhIjvaqMDo/4lahNZIKw/5yiG Ohnqb6ATbN4ExIyf30baJHXF4a4Mwj78lrPLd883aFnrkCcdZt/5OotQYCVLGKPCMY prue/GlO5qAKxHJt0Ar/EwF7cRRGGcGGhNLVadXx581s2kvspHxyzNK2+lK8adcy+s ItcUwS2UX+lMP6ihKx0HLUKIpQe9WBe5aC96xAiHBHxmhisOw5MecZ7+oEEcmUO1V/ TbZukq0Nh5srg== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Palmer Dabbelt Subject: [PATCH v4 08/10] riscv: dts: bouffalolab: add Sipeed M1s SoM and Dock devicetree Date: Thu, 18 May 2023 23:22:42 +0800 Message-Id: <20230518152244.2178-9-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083429_741385_BAFAB865 X-CRM114-Status: GOOD ( 15.80 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Sipeed manufactures a M1s system-on-module and dock board, add basic support for them. Signed-off-by: Jisheng Zhang Acked-by: Palmer Dabbelt --- 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 ++++++++++++++++ 4 files changed, 49 insertions(+) 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 diff --git a/arch/riscv/boot/dts/Makefile b/arch/riscv/boot/dts/Makefile index f0d9f89054f8..133e6c38c9b0 100644 --- a/arch/riscv/boot/dts/Makefile +++ b/arch/riscv/boot/dts/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 subdir-y += allwinner +subdir-y += bouffalolab subdir-y += sifive subdir-y += starfive subdir-y += canaan diff --git a/arch/riscv/boot/dts/bouffalolab/Makefile b/arch/riscv/boot/dts/bouffalolab/Makefile new file mode 100644 index 000000000000..5419964e892d --- /dev/null +++ b/arch/riscv/boot/dts/bouffalolab/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +dtb-$(CONFIG_SOC_BOUFFALOLAB) += bl808-sipeed-m1s-dock.dtb diff --git a/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s-dock.dts b/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s-dock.dts new file mode 100644 index 000000000000..aa6cf909cd4d --- /dev/null +++ b/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s-dock.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) +/* + * Copyright (C) 2022 Jisheng Zhang + */ + +/dts-v1/; + +#include "bl808-sipeed-m1s.dtsi" + +/ { + model = "Sipeed M1s Dock"; + compatible = "sipeed,m1s-dock", "sipeed,m1s", "bouffalolab,bl808"; + + aliases { + serial3 = &uart3; + }; + + chosen { + stdout-path = "serial3:2000000n8"; + }; +}; + +&uart3 { + status = "okay"; +}; diff --git a/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s.dtsi b/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s.dtsi new file mode 100644 index 000000000000..5026de768534 --- /dev/null +++ b/arch/riscv/boot/dts/bouffalolab/bl808-sipeed-m1s.dtsi @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: (GPL-2.0+ or MIT) +/* + * Copyright (C) 2022 Jisheng Zhang + */ + +/dts-v1/; + +#include "bl808.dtsi" + +/ { + compatible = "sipeed,m1s", "bouffalolab,bl808"; + + memory@50000000 { + device_type = "memory"; + reg = <0x50000000 0x04000000>; + }; +}; + +&xtal { + clock-frequency = <40000000>; +}; From patchwork Thu May 18 15:22:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13246999 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A68BC7EE23 for ; Thu, 18 May 2023 15:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zrDo8A7QFefMxUwsK6iMZCwAZrzGPodtGb9xdH0cT7c=; b=g6uJFS3OwSFfNF rdZuchjoG3z246TljU7UnQWMd1zAaa5tWVfZfqlmh1TmhpPAg3XpWGZ1vn9mjSpLhGkNBX8HmFeeL Z7p+Jk4hEQfPZpv/FEmkxGzjDtSnXfXtvY0TvW5jIH5uspntHO/hqOJn4rOnTmP/p4CP2f0y2W7wY +X6dle1Ac6pmLP/8gORiQXQlx+XlvyoIfx7ueKfbN9OI4VHqLIuCDcWf3D9Mx6ndpXK/tzyINjWS6 aTjAz/oTp4sj5JiccdqWajCfu9nKYciaAujw1/fw8eoOXBQPNrdSaWhQS27g4UTeIMdmK01/2wwvV GdIMFyRQ92Reg0MNElNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfeG-00DK8V-1X; Thu, 18 May 2023 15:34:36 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfeE-00DK6l-2M for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6C9865032; Thu, 18 May 2023 15:34:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20AA5C433A4; Thu, 18 May 2023 15:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424073; bh=Y6wp2lfk73IXtZCQpUDT1aZp/tHzlT5TxGlvlcAf9+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/m23eV8ondNDJx76IqCrGW/M1lOBbTSSKI+8Qaj1xJa0C4k49BybfQx+lqsYbBc4 XuG9hDkEwQUA5tmQaKil6HF1zufUfRLgfLI+mTrqvxx3lwjCfcwl8YlNZf2dhwClDZ +qSt6B4jNYVpIu6BLVlyZGc6qt6YJCv89xR7Vx0jRGlbAjl/Dhml4eTAJGjdmkoWCl ccvN2O6FJLVwxWL4nlG1s/sBEB5zmCS5ZLxACZZITrqeQROhFLD/Qu05Kgf7WzIHhG U88RYaX8cOmXWnySONDnDCzYFVPiRVoGuzOd1rnOX3wxabb3xe8IzZhkBlb981qSZh 7lVefs3NuQUWA== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH v4 09/10] MAINTAINERS: riscv: add entry for Bouffalolab SoC Date: Thu, 18 May 2023 23:22:43 +0800 Message-Id: <20230518152244.2178-10-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083434_805101_B862A9DA X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add Jisheng Zhang as Bouffalolab SoC maintainer. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley Acked-by: Palmer Dabbelt --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e0ad886d3163..0ae136f2656f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18115,6 +18115,13 @@ F: arch/riscv/ N: riscv K: riscv +RISC-V BOUFFALOLAB SOC SUPPORT +M: Jisheng Zhang +L: linux-riscv@lists.infradead.org +S: Maintained +F: arch/riscv/boot/dts/bouffalolab/ +F: drivers/tty/serial/bflb_uart.c + RISC-V MICROCHIP FPGA SUPPORT M: Conor Dooley M: Daire McNamara From patchwork Thu May 18 15:22:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13247000 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C132FC77B7A for ; Thu, 18 May 2023 15:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=47L4FIoRzqqMRo9u6efDTGNX/RELygkXlaiEPD7LF6s=; b=ibSNsEUucoY5ZO 8+arNVCstw0N/n0DNLqgc3Si6GwlVKn43C0025RZrrv3OGum7fMcWk3aQ9/khDtnQIbnPyGJW9rUR 2bm72PXau800eLLxsffi0OQLLAO16IhASJmpGvf03lbHVVzv/QC44DnfTskFKGq/LAD2Pywo6/ArW 9BH2/JjbrmRDLQogVW3sM+81ku/HVYOpSodcyhgiHsXunfli00gyRTo2QfaGOcBuRpkcTW2y2lUQG lu2KmLt6WEao3gekiZScXIcynqJlKQRYv/YKRgpi8HBvRdpU46LjtmwRVCFUmc49gUGxeLS6Br7Dj AWi35vL1SBWOdfq4vL0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzfeL-00DKBL-0N; Thu, 18 May 2023 15:34:41 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzfeI-00DK9S-17 for linux-riscv@lists.infradead.org; Thu, 18 May 2023 15:34:39 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD0BD65043; Thu, 18 May 2023 15:34:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0192C433EF; Thu, 18 May 2023 15:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684424077; bh=Y38ByHJH7UauSxGlzX9LVYgXc2kOZJd7HsQTY6MaJRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hWCbdO9DHFo/ts9yJlLNv64Ady+ieuZOm2oYyGY2khzOATcofHyYc8EKBB0BujC3q QO9NrqmRqTF55RGbzBUbSdlWnT1SkiO4NSWDO0B6JK5+YO477zsLCYe0Hcw+9oGhiv mYokGuQfa2d2izgleLAWSy2jY5xZDOk/ylUWUUyXzMDdV/114xIzz+XHj2Nk/Eni0E fOeYjW8mTXfgaeTWl0aubcAQoW0Gs/SxrbGqd2Pkd2EdDTBzSZkuiM+XCWVBlUSwD9 NI0coaD2HIz1NuSP1uHh09/bSC06n9HSJKMDpjYPd9Ic0VAC5scrDBUBuP8zwBqPJm XpRr84kwwPKBA== From: Jisheng Zhang To: Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Palmer Dabbelt , Paul Walmsley , Albert Ou , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH v4 10/10] riscv: defconfig: enable BOUFFALOLAB SoC Date: Thu, 18 May 2023 23:22:44 +0800 Message-Id: <20230518152244.2178-11-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230518152244.2178-1-jszhang@kernel.org> References: <20230518152244.2178-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230518_083438_426481_E729DA3F X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Enable BOUFFALOLAB soc config in defconfig to allow the default upstream kernel to boot on Sipeed M1s Dock board. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley Acked-by: Palmer Dabbelt --- arch/riscv/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig index d98d6e90b2b8..e8d77b55ce86 100644 --- a/arch/riscv/configs/defconfig +++ b/arch/riscv/configs/defconfig @@ -26,6 +26,7 @@ CONFIG_EXPERT=y # CONFIG_SYSFS_SYSCALL is not set CONFIG_PROFILING=y CONFIG_SOC_MICROCHIP_POLARFIRE=y +CONFIG_ARCH_BOUFFALOLAB=y CONFIG_ARCH_RENESAS=y CONFIG_SOC_SIFIVE=y CONFIG_SOC_STARFIVE=y