From patchwork Tue Feb 19 07:36:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min Guo X-Patchwork-Id: 10819361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98F301805 for ; Tue, 19 Feb 2019 07:37:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 832232B425 for ; Tue, 19 Feb 2019 07:37:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7478E2B435; Tue, 19 Feb 2019 07:37:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 558702B425 for ; Tue, 19 Feb 2019 07:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NjE8lGRDf6NCn6CmntudslXmmGboLX3L8RmdXbhapuI=; b=sEhMYToI9xjt/j rLCHgGjvqFAyZALeKHqqGYvYtQaFcCDRzTgWAjdBQ0pqkZ3AD7+J2b28AIl6OOqw17LXVDxFBglj2 KZNfBxw3p/ewCAOEDoybIQQyGhZZKvn3u32nlasui4Dw9k9QkOXExTFto128a2N6kU4LE+hxQXo0e LIvblxLm2qDNhP/GdEP4ux6A6XWYAhMd6W8RUlInAtygxBQC+C/Ezgn2/L7TI5u+z47arEDyV9+6C 3KTn967Bx+cJwIJjpXErD7FArVsVs9qfdAxEkLVwbXR7nvGuMf0Kzl9WMmXzx1/7KKvk1q8IvQyMG gDG4XFa1z/C2WPrUp4Iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gvzxn-0007rW-38; Tue, 19 Feb 2019 07:37:11 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gvzxd-0007io-Eb; Tue, 19 Feb 2019 07:37:03 +0000 X-UUID: c175936711004c85bbc1e0adf79c4825-20190218 X-UUID: c175936711004c85bbc1e0adf79c4825-20190218 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 226933792; Mon, 18 Feb 2019 23:36:58 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 18 Feb 2019 23:36:56 -0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 15:36:53 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 19 Feb 2019 15:36:52 +0800 From: To: Bin Liu , Rob Herring Subject: [PATCH v5 0/6] Add MediaTek MUSB Controller Driver Date: Tue, 19 Feb 2019 15:36:29 +0800 Message-ID: <1550561795-31132-1-git-send-email-min.guo@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190218_233701_508790_6ED9E629 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, hdegoede@redhat.com, tony@atomide.com, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Brugger , Alan Stern , Min Guo , chunfeng.yun@mediatek.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Min Guo These patches introduce the MediaTek MUSB controller driver. The driver can be configured as Dual-Role Device (DRD), Peripheral Only and Host Only modes. This has beed tested on MT2701 with a variety of devices in host mode and with the f_mass gadget driver in peripheral mode, plugging otg cables in/out a lot of times in all possible imaginable plug orders. changes in v5: changes of dt-bindings suggested by Rob: 1. Modify compatible as - compatible : should be one of: "mediatek,mt-2701" ... followed by "mediatek,mtk-musb" 2. Add usb connector child node changes of DTS: 1. Add usb connector child node changes of driver suggested by Bin: 1. Replace musb_readb() with musb_clearb() to clear dma pending interrupts 2. Replace musb_readb() with musb_clearb() to clear common/tx/rx pending interrupts 3. Make musb_clearb/w() return the value of musb_readb/w() changes in v4: changes of dt-bindings suggested by Sergei: 1. String alignment changes of driver suggested by Tony and Bin: 1. Add a new patch for set/get_toggle() 2. Add a new patch for noirq type of dma 3. Add a new patch musb_clearb/w() 4. Abondon patch "usb: musb: Delete the const attribute of addr parameter in readb/w/l hooks" changes in v3: changes of driver suggested by Bin: 1. Add a new patch for musb_readb/w/l() to remove const attribute 2. Use is_out as function parameter in set_toggle/get_toggle() hooks 3. Remove 'u8/u16 data' parameter in clearb/w() hooks 4. Remove musb_default_clearb/w() 5. Replace musb_readb/w() with musb_clearb/w() to clear pending interrupts 6. Add comments to clearb/w() hooks 7. Replace musb_save_toggle() with musb->io.get_toggle() 8. Replace musb_set_toggle() with musb->io.set_toggle() changes in v2: changes of dt-bindings suggested by Rob and Bin: 1. Modify DRC to DRD 2. Drop the "-musb" in compatible 3. Remove phy-names 4. Add space after comma in clock-names dtsi: 1. Remove phy-names changes of driver suggested by Bin: 1. Add a new patch for musb_set_toggle 2. Add summarize of MediaTek musb controller differences in the commit log 3. Abondon patch "usb: musb: Move musbhsdma macro definition to musb_dma.h" 4. Add "|| COMPILE_TEST" in Kconfig 5. Add musb_clearb() and musb_clearw() hooks 6. Add get_toggle() and set_toggle() hooks 7. Replace musb_readl() with musb_readw() to read 16bit toggle register 8. Move MediaTek's private toggle registers from musb_regs.h to mediatek.c 9. Create musbhs_dma_controller_create_noirq() Min Guo (6): dt-bindings: usb: musb: Add support for MediaTek musb controller arm: dts: mt2701: Add usb2 device nodes usb: musb: Add get/set toggle hooks usb: musb: Add noirq type of dma create interface usb: musb: Add musb_clearb/w() interface usb: musb: Add support for MediaTek musb controller .../devicetree/bindings/usb/mediatek,musb.txt | 54 ++ arch/arm/boot/dts/mt2701-evb.dts | 26 + arch/arm/boot/dts/mt2701.dtsi | 33 ++ drivers/usb/musb/Kconfig | 8 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 629 +++++++++++++++++++++ drivers/usb/musb/musb_core.c | 74 ++- drivers/usb/musb/musb_core.h | 13 +- drivers/usb/musb/musb_dma.h | 9 + drivers/usb/musb/musb_host.c | 46 +- drivers/usb/musb/musb_io.h | 12 +- drivers/usb/musb/musbhsdma.c | 56 +- drivers/usb/musb/sunxi.c | 4 +- drivers/usb/musb/tusb6010.c | 2 +- 14 files changed, 895 insertions(+), 72 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txt create mode 100644 drivers/usb/musb/mediatek.c