From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753207AbcJKCoV (ORCPT ); Mon, 10 Oct 2016 22:44:21 -0400 Received: from mailgw01.mediatek.com ([218.249.47.110]:33025 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753098AbcJKCoT (ORCPT ); Mon, 10 Oct 2016 22:44:19 -0400 Message-ID: <1476153846.15546.15.camel@mhfsdcap03> Subject: Re: [RESEND PATCH v6, 3/5] usb: xhci-mtk: make IPPC register optional From: Chunfeng Yun To: Matthias Brugger CC: Greg Kroah-Hartman , Felipe Balbi , Mathias Nyman , Oliver Neukum , Alan Stern , Rob Herring , Mark Rutland , "Ian Campbell" , Sergei Shtylyov , Pawel Moll , Kumar Gala , Sascha Hauer , Alan Cooper , , , , , Date: Tue, 11 Oct 2016 10:44:06 +0800 In-Reply-To: <62b78471-d93f-a5c2-20ef-dfeeea1720db@gmail.com> References: <1474437277-27201-1-git-send-email-chunfeng.yun@mediatek.com> <1474437277-27201-4-git-send-email-chunfeng.yun@mediatek.com> <62b78471-d93f-a5c2-20ef-dfeeea1720db@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-10-10 at 12:55 +0200, Matthias Brugger wrote: > > On 09/21/2016 07:54 AM, Chunfeng Yun wrote: > > Make IPPC register optional to support host side of dual-role mode, > > due to it is moved into common glue layer for simplification. > > > > Signed-off-by: Chunfeng Yun > > --- > > drivers/usb/host/xhci-mtk.c | 36 +++++++++++++++++++++++++++++------- > > 1 file changed, 29 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c > > index 79959f1..4bf99b9 100644 > > --- a/drivers/usb/host/xhci-mtk.c > > +++ b/drivers/usb/host/xhci-mtk.c > > @@ -94,6 +94,9 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) > > int ret; > > int i; > > > > + if (ippc == NULL) > > + return 0; > > + > > /* power on host ip */ > > value = readl(&ippc->ip_pw_ctr1); > > value &= ~CTRL1_IP_HOST_PDN; > > @@ -139,6 +142,9 @@ static int xhci_mtk_host_disable(struct xhci_hcd_mtk *mtk) > > int ret; > > int i; > > > > + if (ippc == NULL) > > + return 0; > > + > > /* power down all u3 ports */ > > for (i = 0; i < mtk->num_u3_ports; i++) { > > value = readl(&ippc->u3_ctrl_p[i]); > > @@ -173,6 +179,9 @@ static int xhci_mtk_ssusb_config(struct xhci_hcd_mtk *mtk) > > struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; > > u32 value; > > > > + if (ippc == NULL) > > + return 0; > > + > > I would prefer to add a flag/bool in xhci_hcd_mtk to signal the absence > of the ippc. Or at least use a macro which checks the presence before > calling any of this three functions. Ok. I will modify it later. thanks. > > Regards, > Matthias