From patchwork Mon Oct 5 12:06:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7326981 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F2D65BEEA4 for ; Mon, 5 Oct 2015 12:06:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0178920675 for ; Mon, 5 Oct 2015 12:06:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8F3820684 for ; Mon, 5 Oct 2015 12:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751391AbbJEMGo (ORCPT ); Mon, 5 Oct 2015 08:06:44 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:50603 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750973AbbJEMGn (ORCPT ); Mon, 5 Oct 2015 08:06:43 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 05 Oct 2015 21:06:41 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 5F3784E50D; Mon, 5 Oct 2015 21:06:41 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 60FAB8002F; Mon, 5 Oct 2015 21:06:41 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 5B58C8002D; Mon, 5 Oct 2015 21:06:41 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id XAE29165; Mon, 5 Oct 2015 21:06:41 +0900 X-IronPort-AV: E=Sophos;i="5.17,638,1437404400"; d="scan'";a="195770773" Received: from mail-hk2apc01lp0209.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.209]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 05 Oct 2015 21:06:40 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by TY1PR06MB0927.apcprd06.prod.outlook.com (10.164.99.153) with Microsoft SMTP Server (TLS) id 15.1.286.20; Mon, 5 Oct 2015 12:06:38 +0000 From: Yoshihiro Shimoda To: , CC: , , Yoshihiro Shimoda Subject: [PATCH 1/4] usb: host: xhci-rcar: add xhci_rcar_is_compatible() function Date: Mon, 5 Oct 2015 21:06:27 +0900 Message-ID: <1444046790-5804-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1444046790-5804-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1444046790-5804-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR0201CA0029.apcprd02.prod.outlook.com (25.164.90.167) To TY1PR06MB0927.apcprd06.prod.outlook.com (25.164.99.153) X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0927; 2:qOxD0dWJg1G0xT+3uz3q8knotUZudhXqYCJN/CJiFK5N7RxWIkS7UbcSPNl/IyRAPI06Iu/98wEhfH8TaH8Y4NOlEQ3kmcvMabAQOVlTlulPaxobrrpNoqcTc040T7ZAr6fUugGoGof+nSK+1vdlV25JGJxyPWI1krPYkxAoQU0=; 3:3pj/09EAiVRMuBuf1QF3ac2h6nTfBxv9IECNUiV8MhNXM0ycYLWVjI4mb+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pFQV+3FDiwS4G7S+m0WapmbJtRz3ihDkegzlWedlfFttWpwlUihYsRSe/MjIsU75LpAOz5z2O3dPkDFVbwbEXo0TghXF4cad0DUnHX/OqYsk2nTrz7dhFsTYjFhWyxOW5f5XOl63y2LtpyHwgNmGwmIiv5fq0/BOMdUejKkYvAQ7zSXloDbqT1WjHVp2Ev4ooUiRDi+7HWix7Mk0y1TeUUELaxE8SROQRnb7vGL3jlxffI9WCitf75zxD3l6g/wJfX/ung/YIrQpw78zqK3QUU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001); SRVR:TY1PR06MB0927; BCL:0; PCL:0; RULEID:; SRVR:TY1PR06MB0927; X-Forefront-PRVS: 07200C0526 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(199003)(189002)(5003940100001)(36756003)(575784001)(106356001)(19580405001)(19580395003)(5001960100002)(107886002)(33646002)(229853001)(92566002)(87976001)(105586002)(2950100001)(189998001)(77096005)(68736005)(50226001)(77156002)(46102003)(78352002)(5008740100001)(62966003)(5004730100002)(81156007)(50466002)(5001830100001)(4001540100001)(5001860100001)(66066001)(97736004)(42382002)(48376002)(64706001)(40100003)(122386002)(5007970100001)(47776003)(101416001)(76176999)(76506005)(42186005)(50986999)(5001770100001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR06MB0927; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TY1PR06MB0927; 23:uaq44yUeTUmvDT7h+bt6+DjEY+9KHaywvUL3YG15b?= =?us-ascii?Q?whfVT3fLwaXS2j0/dhZiDDaq/saAz5TORByP4K8z9hu0/3ieHiEpqIGe6fXv?= =?us-ascii?Q?37TQ0yL5PTc3PEtGZc5V1MGm2cnmBhMzp7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QztfSf50+zOSjKqcMaPPGR8IG66FMyOafrUch9utQi?= =?us-ascii?Q?zjeuYgf7AYs41YnCiJa4PFAfoAjupo+h/Z1oT5p65eucqbl67d8j5u6/zP8i?= =?us-ascii?Q?bVNUzsbF15ydMyT87ar6muSw7h2ArvnlObiQddEfmbyEo9+97hrzDiy1RVKv?= =?us-ascii?Q?/wSmKTx1AfVh8Rp0Rzho54H5879i2ZS1BnsCyLAAOVI9kjRAETNecscv+Pe/?= =?us-ascii?Q?1vJ9NzMf9G0I2EA8hUGH0EBHBbTv1Mb07lQxdg2hql0faDzdxpnZ2xkahiSJ?= =?us-ascii?Q?ubsUa9n/+LX0BkTeiOmxKG+m5/3HC2mlyVQp9OHbDer?= X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0927; 5:2bBL6ylLc8gclxJygkBW6UHty3V8KJfh3Hx8uEmvU5z6p9s4DP9++wW286/MdiLFYHjJx5Y5eXF1IaucLtxXRrs9faMU3Jl9b19jgjV01KWsdit9eRJyehcflt+U4MJytJDDrDOJVFMpTybOi/WvPA==; 24:2J9IFvkg1uUHKNi4CaRAVTJaDfT5CDL0P0lDW7BkR8GIS08oQnrUFa8lApATPlNViGkuk/0/0FzhyqGSzhYy20h89Ou7P2kB/SU8aXOm2mA=; 20:qRlxN4p6F+gakC6pFqckxCk8VOHYTuBSqb7xgqFS3mjJwEClcpLF3hYtdAb8vdDsdi9zIDbiXITDJBPJo8tZ6vRKvzFUtQvPMjgRiZlaozjR4TSrFkY/MJbBWConR6kebjaTFPFUQudrwIdfs2qe+2+AyzHD5eReC4LYUV4Ugdw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2015 12:06:38.7288 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR06MB0927 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To add support for other SoCs in the future, this patch adds xhci_rcar_is_compatible() to check the compatible string. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/host/xhci-plat.c | 9 ++------- drivers/usb/host/xhci-rcar.c | 12 ++++++++++++ drivers/usb/host/xhci-rcar.h | 6 ++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 890ad9d..26acece 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -48,11 +48,9 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) /* called during probe() after chip reset completes */ static int xhci_plat_setup(struct usb_hcd *hcd) { - struct device_node *of_node = hcd->self.controller->of_node; int ret; - if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") || - of_device_is_compatible(of_node, "renesas,xhci-r8a7791")) { + if (xhci_rcar_is_compatible(hcd)) { ret = xhci_rcar_init_quirk(hcd); if (ret) return ret; @@ -63,10 +61,7 @@ static int xhci_plat_setup(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd) { - struct device_node *of_node = hcd->self.controller->of_node; - - if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") || - of_device_is_compatible(of_node, "renesas,xhci-r8a7791")) + if (xhci_rcar_is_compatible(hcd)) xhci_rcar_start(hcd); return xhci_run(hcd); diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index ff0d1b4..642fe55 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -56,6 +57,17 @@ MODULE_FIRMWARE(FIRMWARE_NAME); #define RCAR_USB3_RX_POL_VAL BIT(21) #define RCAR_USB3_TX_POL_VAL BIT(4) +bool xhci_rcar_is_compatible(struct usb_hcd *hcd) +{ + struct device_node *of_node = hcd->self.controller->of_node; + + if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") || + of_device_is_compatible(of_node, "renesas,xhci-r8a7791")) + return true; + + return false; +} + void xhci_rcar_start(struct usb_hcd *hcd) { u32 temp; diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h index 5850125..0eb67fa 100644 --- a/drivers/usb/host/xhci-rcar.h +++ b/drivers/usb/host/xhci-rcar.h @@ -12,9 +12,15 @@ #define _XHCI_RCAR_H #if IS_ENABLED(CONFIG_USB_XHCI_RCAR) +bool xhci_rcar_is_compatible(struct usb_hcd *); void xhci_rcar_start(struct usb_hcd *hcd); int xhci_rcar_init_quirk(struct usb_hcd *hcd); #else +static inline bool xhci_rcar_is_compatible(struct usb_hcd *hcd) +{ + return false; +} + static inline void xhci_rcar_start(struct usb_hcd *hcd) { }