Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp508715ybg; Fri, 18 Oct 2019 03:15:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFvdT5DKiV5EcWDTgybM/ch2ut1OykOriFct6ikIlsERkljUYw6RQanzUEuKtfuWurw06A X-Received: by 2002:a05:6402:1514:: with SMTP id f20mr8798506edw.35.1571393733926; Fri, 18 Oct 2019 03:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571393733; cv=none; d=google.com; s=arc-20160816; b=VhOo8aX95gAvDQWv2XuSDkyeWggKLa/n4Nl7SQEgsOPOv8CealE2N5uaVOe7nkALE0 Eco7AMqBfK1XTo2JrCytdk9aRHNCFPXaHxFe9WXXOax1BBw0s0h5msu803GQqB53sUlz 6JnPST7mxveZKygWI3CmgeMzros7AVxkUl7JiGzAQlrjNd3y7Wghd7vakPgVZs9VBurX LucuRXXmuQnoDhZ2FotVqdtahicftyYWnaVGsqMxHDH5TfrdzfmpQW+MUhG+fmvrcqKp WSZjSf5lfqgdfV0X0xso0e1hkIXJ0usTkKJPtfleYAiJGiMesNCKBfUQku6bvnjWImtr 96lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Xs0/Ss37czThR9GEbEdBdQ4SYteutngrj3zbIGG8CE0=; b=mutqSuPZMJgM98C4jfGZJNmU9REAAJqEEpVaFyD/c6B2vVWm+Jkoqq8s2DQo1rVnCM /wopEc5M9peeyrHlBV22ifi2pnbzVVJJZeTBf8Zsg2yNbacVrFwNE4VENmfoqIq8ALK6 l9YARxV2pHJPltN3DWtRIw1GWdgxbbqmXJD291NRJueQrc8wMX3SqciiOQmTkPdEf3Ns CwASSq9BfbZ9Ro7mlVPuELaDmLeg6eHxwU+utyViNgO++IF4IDOkQgP4KZDF907YIjrR aU69PmT/uSzkJpISHTzY7f0rgduxs9cOZvlN3wx3pwMQjw3o2jNYQD3lQPo2sx7NJroL iwiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si3500866edq.289.2019.10.18.03.15.10; Fri, 18 Oct 2019 03:15:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408247AbfJQI0U (ORCPT + 99 others); Thu, 17 Oct 2019 04:26:20 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:30197 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387581AbfJQI0U (ORCPT ); Thu, 17 Oct 2019 04:26:20 -0400 X-UUID: ac8042f2d8c74c4bab2f984771d7d9bd-20191017 X-UUID: ac8042f2d8c74c4bab2f984771d7d9bd-20191017 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1164182793; Thu, 17 Oct 2019 16:26:08 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 17 Oct 2019 16:26:04 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 17 Oct 2019 16:26:03 +0800 From: To: Bin Liu , Rob Herring CC: Greg Kroah-Hartman , Mark Rutland , Matthias Brugger , Alan Stern , , , , , , , , , Min Guo Subject: [PATCH RESEND v7 0/6] Add MediaTek MUSB Controller Driver Date: Thu, 17 Oct 2019 16:25:48 +0800 Message-ID: <20191017082554.27953-1-min.guo@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 5873172F392C39E2384854588EDDAB7493890FBB8452BFEB0DE11811A9F88D1E2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v7: changes of dt-bindings and DTS: 1. Change compatible string 2. Change usb connector child node compatible as "gpio-usb-b-connector" changes in v6: changes of dt-bindings: 1. Modify usb connector child node changes of DTS: 1. Modify usb connector child node changes of driver: 1. Add of_platform_populate in probe to populate connector platform_devices from device tree data 2. Replace extcon with usb role switch mechanism to support dual-role mode, depends on [1] 3. Remove set vbus function [1] [v6,09/10] usb: roles: add USB Type-B GPIO connector driver https://patchwork.kernel.org/patch/10966361/ 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 | 55 ++ arch/arm/boot/dts/mt2701-evb.dts | 21 + arch/arm/boot/dts/mt2701.dtsi | 33 ++ drivers/usb/musb/Kconfig | 9 +- drivers/usb/musb/Makefile | 1 + drivers/usb/musb/mediatek.c | 582 +++++++++++++++++++++ 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, 845 insertions(+), 72 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,musb.txt create mode 100644 drivers/usb/musb/mediatek.c -- 1.9.1