From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-1668029-1516798721-2-8412906501980525116 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, T_TVD_MIME_EPI 0.01, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='org', MailFrom='org' X-Spam-charsets: X-Attached: signature.asc X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: linux-usb-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1516798721; b=icMwAcAgADxBaDHjBgpBgnub2b2dNFsfeSLCvVikE4coQ5e CmkCqTf/I0/+sIzMCqSSeVB31u1JAKBzxdUTcLEJzfR9HSK+lldbxFxskQyueB8j sD4A4mdeBzEJ7XkypplTitb5iOfwykbwUhg+UidQxJxxFn/wrecwcWileYF20B3A padQcyvxFeCZx+NNwJgUCT30SpmecwXZkuIIdClJqsQGcQr3rwMmYC2QfKI8lAy8 /qZfBcgCzjW9deKjyqxDnIaU0ak7XSa82UNA6ZlHtzXaYtSeJQM4ogix88Qqv/Ih z/sGUc739J6jSwBbOfQUWlUyfrVJdXe3p26KGfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:in-reply-to:references :date:message-id:mime-version:content-type:sender:list-id; s= arctest; t=1516798721; bh=IuGnBYPoCWkeCIYeNts+Ec5svN5kWYtizRCSmQ ajpwQ=; b=oEXeQch+nPbfFwbj+Igi1CST5F/EWaHyAhzUcbeu+VI+lDrGJvLQbb BDReoQQWeqKppwLz2GjoDtFz6SctIhiAQuRuayjxJhpB5Mk9MlF8F7RUGAmjfLle xQ6GDXpjKtswx3kcEgmt5pnA0ht/Ko4p8VEy0hAlJTwWVLiuw/aPfCOYI0Ftuocu LNa3ixvKhSOzOWj7NHQvm72heuGYjbrMI2i9ly5WABYN6gCx+a98Hukd93wGiRiC OhwFZ/inh539v2eiIwEwJjuRS75QcPX4umGWf/C80lvFgyKyJv6s3yaazr07X3yr 9Iu/5VnVAqDQqki7JmeP+qEL3MPozOVw== ARC-Authentication-Results: i=1; mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=kernel.org; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); smime=temperror; spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=orgdomain_pass; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=kernel.org header.result=pass header_is_org_domain=yes Authentication-Results: mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=kernel.org; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); smime=temperror; spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=orgdomain_pass; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=kernel.org header.result=pass header_is_org_domain=yes Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933588AbeAXM6X (ORCPT ); Wed, 24 Jan 2018 07:58:23 -0500 Received: from mga14.intel.com ([192.55.52.115]:46474 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933467AbeAXM6X (ORCPT ); Wed, 24 Jan 2018 07:58:23 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,407,1511856000"; d="asc'?scan'208";a="198265512" From: Felipe Balbi To: Kunihiko Hayashi Cc: linux-usb@vger.kernel.org, Greg Kroah-Hartman , Masahiro Yamada , Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jassi Brar , Masami Hiramatsu , Kishon Vijay Abraham I Subject: Re: [PATCH 2/4] usb: dwc3: add dwc3 glue layer for UniPhier SoCs In-Reply-To: <20180124215228.ED43.4A936039@socionext.com> References: <1516712454-2915-3-git-send-email-hayashi.kunihiko@socionext.com> <87o9lklnwb.fsf@linux.intel.com> <20180124215228.ED43.4A936039@socionext.com> Date: Wed, 24 Jan 2018 14:58:12 +0200 Message-ID: <87a7x3l8gr.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-usb-owner@vger.kernel.org X-Mailing-List: linux-usb@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Kunihiko Hayashi writes: > Hello Felipe, > > Thank you for your comments. > > On Tue, 23 Jan 2018 15:12:36 +0200 wrote: > >>=20 >> Hi, >>=20 >> Kunihiko Hayashi writes: >> > Add a specific glue layer for UniPhier SoC platform to support >> > USB host mode. It manages hardware operating sequences to enable multi= ple >> > clock gates and assert resets, and to prepare to use dwc3 controller >> > on the SoC. >> > >> > This patch also handles the physical layer that has same register space >> > as the glue layer, because it needs to integrate initialziation sequen= ce >> > between glue and phy. >> > >> > In case of some SoCs, since some initialization values for PHY are >> > included in nvmem, this patch includes the way to get the values from = nvmem. >> > >> > It supports PXs2 and LD20 SoCs. >> > >> > Signed-off-by: Kunihiko Hayashi >> > Signed-off-by: Motoya Tanigawa >> > Signed-off-by: Masami Hiramatsu >> > --- >> > drivers/usb/dwc3/Kconfig | 9 + >> > drivers/usb/dwc3/Makefile | 1 + >> > drivers/usb/dwc3/dwc3-uniphier.c | 554 ++++++++++++++++++++++++++++++= +++++++++ >> > 3 files changed, 564 insertions(+) >> > create mode 100644 drivers/usb/dwc3/dwc3-uniphier.c > > ...snip... > >> > + >> > +static void dwc3u_ssphy_testio_write(struct dwc3u_priv *priv, int por= t, >> > + u32 data) >>=20 >> anything with sshphy or hsphy in the name should probably be part of a >> PHY driver using drivers/phy/ framework. > > I can try to separate phy control from this driver. > However, phy registers belongs to "dwc3-glue" IO map area (65b00000), > and this area also contains a reset bit for "dwc3-core" hardware. > > Although the phy driver is called from dwc3-core driver, > we need to deassert the reset bit before probing dwc3-core driver. > > As shown later, I think that it's difficut to determine the order of > initializing the registers in this area. > >> > +static void dwc3u_vbus_disable(struct dwc3u_priv *priv) >> > +{ >> > + int i; >> > + >> > + for (i =3D 0; i < priv->nvbus; i++) { >> > + dwc3u_maskwrite(priv, VBUS_CONTROL(i), >> > + DRVVBUS_REG_EN | DRVVBUS_REG, >> > + DRVVBUS_REG_EN | 0); >> > + } >> > +} >>=20 >> drivers/regulator maybe? > > VBUS_CONTROL register is used for determing whether "dwc3-glue" hardware > enables vbus connected with "regulator" hardware. > > The regulator driver should manage "regulator" hardware, and > I don't think that the driver should manage this register. > >> > +static void dwc3u_reset_init(struct dwc3u_priv *priv) >> > +{ >> > + dwc3u_maskwrite(priv, RESET_CTL, LINK_RESET, 0); >> > + usleep_range(1000, 2000); >> > + dwc3u_maskwrite(priv, RESET_CTL, LINK_RESET, LINK_RESET); >> > +} >> > + >> > +static void dwc3u_reset_clear(struct dwc3u_priv *priv) >> > +{ >> > + dwc3u_maskwrite(priv, RESET_CTL, LINK_RESET, 0); >> > +} >>=20 >> drivers/reset ? > > The reset driver manages "sysctrl" IO map area in our SoC. > > RESET_CTL register belongs to "dwc3-glue" IO map area, > and the kernel can't access this area until enabling usb clocks and > deasserting usb resets in "sysctrl". > > I think that "dwc3-glue" register control should be separated from > "sysctrl". Just split your address space and treat your glue as a device with several children: glue@65b00000 { compatible =3D "foo" phy@bar { ... }; sysctrl@baz { ... }; dwc3@foo { compatible =3D "snps, dwc3"; ... }; }; Then you know that you can let dwc3/core.c handle the PHY for you. If we need to teach dwc3/core.c about regulators, we can do that. But we don't need SoC-specific hacks ;-) =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlpoguQACgkQzL64meEa mQbRig//eBvVqrK+Aq+5r/T2462ZCdpPzRg6hIL5K6DWWYUHGx9k0bLLFvjiniVf k6BViNvKbW717IyhwOeB9VplrLPlAfu8i8bKf382a6lWryO7l8xhDPfl2aTW9toz +DABlwZgWsxyHYIfgOlv4h89WOXYAGdKAywIAc7/qH4WAF1SUxoabfxL0L9NM6YT gP0PN1U7xUp4kCkSFkF8J6ub/cxFsxUZx7lRIdhfWe2S+ulaclktlbs1Hv5eRiGD XyzuVGXjjZNIy4pw7G/BQcQ1JOb13r6W/7cc4D9Gl8XdDcxNLLeP7w/rZADnTLwr 7NDdg9/+SkI07oFMx/heGIQeZ3T3coYkecIq2CB+B6B2PkmgahCSH2AYYopSjyVp 2QGvxLdsSAVA1w4dgdK/De+n4mSkcMOF0DcpbyfXVixwtz1C+HrAosjeMa3iBHGr Ja1a32MAaQgg1SG2QzSFnFSHiBiml8I7Rn5MQFrOkCQi7fv75mwma+mYxG7nQhgy 9kRMJ+4s5/7hikEjQvlIE++sdIsFFnPOV+o9q9VGOuOUvqC2r8NhYTw+w/R2TGul Eie6kB1O+WpFZkb3kB/laAtnk113MEXnAFR8JGQmAiZQ79jlBIZ3/8BB4Al4NYkc PEU5kWz5+SnjtmyY2cNCS/VLlVGEAE8nrPHEhLfbgDXLyXwF32c= =ZeYo -----END PGP SIGNATURE----- --=-=-=--