From patchwork Sun Apr 21 12:53:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangyu Chen X-Patchwork-Id: 791207 Received: from out203-205-221-149.mail.qq.com (out203-205-221-149.mail.qq.com [203.205.221.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E08171401E; Sun, 21 Apr 2024 12:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713704048; cv=none; b=mBDOl9/WBz3vLQeW9FH6nH3KBzBOeih+/3IR/A1cFoBfLN+ycLOGYLUsaDlup41ThHV0/ikK+sD7Sg7yXt6y7OCl/n68N2zlFUUeQAQVOYeU+kupSk3zqB2u3mN6F7bZcQ9Ox6s2qr2ef0PxidFA2ZnEqNYiK301eVlpEwLzeRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713704048; c=relaxed/simple; bh=OMxEbSghiub32vJy5K8PNa355eAgggd/IUtvpXdfhkM=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=TT3EjwIwMqFZP8f5RSdvP+zrKmUjuWCs2ZLHQ2Rs6EvrPhM1L/0jOpSCidwMlZ7YIOe6uw5bmMy5VCrR8bzwo7QZANsfUo9uHjRiwx/SwGaWjc26HjQjH/Xz6tmndaQmEGWFtX2LIOrOZ2ir1dAGfucAK6riRnKMOW0ahjmKvSE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name; spf=none smtp.mailfrom=cyyself.name; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=GCq27bp9; arc=none smtp.client-ip=203.205.221.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cyyself.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="GCq27bp9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1713704027; bh=+MFWVuEyUVqlNiNc84ZLlRbkslCJ1Q/32gOiB+YTW2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GCq27bp9DOpfpFtNbQ+ps1WKJIJh6TsojhuwC7VkZgdWEIVJx2t6w5RN2TBDu74Oq Ofm37a/qfcx+cLaOSsfSv1XpSFLVsQB3tfeivUKFbaszUpgAbtWxYlNXb+WNs1H6HP xZWbPyualZf6Awh3XjRa8zVcCaMxmaVw2XoGorr0= Received: from cyy-pc.lan ([240e:379:2264:6200:aa04:7d36:395a:da35]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id D6B1C271; Sun, 21 Apr 2024 20:53:43 +0800 X-QQ-mid: xmsmtpt1713704023t32d6eczu Message-ID: X-QQ-XMAILINFO: MvTK+AXQ7a4FhEnFVpRX4G66+GiF/6N8d5qNLQRLLX2rV2tcDzzoadgdArdnVU dz1NkQiSsfsChzkeiJEPf6LLSX8srOMnUsANmnxzIo7X4x1P16IT3B3qmFFmFksO4UgcfUzk/P5h NmSks9IOiVB+PJdHeAuXSgvi85S7PK0BFTeO+eNsD/kXE5ga9YZ9LGsKsFhb+BWCpbTUGuezkLy9 p2tvy8yTiaUXZPD1hgeNYhRYW9JTYDJTd/7CFAnY/liIGKUIip9IgrKLoTAruZab7xPARl1gMzq5 Vg8ECqx1+z9TygrVKJlw2kQmb16CiEby9D3zH3p0RPmKe1hY8yBNIH/u2oS48MKW9G8+J9dtWvBH Njmkw6Q93BBWhuDigkdmUVKVFV8AZXbyW2kxKiYw2Ze4N5rPmd+gsKMUabLAiUkpaKSDLo4zy2NE 8KnROju1uOHPpEwjUie8N2vK9/QdftKylrnZPmHa5tJktnz7QHAIIhmQTNPLko2oLnJnxOeBH8tG nhiNJOyiAFeHrIsDDGd0X8dFo1LOlrdQFmEtyCJN5HcLWbmcePFEBbrBvacAAub9FVRlWd5luH0N y5zCPMd65rY6h3bJwTux44Pcfy0PAyHH5clre+2SPhTOFYOIIjC5IXduum+sGyiyVi8QW0ESY7rJ EMepmi6+9DjlIlTZXskBYCzvximCXoOlFylz4h3XOtJX+96HafQp1iSBmIma2aXQKWskqHfkdQrE 5QTGPopCXi8mN79d+N/fAW0bFdj+LubR7svXAHizMXK9qG/tsmcsyXdo/RSwQ1CT6XeOzmcOE1LQ RzFqG8hLZ4FDg0WNGXutp2cx2ZLRb9noU7O3/N5+3MXmWcIsCegMizoMDtWWVJfmxkW078ughOnK ZKi5WEIV4j0vjBA4EdeWMg7mHi7LqCxxAfU/im43RnNVWbaTGtUTxT4Pd9ngrmgNHDwFzXEwQSCL N2/8vGlgN7BhKZYbknFkaD64K6FwSmuKLBJ20wOiPSisK7Myk0nMvl1jKJKKuxC7ogq6gZD4Bcs+ wyEuZfVA== X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= From: Yangyu Chen To: linux-riscv@lists.infradead.org Cc: Conor Dooley , Palmer Dabbelt , Paul Walmsley , Rob Herring , Greg Kroah-Hartman , Krzysztof Kozlowski , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yangyu Chen Subject: [PATCH v1 1/2] dt-bindings: dwc2: Add bindings for new Canaan Kendryte K230 SoC Date: Sun, 21 Apr 2024 20:53:29 +0800 X-OQ-MSGID: <20240421125330.1039774-1-cyy@cyyself.name> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the dwc2 bindings for the Canaan Kendryte K230 SoC from Canaan. Signed-off-by: Yangyu Chen --- Documentation/devicetree/bindings/usb/dwc2.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc2.yaml b/Documentation/devicetree/bindings/usb/dwc2.yaml index 0a5c98ea711d..c39d7f9d76a3 100644 --- a/Documentation/devicetree/bindings/usb/dwc2.yaml +++ b/Documentation/devicetree/bindings/usb/dwc2.yaml @@ -17,6 +17,9 @@ properties: compatible: oneOf: - const: brcm,bcm2835-usb + - items: + - const: canaan,k230-otg + - const: snps,dwc2 - const: hisilicon,hi6220-usb - const: ingenic,jz4775-otg - const: ingenic,jz4780-otg From patchwork Sun Apr 21 12:53:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangyu Chen X-Patchwork-Id: 790924 Received: from out203-205-251-66.mail.qq.com (out203-205-251-66.mail.qq.com [203.205.251.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70FD412E6A; Sun, 21 Apr 2024 12:58:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.251.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713704334; cv=none; b=VTKQw4Vd/a6JIhKmtzGbyD3JSjh1sFnWARm/eu6W1kdNWWQJ2d8pSTkhAcH9iKrH9f2U0gy0OZMSePLOTQ9kOKaGHekGTa5Bq209UtrKhUiiwl9yALFHsqIrhVWAEtp4ZqPa+RbYlBckGn44xl48xQU/nic6B/VKi4xwKruoVvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713704334; c=relaxed/simple; bh=NVxRoRPRimApQYLL+SiZLTJ3GwIVnEopHPufJImejG8=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=a++FMHl54nxVRMgZz7gE3K/d8fvMgs5Qg6i/JPZXatyEUCzBAyXSJ0q611iLM4Q2Ru18ut9wvPwlvvqLx/ymJKnP65bUjzBV5FJi2haDPx0Z+bL0kfUZLzlnqbwREc9GyXthxPGgOabgCAAJqkF91X6eKGs76S2//1GVEhLdmuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name; spf=none smtp.mailfrom=cyyself.name; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=Y2tQHT9z; arc=none smtp.client-ip=203.205.251.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cyyself.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="Y2tQHT9z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1713704029; bh=Oid0/2+ncbfbBpARfu+QMrQ+JfMw2YqRGSqME5w6tAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y2tQHT9zzQCX7cNwNGXG89m4/wTe/78DKsmLrtWoi7V1NH/fhIfbjTSmc4JPhHxPO KMHgiM6/7J2Cer23fOz9QncBttXV/FRREgb1csHQ7dD5qOKNaHLSoGLfEZ35FB0Rrz WIDscc7qlmLYaNsHyB1Adezihhz1zSGRDBPprxEg= Received: from cyy-pc.lan ([240e:379:2264:6200:aa04:7d36:395a:da35]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id D6B1C271; Sun, 21 Apr 2024 20:53:43 +0800 X-QQ-mid: xmsmtpt1713704026tyjhfqvqz Message-ID: X-QQ-XMAILINFO: NMGzQWUSIfvTF2H89VCD5B7DlQMjdlBiz4ngf34c+hz0HuyiJ+FkP71jdACfwi Re+X3AAMqp/wxVLWMqLChc4Wifkbxnp3//Tde0b1j4bfQOUOEAXuUe4RjmxsYYtDWsnqYOtsseN4 pnr/rX+sPq1AGW16QiQOqUpXqzVmrBfdLsho8crjAK6Xo4Y2wBMxgxU0Sg08Dmppo/9C6JTftFli qEzItM5Z/wFSqohRUzIfgPNB3qlQOWbLjv23iWRY0gsfmr7bJF2pZucQr8V5odlUGwKGfHmWQwt/ RNozxGpfoZbT8xxp471ItP77hofEXg/K+aA42FJWAN0L1HbbVTM2YioUaVJcigMlTNqkTWnoYn+K gnskcNCgfiVG8/O6mbP34GT6+Zo5Ftv1lSMCoQJ6U9VPXkrGuZw4KPofx8jMDTC7ylAyz/7T6eKT xu2pY/Ht3nvf4yh2t5vB7R34zVxAUJkuQKLrsJ7aydJr4PWQ7hwzfPVSROuaPR4MQklXrhqoqoDJ TG60ZbfziMtm2ljVUcnJmMyNlxXjVlTVvhtdkVSn2Rl7e0U7KikTJVOtezEbfHMdgH1OQIa12ho0 ctEFSOlHluBsuL+nU+9TyAaLjDlO4RWqp7dIGnghdy5BrPsQPnGKbU01rT+6yA2pSB14lLeHw6Po SN9k0UJ/D0qxswyRPPBh85twKsjPWwOfXfuCiuxtfpzUdm1q6DRbxN5eilEOW4OmthwuaWO4F737 bJnNF8ULJymrKOQJQyqsI3Om0qKYMarOi8WdUMuFCAoXJcYAuvT5q749lmi6g57bB9Jn2oM15dxG oEK2UsOPB6ZRoTDVwlX/JaGAc5Du+ug7T5mwoHS5Os7ketYJizhE+QIxevA2d1LtignjzTM6cn21 6A7/RUcUpanX2ZRUDSf/sNh3sO2RCngysjitPERLJq8ZTkUaBJG8LhBtMBa1E6DVJ0hoApnO3wdd 0vmWBoNKD6Xwyod1bI7yTgltkaTmgpWQ1t/CnmniVzFJtAPgT78Ui9AmQJqle97E4xIWtNilMPhq Rs3jP+Pi05dvYxJdmcL1XjdqiIHOqg5v0YzdbfDgh2WWFj21fi X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: Yangyu Chen To: linux-riscv@lists.infradead.org Cc: Conor Dooley , Palmer Dabbelt , Paul Walmsley , Rob Herring , Greg Kroah-Hartman , Krzysztof Kozlowski , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yangyu Chen Subject: [PATCH v1 2/2] riscv: dts: add usb nodes for Canaan Kendryte K230 SoCs Date: Sun, 21 Apr 2024 20:53:30 +0800 X-OQ-MSGID: <20240421125330.1039774-2-cyy@cyyself.name> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch adds USB nodes for Canaan Kendryte K230 SoCs. The fifo parameters are taken from factory dts [1]. For the clock parameter, we use a dummy node here as we don't know the actual clock this IP connected inside the SoC chip, and it doesn't matter after reviewing the dwc2 driver code, which will not read the clock frequency but only use the binding to turn the clock on or off to save power. [1] https://github.com/kendryte/k230_sdk/blob/v1.5/src/little/linux/arch/riscv/boot/dts/kendryte/k230.dtsi Signed-off-by: Yangyu Chen --- arch/riscv/boot/dts/canaan/k230.dtsi | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/riscv/boot/dts/canaan/k230.dtsi b/arch/riscv/boot/dts/canaan/k230.dtsi index 95c1a3d8fb11..2311fb7f7127 100644 --- a/arch/riscv/boot/dts/canaan/k230.dtsi +++ b/arch/riscv/boot/dts/canaan/k230.dtsi @@ -65,6 +65,13 @@ apb_clk: apb-clk-clock { #clock-cells = <0>; }; + clk_dummy: clock-dummy { + compatible = "fixed-clock"; + clock-frequency = <0>; + clock-output-names = "clk_dummy"; + #clock-cells = <0>; + }; + soc { compatible = "simple-bus"; interrupt-parent = <&plic>; @@ -138,5 +145,27 @@ uart4: serial@91404000 { reg-shift = <2>; status = "disabled"; }; + + usb0: usb@91500000 { + compatible = "canaan,k230-otg", "snps,dwc2"; + reg = <0x0 0x91500000 0x0 0x40000>; + interrupts = <173 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_dummy>; + clock-names = "otg"; + g-rx-fifo-size = <512>; + g-np-tx-fifo-size = <64>; + g-tx-fifo-size = <512 1024 64 64 64 64>; + }; + + usb1: usb@91540000 { + compatible = "canaan,k230-otg", "snps,dwc2"; + reg = <0x0 0x91540000 0x0 0x40000>; + interrupts = <174 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_dummy>; + clock-names = "otg"; + g-rx-fifo-size = <512>; + g-np-tx-fifo-size = <64>; + g-tx-fifo-size = <512 1024 64 64 64 64>; + }; }; };