From patchwork Sun Nov 18 10:09:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Laszczak X-Patchwork-Id: 10687707 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 9423613BB for ; Sun, 18 Nov 2018 10:11:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8115429D43 for ; Sun, 18 Nov 2018 10:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7374429D38; Sun, 18 Nov 2018 10:11:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B254629D38 for ; Sun, 18 Nov 2018 10:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727491AbeKRUbC (ORCPT ); Sun, 18 Nov 2018 15:31:02 -0500 Received: from mx0b-0014ca01.pphosted.com ([208.86.201.193]:41282 "EHLO mx0a-0014ca01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727374AbeKRUbC (ORCPT ); Sun, 18 Nov 2018 15:31:02 -0500 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wAIA8s12007707; Sun, 18 Nov 2018 02:10:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=G4WTivoVWNC8CzhOVrnihtRPizlwoQD21JVx9xHSCJg=; b=tTj7q0XiG7bKryXi+P6Jx5r7ccuz6veXZQu2M6ADAP2ALX2HwXs9IMlLpzKSGK7CRcaW UbiQCEBWB/NVoLUg+GGpUk+hR7V1hJebFYNm183qm7tXN9zgnsXPk974SNZekZO9hp2s dHMT1pcvBlkBH/VbdlFw29QNG/J7HvbxPIDBwu/MbGYScw+zNBwcF8ctuQJ4HA3yCVEJ RQLK8v4AICP6Q3vkW74/h4p5EFeaY8Eko8mK9phUaqZQNB6VjrF8wc+kflTQzd4coss+ yU6CfQTGmhSzVuT8ZQdaKF8ITkZdmonlGo2d5tr86m1GEZlbLLbZ1TtrL8+jv35o2nQF Eg== Authentication-Results: cadence.com; spf=pass smtp.mailfrom=pawell@cadence.com Received: from nam03-by2-obe.outbound.protection.outlook.com (mail-by2nam03lp0048.outbound.protection.outlook.com [216.32.180.48]) by mx0b-0014ca01.pphosted.com with ESMTP id 2ntff7w460-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 18 Nov 2018 02:10:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G4WTivoVWNC8CzhOVrnihtRPizlwoQD21JVx9xHSCJg=; b=sQwznuVQMCWInTFi1uQMh1ipKvZIvnU4fNuXBEs+tGKVu4pYoHMekyX/B9cKYWZPfWs2HsUHS1XJCTU7qC9UOO41stqLyj18i/a3Akw2lRe4bRXnt8tC79hJMzxjoIx2lHNGeJ+TTAfTzv1KiDGKYdDqRzZVNDYVOgPyy7CJ8/w= Received: from DM5PR07CA0068.namprd07.prod.outlook.com (2603:10b6:4:ad::33) by BLUPR0701MB1858.namprd07.prod.outlook.com (2a01:111:e400:5165::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.23; Sun, 18 Nov 2018 10:10:52 +0000 Received: from CO1NAM05FT025.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::200) by DM5PR07CA0068.outlook.office365.com (2603:10b6:4:ad::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.20 via Frontend Transport; Sun, 18 Nov 2018 10:10:51 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning cadence.com discourages use of 158.140.1.28 as permitted sender) Received: from sjmaillnx2.cadence.com (158.140.1.28) by CO1NAM05FT025.mail.protection.outlook.com (10.152.96.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.3 via Frontend Transport; Sun, 18 Nov 2018 10:10:47 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by sjmaillnx2.cadence.com (8.14.4/8.14.4) with ESMTP id wAIAAb5W029622 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Sun, 18 Nov 2018 02:10:46 -0800 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 18 Nov 2018 11:10:44 +0100 Received: from lvlogina.cadence.com (10.165.176.102) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sun, 18 Nov 2018 11:10:44 +0100 Received: from lvlogina.cadence.com (localhost.localdomain [127.0.0.1]) by lvlogina.cadence.com (8.14.4/8.14.4) with ESMTP id wAIAAfpR032414; Sun, 18 Nov 2018 10:10:41 GMT Received: (from pawell@localhost) by lvlogina.cadence.com (8.14.4/8.14.4/Submit) id wAIAAfB8032388; Sun, 18 Nov 2018 10:10:41 GMT From: Pawel Laszczak To: CC: , , , , , , , , , , , , "Pawel Laszczak" Subject: [RFC PATCH v2 14/15] usb:cdns3: Adds debugging function. Date: Sun, 18 Nov 2018 10:09:10 +0000 Message-ID: <1542535751-16079-15-git-send-email-pawell@cadence.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1542535751-16079-1-git-send-email-pawell@cadence.com> References: <1542535751-16079-1-git-send-email-pawell@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:158.140.1.28;IPV:CAL;SCL:-1;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(2980300002)(189003)(199004)(36092001)(50466002)(186003)(2351001)(246002)(6916009)(16586007)(7636002)(305945005)(478600001)(87636003)(36756003)(26826003)(48376002)(54906003)(8676002)(5660300001)(11346002)(2616005)(126002)(476003)(47776003)(2906002)(426003)(356004)(6666004)(8936002)(107886003)(336012)(446003)(105596002)(486006)(4720700003)(50226002)(26005)(316002)(42186006)(86362001)(575784001)(106466001)(51416003)(76176011)(217873002)(4326008)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0701MB1858;H:sjmaillnx2.cadence.com;FPR:;SPF:SoftFail;LANG:en;PTR:corp.cadence.com;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT025;1:vPXnVcdBZ2o5JAq6rW2VR/WX097kYfCsSuo1wYwVjuJHXdeXRDb+hxSdywsHUOSMXaehLpdBY7RUQ4MF9tDDYYuvhTHqpT14I5zwtM5uAYcoMSF9ual3hauMGdVC7ZdP X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 598b90f7-6459-496f-3827-08d64d3e1e31 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060);SRVR:BLUPR0701MB1858; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1858;3:zOIYXJspRdbVe4gDj0V+zka6xdOaGCpCcmrfxdSoQ+LR+gqIjp3DReX1uiRi1LW2k1vt4UbDYlpZf4IIeuhPE+fQVVywjb+0x+UT4DDlTEv6MCH58PDlGxCY40G4tWtNP2VKNwMf9SJcSqKi1U8EELkKSbx3JWluN6uDNvTPrEfEC5RzVKogcg7qPzGD5dqY6uZHk4ISDjuUf3bS1KzD8MgfllnmSg7nj5XCtgXFiK+V7TF2e+7lgB2YGOVOYpphe+gj27fGUrkVzU4XwLUv/ZTb9xNm0clYxEY76PQkZLK+o2w24HmqYMSC5m0D9QcPuy4lgvDJ7EpbW7kH1PXcPqKTvJ3X7z0dwsNN44rayPc=;25:PoR83cnhCCXOIP8SOwC/3PWsRsE+eO/FTsVFYEMo9f7ujg1lH/tThK0TgIk6JdBaRtzVyBI5K+ei+j6PQvx9jrNX7vGvMyqVDSCeRKT0rwIbnylg6kd+StGKP9/kyjzp8+fttfHVlJ8aJFpMPolCXb/NgGSVodzWQh1hhLraTfJ3g0qPiCQW18QqoJRFWtmm1dZTy92QP8DQRGWj4hkzv5qW386/H71vj+/9L8lTEKA3xvSDtEJE5xA+hgxDLBpQx9KcQMPNJSso5snbdFwVXVClBF5L1q5N/sVn2oXTz1t+aGEwm993iut6ZfG1wvXxOg/AsB6lsIvZE/CDd5w33YRKZYDNrqGGFrZ9ySPYJ/I= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1858: X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1858;31:p1r784d/cAGT4nbHOSYw0am2FqWBidpDoSwgEOHCfNB29Pp8XNfTIHF4qAgMrCXDkzvksfZRlAhTR14167dBvRHGOAAQ2p8sl4yMZh/tKxcB/fnlKzqaKqUzACMGySknr0cwaLA57Doc0RTIfRW56L58yM/62WpRjNp+aR6eiYHE/44ZwCX4VahovRD482Ka0gXw2FEJd+uvQUJ6669zb0o8ExO3NZRhWiUkUhiERQQ=;20:BOpfxzRX6is31siYJICh9xKoaJhpE3y+CD1x4rUmQqdCLNKOiXzwbbS4uSTRhKlqwRPmjm0n1ghv1C3zWglKPd21d8PdyE2/SYrrlHyqc7pG/KE2z8Z5/ewTUiKy6A6CZkZjKCpUL5tHuKZw9UYZBv9giS5qbNaxGC51StIWO+rbkdRbHKv6gJA95v6vLjFAyhjBOVXE9LeufPwjMUilnEbT+Ez5dNaTCqPgDwsualxVucU4Eo2tJRokcMQC8eoX8aJt9uXb0cO3X6GNqo2dTPsrMyWfQvGM8k5k8Oj/lI3X+prFnB1OM+XI3zKQXdLCVz0w7v1VbignnH8VAU1YEtvRL+3wSY3EWTee4mXQmx52lNYDdnXOZEilqBDHSxGk5TDKQHXACF8li+4pMI/h7j779+Nk++GFT5rZR5O7n257dW0HU36hVKVZ39PaxVcZHXCRS5raciE5yXB/YcLdAWn6LemVHJvQbzGXit+i3nTyYbJDEg8aRBiffc2PIvbh X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(10201501046)(3002001)(3231415)(944501410)(52105112)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:BLUPR0701MB1858;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1858; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1858;4:xEUBFbbrEuqbkkxrGO5f4BirSqrtkzP7Uwbe0v2uI1QsCD2AxxijhcNgDsr1tAxzQh9ElDQgS1x8Ae5yA8B2a5Um/DCkRE+q5HgbmqXhOr2SZKLQqMI409Nc7gRziYQgi+Yhz32SpkNquLdbm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d55GMQLIsWu29pchgon4mqfMg6bd3KAU6cxeAgiNW4682tHSJhXfU7JHBx0A3dRJzVVz0WiImtanciI+Xea/ih0jSTYklXN8TUTmzVjpefjUwzDX1NoA2K0sMKtV+dNxug19E/589ZEihVuY=;5:FDp44iWodHxUB26qt2LZeeGj6lxwiJpyV/oZqA/UxqfjFUxZpO0QiAmLmIzspbOEUwfKeNcmUUJXZa5tfUBBAzO9PfvPlW+q/p76E0qWVXXWdYQ8LCKhV0+zCpb/fE7sVZVPP2xiMk8WPr8QKPfYPcxL810FE7gna6LZC3y4ywI=;7:vrIuHEQOKIrqMdNtJZekMWxFzQ/2BKoWtbOfcCK1/jzcftfRUUg8sUgk+EHZWqBdBdv5MfcoCyylz1XKQ8sGEhChutRYwSL+XtPtTzPfeOi3ijWKVvYyl1Qc4ZcbtMbMfBbXV3rRGMO9o8r6MnfwDg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR0701MB1858;20:XmzIh8YoO55OfHIwYzFfhz7bDzdOitK2YT3prKC1nxWiwNbGeoHuVAJJOyujrTahYCBH3ANWm/1jx7Lcvxem0cFmYDiYrFQgjJmTi3iZD3plv62hifaq7XzdYOlicUgwhRASKTWtNglcmUJyXm/eZxG/4H4GpfX5hxzKon0qGjaYgUpMalvMu6vmtBI72LxUMaPLPausrDvZuXtNm9i78IyfiVED2PuG8tTlpAj/jwJhuJl43RLJ77oX5JvUfDHu X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2018 10:10:47.6230 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 598b90f7-6459-496f-3827-08d64d3e1e31 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9;Ip=[158.140.1.28];Helo=[sjmaillnx2.cadence.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1858 X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 a:mx-sanjose2.Cadence.COM a:mx-sanjose4.Cadence.COM a:mx-sanjose5.Cadence.COM include:mktomail.com include:spf-0014ca01.pphosted.com include:spf.protection.outlook.com include:auth.msgapp.com include:spf.mandrillapp.com ~all X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-18_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=936 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811180097 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Patch implements some function used for debugging driver. Signed-off-by: Pawel Laszczak --- drivers/usb/cdns3/Makefile | 4 +- drivers/usb/cdns3/debug.c | 128 +++++++++++++++++++++++++++++++++++++ drivers/usb/cdns3/ep0.c | 3 + drivers/usb/cdns3/gadget.c | 12 ++++ drivers/usb/cdns3/gadget.h | 13 +++- 5 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/cdns3/debug.c diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile index bea6173bf37f..34e60d03c4ec 100644 --- a/drivers/usb/cdns3/Makefile +++ b/drivers/usb/cdns3/Makefile @@ -2,6 +2,6 @@ obj-$(CONFIG_USB_CDNS3) += cdns3.o obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci.o cdns3-y := core.o drd.o -cdns3-$(CONFIG_USB_CDNS3_GADGET) += gadget.o ep0.o -cdns3-$(CONFIG_USB_CDNS3_HOST) += host.o +cdns3-$(CONFIG_USB_CDNS3_GADGET) += gadget.o ep0.o debug.o +cdns3-$(CONFIG_USB_CDNS3_HOST) += host.o cdns3-pci-y := cdns3-pci-wrap.o diff --git a/drivers/usb/cdns3/debug.c b/drivers/usb/cdns3/debug.c new file mode 100644 index 000000000000..b9a779b35789 --- /dev/null +++ b/drivers/usb/cdns3/debug.c @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Cadence USBSS DRD Driver. + * + * Copyright (C) 2018 Cadence. + * + * Author: Pawel Laszczak + */ + +#include "gadget.h" + +static char *cdns3_decode_ep_irq(u32 ep_sts, const char *ep_name) +{ + static char str[256]; + int ret; + + ret = sprintf(str, "IRQ for %s: %08x ", ep_name, ep_sts); + + if (ep_sts & EP_STS_SETUP) + ret += sprintf(str + ret, "SETUP "); + if (ep_sts & EP_STS_IOC) + ret += sprintf(str + ret, "IOC "); + if (ep_sts & EP_STS_ISP) + ret += sprintf(str + ret, "ISP "); + if (ep_sts & EP_STS_DESCMIS) + ret += sprintf(str + ret, "DESCMIS "); + if (ep_sts & EP_STS_STREAMR) + ret += sprintf(str + ret, "STREAMR "); + if (ep_sts & EP_STS_MD_EXIT) + ret += sprintf(str + ret, "MD_EXIT "); + if (ep_sts & EP_STS_TRBERR) + ret += sprintf(str + ret, "TRBERR "); + if (ep_sts & EP_STS_NRDY) + ret += sprintf(str + ret, "NRDY "); + if (ep_sts & EP_STS_PRIME) + ret += sprintf(str + ret, "PRIME "); + if (ep_sts & EP_STS_SIDERR) + ret += sprintf(str + ret, "SIDERRT "); + if (ep_sts & EP_STS_OUTSMM) + ret += sprintf(str + ret, "OUTSMM "); + if (ep_sts & EP_STS_ISOERR) + ret += sprintf(str + ret, "ISOERR "); + if (ep_sts & EP_STS_IOT) + ret += sprintf(str + ret, "IOT "); + + return str; +} + +char *cdns3_decode_epx_irq(struct cdns3_endpoint *priv_ep) +{ + struct cdns3_device *priv_dev = priv_ep->cdns3_dev; + + return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts), + priv_ep->name); +} + +char *cdns3_decode_ep0_irq(struct cdns3_device *priv_dev, int dir) +{ + if (dir) + return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts), + "ep0IN"); + else + return cdns3_decode_ep_irq(readl(&priv_dev->regs->ep_sts), + "ep0OUT"); +} + +void cdns3_dbg_setup(struct cdns3_device *priv_dev) +{ + struct usb_ctrlrequest *setup = priv_dev->setup; + + dev_dbg(&priv_dev->dev, + "SETUP BRT: %02x BR: %02x V: %04x I: %04x L: %04x\n", + setup->bRequestType, + setup->bRequest, + le16_to_cpu(setup->wValue), + le16_to_cpu(setup->wIndex), + le16_to_cpu(setup->wLength)); +} + +/** + * Debug a transfer ring. + * + * Prints out all TRBs in the endpoint ring, even those after the Link TRB. + *. + */ +void cdns3_dbg_ring(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep) +{ + u64 addr = priv_ep->trb_pool_dma; + struct cdns3_trb *trb; + int i; + + for (i = 0; i < TRBS_PER_SEGMENT; ++i) { + trb = &priv_ep->trb_pool[i]; + dev_dbg(&priv_dev->dev, "@%016llx %08x %08x %08x\n", addr, + le32_to_cpu(trb->buffer), + le32_to_cpu(trb->length), + le32_to_cpu(trb->control)); + addr += sizeof(*trb); + } +} + +void cdns3_dbg_ring_ptrs(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep) +{ + struct cdns3_trb *trb; + + trb = &priv_ep->trb_pool[priv_ep->dequeue]; + dev_dbg(&priv_dev->dev, + "Ring deq index: %d, trb: %p (virt), 0x%llx (dma)\n", + priv_ep->dequeue, trb, + (unsigned long long)cdns3_trb_virt_to_dma(priv_ep, trb)); + + trb = &priv_ep->trb_pool[priv_ep->enqueue]; + dev_dbg(&priv_dev->dev, + "Ring enq index: %d, trb: %p (virt), 0x%llx (dma)\n", + priv_ep->enqueue, trb, + (unsigned long long)cdns3_trb_virt_to_dma(priv_ep, trb)); +} + +void cdns3_dbg_ep_rings(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep) +{ + dev_dbg(&priv_dev->dev, "Endpoint ring %s:\n", priv_ep->name); + + cdns3_dbg_ring_ptrs(priv_dev, priv_ep); + cdns3_dbg_ring(priv_dev, priv_ep); +} diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index 6f33d98f7684..8807cb02d7b7 100644 --- a/drivers/usb/cdns3/ep0.c +++ b/drivers/usb/cdns3/ep0.c @@ -605,12 +605,15 @@ void cdns3_check_ep0_interrupt_proceed(struct cdns3_device *priv_dev, int dir) cdns3_select_ep(priv_dev, 0 | (dir ? USB_DIR_IN : USB_DIR_OUT)); ep_sts_reg = readl(®s->ep_sts); + dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_ep0_irq(priv_dev, dir)); + __pending_setup_status_handler(priv_dev); if ((ep_sts_reg & EP_STS_SETUP) && dir == 0) { struct usb_ctrlrequest *setup = priv_dev->setup; writel(EP_STS_SETUP | EP_STS_IOC | EP_STS_ISP, ®s->ep_sts); + cdns3_dbg_setup(priv_dev); priv_dev->ep0_data_dir = setup->bRequestType & USB_DIR_IN; cdns3_ep0_setup_phase(priv_dev); diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 911d9b8c1c8f..97bdb292eaf2 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -122,6 +122,14 @@ void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep) writel(ep, &priv_dev->regs->ep_sel); } +dma_addr_t cdns3_trb_virt_to_dma(struct cdns3_endpoint *priv_ep, + struct cdns3_trb *trb) +{ + u32 offset = (char *)trb - (char *)priv_ep->trb_pool; + + return priv_ep->trb_pool_dma + offset; +} + /** * cdns3_allocate_trb_pool - Allocates TRB's pool for selected endpoint * @priv_ep: endpoint object @@ -438,6 +446,8 @@ int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, trb->control |= first_pcs; priv_req->on_ring = 1; + + cdns3_dbg_ep_rings(priv_dev, priv_ep); arm: /* arm transfer on selected endpoint */ cdns3_select_ep(priv_ep->cdns3_dev, address); @@ -547,6 +557,8 @@ static int cdns3_check_ep_interrupt_proceed(struct cdns3_endpoint *priv_ep) cdns3_select_ep(priv_dev, priv_ep->endpoint.address); ep_sts_reg = readl(®s->ep_sts); + dev_dbg(&priv_dev->dev, "%s\n", cdns3_decode_epx_irq(priv_ep)); + if (ep_sts_reg & EP_STS_TRBERR) writel(EP_STS_TRBERR, ®s->ep_sts); diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h index db8c6cb9f2a5..db5ab6b6c969 100644 --- a/drivers/usb/cdns3/gadget.h +++ b/drivers/usb/cdns3/gadget.h @@ -1089,5 +1089,16 @@ struct usb_request *cdns3_gadget_ep_alloc_request(struct usb_ep *ep, void cdns3_gadget_ep_free_request(struct usb_ep *ep, struct usb_request *request); int cdns3_gadget_ep_dequeue(struct usb_ep *ep, struct usb_request *request); - +dma_addr_t cdns3_trb_virt_to_dma(struct cdns3_endpoint *priv_ep, + struct cdns3_trb *trb); + +char *cdns3_decode_epx_irq(struct cdns3_endpoint *priv_ep); +char *cdns3_decode_ep0_irq(struct cdns3_device *priv_dev, int dir); +void cdns3_dbg_ring(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep); +void cdns3_dbg_ring_ptrs(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep); +void cdns3_dbg_ep_rings(struct cdns3_device *priv_dev, + struct cdns3_endpoint *priv_ep); +void cdns3_dbg_setup(struct cdns3_device *priv_dev); #endif /* __LINUX_CDNS3_GADGET */