Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9238794imu; Wed, 5 Dec 2018 01:08:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/W1fi+ljn5ARX6Wozrru6U1EyaMkIdaVsWA0YGuecKgYsH8/2LcWOxUk2JgK1a8c2vvLiwH X-Received: by 2002:a63:1f1c:: with SMTP id f28mr19794877pgf.193.1544000927266; Wed, 05 Dec 2018 01:08:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544000927; cv=none; d=google.com; s=arc-20160816; b=Z5GvKvxtsHIKuG0EWu5zkGv77ZdxXXiyU9ZP8OfRUDQY0lgwoKK2OnRuyIi+3vN0AR OyCzc/4qJD9XZWP1ACYx5lkhoy75LtuYHmTBT0C8Z/dIeYojxGySYOCtaTKhD9Topi15 CnLRL3SkN72c7KyAOdrf/kqkvrNee9JTk0F+rP2xVpoq3bQkRGF7jp+A9aVgceYB37DM tCfwqrzKH+X58Z8NdcdLghVgy/uiZ3ZGWRM5zshfto7haCFppMQTY0gh+6HrDRl//KmC +/DE4VtPAvxFdax3Lot2VRKizJT4OqC/RK3QNICjjwichYogNGeCv0AMgKJD3z75hp81 DD/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6glfVN2t2j7IWFh8jUfuduLOedDexDWKvkTtX6vX7uA=; b=Bs7VLgPssSHSQp0zgWEaItBEyVp8xG35pDWr1Muh6d/Bu/WRKfwBMepqFDIToluh2h xocqNaCD0J3cEtGbs7U+ehdR7Kb1XglZdR6sVFJQz1Yc0ez86XKzFXqNska3AoCE2G+L IA30aJyK2u/Fs6Pwh80uWvyCq3SdwzcGc6fbd5nM6lMRuSh73OeFctfukVVA8Ak7jvVP v0AWnPNhAToYLgiCWPHqnRCi/cZRVP9yBciwdSl5XTa53ZiIudAGSs+HX5zM0ckOnpV8 EZTOpIf0cZgcvr9aFhZi9vzDwFuKWyaJoTg6rRJwqCcWHx1uELypfUOeVPKuKTYVNUJI FJwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OJaPVBJw; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si19886909pff.77.2018.12.05.01.08.32; Wed, 05 Dec 2018 01:08:47 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OJaPVBJw; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727397AbeLEJHu (ORCPT + 99 others); Wed, 5 Dec 2018 04:07:50 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:54396 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbeLEJHt (ORCPT ); Wed, 5 Dec 2018 04:07:49 -0500 Received: by mail-it1-f193.google.com with SMTP id i145so20111205ita.4; Wed, 05 Dec 2018 01:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6glfVN2t2j7IWFh8jUfuduLOedDexDWKvkTtX6vX7uA=; b=OJaPVBJw7bRk1NOKEOj+xdeIHPnxq7ge+mAUGNBRKq+DUkRwBNzLtkFDek9EIp7hMX jARlaIazphu5n2M7mYX4/kZ/tDC07VaneXvAN59R0WiEt1csaOvcJciQTLiB9ImXB+3P HcPl/zA8dtDs+2F438BlPXFkGGlKp7U8SQz0FQsSH5A3X53eZuKao536XmKqjUJDSIHa LjGp59u3fWaDBMjy7or8OAX4WQWwAWZPjjOJnvFMXFpx+x0yM0oabOzsCgLDXH4yrTAG vVeKNr/BEVrRanDhPcOpc6G4m6k04OEA9T6KIde/puRWoEJA7STWqClEabWo9GI5OKr0 19Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6glfVN2t2j7IWFh8jUfuduLOedDexDWKvkTtX6vX7uA=; b=d9RjvcK7DSioUqZNawTaiIkaGqJmPbgoYWM6+YlSPbnsheVnN5mtenPGchNkAdRWNR cdx43xrbzcteAUAaHd7F1OSnCIeFW6Bda9BQQUiWczFH7ofdgdfHpHkRoxbLS/qOkPrY ofo9BwGT8e1eTs+aImzYU+ipF4j7K4gH1hZqkqxToUFxaMcbLW92Z/110cQWuo5YuH2A 9KiFaJHZv8+hNi2A+50Ttw5jUopKkQOf1v9Gj8OVJq7zWi2tuZFu8YCqXdtbrtVvzzs4 wmRRuqD6aqD0ZtfBmI3hpWR1fFSfg1BNY7DLmJDsaRupUlJrVVcFuf8k0bHsi/XNDYlO guKg== X-Gm-Message-State: AA+aEWYVZWPFl0wsJERQ5ZMzaGBgv5B5WBaajJXvwl4Efdwz4n3mrHlk MVoiJRGPK3SdrCG7NCSz1L0iHqRedayV88E5bjE= X-Received: by 2002:a24:fe41:: with SMTP id w62mr15352437ith.23.1544000868178; Wed, 05 Dec 2018 01:07:48 -0800 (PST) MIME-Version: 1.0 References: <1542535751-16079-1-git-send-email-pawell@cadence.com> <1542535751-16079-5-git-send-email-pawell@cadence.com> In-Reply-To: From: Peter Chen Date: Wed, 5 Dec 2018 17:07:37 +0800 Message-ID: Subject: Re: [RFC PATCH v2 04/15] usb:cdns3: Driver initialization code. To: adouglas@cadence.com Cc: pawell@cadence.com, devicetree@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, rogerq@ti.com, lkml , jbergsagel@ti.com, nsekhar@ti.com, nm@ti.com, sureshp@cadence.com, peter.chen@nxp.com, pjez@cadence.com, kurahul@cadence.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 5, 2018 at 4:55 PM Alan Douglas wrote: > > Hi Peter, > > On 05 December 2018 07:20, Pawel Laszczak wrote: > > Hi, > > > > >> >> > > >> >> Patch adds core.c and core.h file that implements initialization > > >> >> of platform driver and adds function responsible for selecting, > > >> >> switching and running appropriate Device/Host mode. > > >> >> > > >> >> Signed-off-by: Pawel Laszczak > > >> >> --- > > >> >> drivers/usb/cdns3/Makefile | 2 + > > >> >> drivers/usb/cdns3/core.c | 413 +++++++++++++++++++++++++++++++++++++ > > >> >> drivers/usb/cdns3/core.h | 100 +++++++++ > > >> >> 3 files changed, 515 insertions(+) > > >> >> create mode 100644 drivers/usb/cdns3/core.c > > >> >> create mode 100644 drivers/usb/cdns3/core.h > > >> >> > > >> >> diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile > > >> >> index dcdd62003c6a..02d25b23c5d3 100644 > > >> >> --- a/drivers/usb/cdns3/Makefile > > >> >> +++ b/drivers/usb/cdns3/Makefile > > >> >> @@ -1,3 +1,5 @@ > > >> >> +obj-$(CONFIG_USB_CDNS3) += cdns3.o > > >> >> obj-$(CONFIG_USB_CDNS3_PCI_WRAP) += cdns3-pci.o > > >> >> > > >> >> +cdns3-y := core.o > > >> >> cdns3-pci-y := cdns3-pci-wrap.o > > >> >> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c > > >> >> new file mode 100644 > > >> >> index 000000000000..f9055d4da67f > > >> >> --- /dev/null > > >> >> +++ b/drivers/usb/cdns3/core.c > > >> >> @@ -0,0 +1,413 @@ > > >> >> +// SPDX-License-Identifier: GPL-2.0 > > >> >> +/* > > >> >> + * Cadence USBSS DRD Driver. > > >> >> + * > > >> >> + * Copyright (C) 2018 Cadence. > > >> >> + * > > >> > > > >> >Please add NXP copyright too. > > >> > > >> Ok, I don't know why I omitted this. > > >> I know that you are the main author of this file > > >> Sorry for that. > > >> > > >> One additional question. What year I should add in Copyright for NXP?. > > >> The original year 2017 or I should modified all to 2018. > > >> > > >Please use below copyright, thanks. > > > > > >Copyright 2017-2018 NXP > > > > I add this in all files modified or created by you. > > > > > > > > > > > >> >> + mutex_init(&cdns->mutex); > > >> >> + > > >> >> + cdns->phy = devm_phy_get(dev, "cdns3,usbphy"); > > >> >> + if (IS_ERR(cdns->phy)) { > > >> >> + dev_info(dev, "no generic phy found\n"); > > >> >> + cdns->phy = NULL; > > >> >> + /* > > >> >> + * fall through here! > > >> >> + * if no generic phy found, phy init > > >> >> + * should be done under boot! > > >> >> + */ > > >> > > > >> >If the phy driver is defer-probed, it will be here, it is not an error. > > >> >I think you could have a generic phy driver or usb generic phy driver > > >> >(drivers/usb/phy/phy-generic.c) even you don't need any operations for > > >> >PHY. It will be easy for other platforms. > > >> > > >> Yes, Roger ask me to modify this fragment. In next version it will look like: > > >> cdns->phy = devm_phy_get(dev, "cdns3,usbphy"); > > >> if (IS_ERR(cdns->phy)) { > > >> ret = PTR_ERR(cdns->phy); > > >> if (ret == -ENOSYS || ret == -ENODEV) { > > >> cdns->phy = NULL; > > >> } else if (ret == -EPROBE_DEFER) { > > >> return ret; > > >> } else { > > >> dev_err(dev, "no phy found\n"); > > >> goto err0; > > >> } > > >> } > > >> > > >> phy_init(cdns->phy); > > >> > > >> We are going to use phy driver. I don't know if it correct. > > >> I don't have experience in this filed. > > >> We need phy initialization but I don't have testing platform now. > > >> In most usb drivers I see that there are used usb phy driverd instead phy dirverd. > > >> > > > > > >At my CDNS3 platform, there are some USB PHY initialization for register setting > > >and clock enable. You could add generic PHY driver under: drivers/phy/cadence/. > > > > > >Above PHY initialization code is OK for me. > > > > It will be added as separate driver. > > I think that Allan Douglas working on it. > > I ask him to add you to -cc in patch for phy. > Patch series for the cadence Sierra generic PHY driver can be found here: > https://lore.kernel.org/patchwork/cover/1011486/ > > It can also be found in Kishon's linux-phy git tree at > git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git > in the 'next' branch. > > It will be great if you are able to take a look at it. I will test it, and submit some changes if needed, thanks. Peter