Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1826460lqt; Sun, 21 Apr 2024 11:02:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxWwgzbWnq7JG9mWGgpQKdTj2vqNFJC36IZ5jgzzVaEN21R6W+WoHbxc0tBJ8sqov9fquxHxDD6E5718ailjfDETPNtoTBLMT/4V4LBQ== X-Google-Smtp-Source: AGHT+IFcICv0y5fiQrHVFr8alL4TUgqJsxwiSiLDvbQNvinZgyLSk/hwupZPY5FqmLevCFIvtAO+ X-Received: by 2002:a17:902:f544:b0:1e3:f622:f21a with SMTP id h4-20020a170902f54400b001e3f622f21amr16447232plf.24.1713722535342; Sun, 21 Apr 2024 11:02:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713722535; cv=pass; d=google.com; s=arc-20160816; b=LvnVZWSbYRoGGG8Lz7F5Rvoev98wofu8dflKJLvVvv1ofwjwSt1RYvPCe3m5A40t/Y kNj2RRTNUHxhdkvs5Ss5Dk6YlmBwSzVI22bBRSrSz8oXqxb09jpg/ASApSMI2+8NRBQI H5iGxVUanPlOsbY90Pae9pcHTEPNv8laNP3Mv2zg1hwApJ2iyVwiOPhdGHya7UQXq3+e h6NFhKx6m/rNtEe2GK4m4E2/MRBht8yN0nzRkUSZrbKeTxLSvLENFBH/5aQU3xjTCcdi /gx02QIhtaxDPSRHmzdC1wtce55nJ1Pi3M/4iQZP0T/cQIFG0DRp8r91Hv9/oTwpq1D2 l36w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:subject:cc:to:from :message-id:dkim-signature; bh=9yDBgQO4TbmtaqpS9si5I27IyPRDwpcQsvToSrByr5g=; fh=PyiinBhW2hWN/gOc/BMlvLHJoyaT7YFa/Ii3YG+5Eyk=; b=BFjV+lyxjSu9VcExx0kez0HCWwb7jsjY5Kw+XSqsvInlNiUe8yjPpIPEyZrB1jtnpT G2JhWHAnDElgaBaNck05VoW8s0UAbkOrsCHOurswnWwm0MtseNuaRDEwgPWOLwAnRKn+ v7beeRsI2gXPYh9q/tBxj+4uaHfwus31seyN/uuErKpcrG+zf4Sm1NwatxR7LbHV3gUl VEajBO1IvpEimtHbjeCHT6l707/rDTWlvfKYc8WZ2rQH8qQQb7WweUay+5BU+/fG7fEU tDpOIGmkpuJuN0KKWTeVqMgSgmvtCS5501TWzZxvhH3glITIB2h+DHcozMxFXYJe3OEP ED8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=kWCAaW3p; arc=pass (i=1 dkim=pass dkdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-152491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152491-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u2-20020a170902e80200b001e299cd96f6si6632054plg.43.2024.04.21.11.02.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 11:02:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=kWCAaW3p; arc=pass (i=1 dkim=pass dkdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-152491-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152491-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B4F528106F for ; Sun, 21 Apr 2024 12:53:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BF8E14AA7; Sun, 21 Apr 2024 12:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="kWCAaW3p" Received: from out203-205-221-202.mail.qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) (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 B2AEF12E5D; Sun, 21 Apr 2024 12:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713703994; cv=none; b=csPOBMNEfwjid2NGVFvSW3F4Bk3DD1ZynJf6WkPwcVww6Rgf3AZFv11GcHoQV0h4CG+4ABTg47Men0LSJjxBmR+GqntVC7roWbIMmKg1A9rihYb9jrD7DsYJoUaWp3NQ3O9vhxrzxV6Pb3M3Wh+9ExUh9V1vfNgzdPS6S4+KMhQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713703994; c=relaxed/simple; bh=SKSWf5drZAIMxxyx7CqVNHbBlfdMwWwCpOCl9v4vz7g=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=IN8znAXfxm+GeJOzuc7VCqLKK5o8ZevL4oTtr/06ExwvzsP48q0Q8eUaaJMOz8no6Mu3V2cfda74leipr9/YPU2V1Huvfa11qU3ffDKs0lZHY827gFHF+R+JVfbH8fxsyQdk2/uGdK+eimKVy70sjowm5Yfl+mX2D4H792VkJVQ= 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=kWCAaW3p; arc=none smtp.client-ip=203.205.221.202 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1713703976; bh=9yDBgQO4TbmtaqpS9si5I27IyPRDwpcQsvToSrByr5g=; h=From:To:Cc:Subject:Date; b=kWCAaW3pM4ygcmKzLmjcnih/bJ8Pga+3h5+ZMSa25VMTI9HYElD0K38x7T87jwWo8 N/JBTRRK3PTdDLY9yGFcxSdnbsVBeWpurn8ZZtaCI0tnfXeIPH6DCTvL+HOr3b19Ix UlRqfqx0nnaUyximKh4giGC71gmFxxFY3vTQOwis= Received: from cyy-pc.lan ([240e:379:2264:6200:aa04:7d36:395a:da35]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id D33992DC; Sun, 21 Apr 2024 20:52:51 +0800 X-QQ-mid: xmsmtpt1713703971tqsj69njy Message-ID: X-QQ-XMAILINFO: OLnGMPzD2sDVlqXcDkXPfyYiQdQtEoO2sX2M6LXOzSLZIlX3ONwmstyW8GsBgS +V2/eif459i1yOXB7vnvDk6GENdyWDY8H8fy6iDpDM87c6N/fgLSbCmtVKx5MagWd0vvp7A3Fn2+ xjltDdBwixT5zlRzoH5+k0wkd1h7uFaWJCvSRC3I1NnquSDMm0ElzWwt3XpuvUzDnWYMwBYnVBaU lJAUSk6fhqEb2/DOe0UXaHcF2zW06FB/9iRjnGUrvpbmuUahFyl9MaC7fKhRSV1IuyxnOJDgiHLq u29VPXB2lAazJndDuLYSj7no/o1WLYSmqMTEJ5P2aHRCJOT7Fnx343RNSMoxA6X7/Ew7eukN9u/m 9LJIB4IJm3n2qJl2pFBXrRHZ7BC08UCktR4qwWTwa6a0Qu/z7z6YAuh1aarOnm6dfQkiOZoqO/i6 BQ7rrB1es1TY19SqhWmvPEtWMpjwJbYIjkm+XFyr4UthmkQWgZjFrPXf8wMt4pgc0v/R9YO5YIXX +nkUJDw2ohQTVPN92QuLmpO2BpfHhx+morTqIeYWP/JbQXLK33c/gLwyl1YL6N/fDLFtFIMlse5g irnETmYUensSOs0rlHV1mnJSACC7jfQomSuWx7nVtvfbiLK03bJKN5V4DJ76hf2gPWS67k01jmxS I8oqxwCPIY8yPbqsjcw33B6J24PeuPF5CrbjSbgQVhTKdoo59pBVKO6HmWf7fRxUSGsd3kwS1poK +yrHXhgjgKaXGqSIi8I2NR7hUj5DWTLkSrr7fTsQMf0vH8Mv/Snt8tgt+nAW/BevWwbXl3FcD1/U k1kGBBvu74h+JphDA6E3arB/qWSzMSCBR4ZnQpIfm7omtiNIjN2fBWD7Bu04sm5Hy+HcT5ffM+wz x7R1lv9DixA8CbRi+Y/DpBXxIsIZ26KqLqz8MfOvJC29p48CjOp8iviiqccVARIYcpseaMH3tVNR x+RuXjBzpNrKlRep8XMPF2Bfl1lQiWOC88xjmSmkXcG9gA9pRt/zCsQ6GhI4Aakjk1fZXiraVHdV kNB/EOuw== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= 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 0/2] riscv: dts: add USB nodes for Canaan Kendryte K230 SoCs Date: Sun, 21 Apr 2024 20:52:50 +0800 X-OQ-MSGID: <20240421125250.1039510-1-cyy@cyyself.name> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As K230 SoCs have two USB controllers, add USB nodes for it. I have tested the new dts file on both CanMV-K230 and K230 EVB. I confirm it can work well in USB Host Mode with high speed. I use CanMV-K230 to connect an RTL8152 USB Ethernet adaptor to an OTG Port (USB0), which works well with this log [1]. The on-board ethernet is connected to the USB1 port, which works. On K230 EVB, the RTL8152 USB Ethernet adaptor works well on a USB0 port with high speed [2]. I have no health device to test the USB1 port on K230 EVB. My K230 EVB USB1 port has no +5V power output even on factory-patched u-boot + opensbi+ kernel. I also confirmed the dt-binding can work well with NFS as rootfs over USB Ethernet. It's good news for those who want to use K230 SoCs to boot a mainline kernel with distro rootfs for daily RVV1.0 software performance evaluation since we haven't submitted MMC drivers to the mainline for SD Card support. There is a thing to do: add the USB PHY drivers. Although I can let High-Speed USB work on both of my boards, the pulling on D+ and D- pins are not right in gadget mode for another host to detect the speed. We can see from the factory-patched USB driver, which adds an item pointer to the USB PHY controller [3] and sets the pulling mode for D+ and D- pins for different modes [4]. However, the factory-patched USB driver is not the right way for the mainline kernel to go. We should add the USB PHY drivers to do the right thing. We can infer these things from the factory code: - USB PHY Control MMIOs are at base 0x91585000 with size 0x1000. [3] - usb_ctl3 register controls the ID_PULLUP, DMPULLDOWN(D-), DPPULLDOWN(D+). - ID_PULLUP is at bit 4, DMPULLDOWN is at bit 8, DPPULLDOWN is at bit 9. - The usb_ctl3 register is 4Bytes wide. - For USB0 port, usb_ctl3 is at offset 0x7c. - For USB1 port, usb_ctl3 is at offset 0x9c. [4] But I'm too busy these days to add a PHY driver. I would be happy to help if someone volunteered to do that. base-branch: [5] This patch is available to test on that tree [6]. [1] https://gist.github.com/cyyself/f7f2849e6a262b6281687b906e1512cc [2] https://gist.github.com/cyyself/ea8895012d1035ca5bd3375b798f5786 [3] https://github.com/kendryte/k230_sdk/blob/v1.5/src/little/linux/drivers/usb/dwc2/platform.c#L526 [4] https://github.com/kendryte/k230_sdk/blob/v1.5/src/little/linux/drivers/usb/dwc2/params.c#L195 [5] https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/log/?h=riscv-dt-for-next [6] https://github.com/cyyself/linux/tree/k230-usb-v1 Yangyu Chen (2): dt-bindings: dwc2: Add bindings for new Canaan Kendryte K230 SoC riscv: dts: add usb nodes for Canaan Kendryte K230 SoCs .../devicetree/bindings/usb/dwc2.yaml | 3 ++ arch/riscv/boot/dts/canaan/k230.dtsi | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) base-commit: 5db2c4dc413e27720b8f567522cd5ebb0bb7ef70 -- 2.43.0