Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp954945rdg; Fri, 13 Oct 2023 06:19:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHk7dWPjzZc0uqFvqkB/5hu5Hn0CE9OnMd2Lpo8u9nbccHaYzjRv1jImrSQI3ZqS8iOPi4s X-Received: by 2002:a17:902:da8e:b0:1c6:2655:625d with SMTP id j14-20020a170902da8e00b001c62655625dmr110862plx.15.1697203176045; Fri, 13 Oct 2023 06:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697203176; cv=none; d=google.com; s=arc-20160816; b=0GORdSLYtszpj/8vwhxQ4PQs9yUtKoNCd53+PRf1daMPnNZwGMk4POhBfXeZf315s3 HTG3CiLQ+Ol1y4upnEH1Q4j/a4qsbau4kjl0aD5o8n9qAERkDfNN/ooHU+iF6fOQX0e3 NBFwOL+QqWljkEgGnF2RplKkpirtJoax5TGjUtLT3gPiLxiVVw7s3UOCooJ05CHNfjvY 3gBEiHYwG8xzsS738VU0/oJlueBwBRZDweI8L9oKHSyD6dIH4ORVRqSHDaGGGndvTCQq fj02HkUvAM91M59v59arsAoOBJF4kpRVaQbPnO4aEOsp6LZ80d3CJqEuk3fNXCCXZnis oIag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=SC70mlAzlkh3RPgQrcTtycuRjbk0jI6ai2BuaV5muc8=; fh=lbVqjObTfFAfQCQGywyhEJpYkwiIE+Zbxzna4jVR4iQ=; b=K4Cdiqb0Z8vipvZvcNodJxLGXfGL7hKdgJgHsX6AxSMemxuN8X34ScM2hueOvKA0gP HMRmyxZ4p2wSPiUUOI6pjl4fqWe+KjKzpfrlW0jTy5EOhzd/PTla/dMpoXK4DUV1Mlvb 5/PWjzWkF5X4VIBrT9T8Seb4rKKTkMMDM6O+BZEZxEk7cmB8ErHczk9M1EiHYD12UvhK btMvy155C9wJ1p4f1qo9rzyWQWBVkv+Rno5JkLTxepuNUDVaKmDG6UtN5eW/XXrCS7vg a1plSyxbdTUaCjYhEs3/RceLw2ZYLZhNybJC+2Y+f/zW0zoY/yYsUM3+3G61FCphA6Ff X8cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k6-20020a634b46000000b00565d88203c8si1926498pgl.535.2023.10.13.06.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 06:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AB8CD83594B6; Fri, 13 Oct 2023 06:19:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbjJMNTM (ORCPT + 99 others); Fri, 13 Oct 2023 09:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231927AbjJMNTK (ORCPT ); Fri, 13 Oct 2023 09:19:10 -0400 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42223C2; Fri, 13 Oct 2023 06:19:06 -0700 (PDT) Received: from [192.168.0.185] (ip5f5bf22a.dynamic.kabel-deutschland.de [95.91.242.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 09CBF61E5FE01; Fri, 13 Oct 2023 15:18:17 +0200 (CEST) Message-ID: <7add0297-709f-4836-832f-f8fbd412eca5@molgen.mpg.de> Date: Fri, 13 Oct 2023 15:18:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 3/3] usb: chipidea: Add support for NPCM To: Tomer Maimon Cc: peter.chen@kernel.org, gregkh@linuxfoundation.org, avifishman70@gmail.com, tali.perry1@gmail.com, joel@jms.id.au, venture@google.com, yuenn@google.com, benjaminfair@google.com, j.neuschaefer@gmx.net, openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231012230057.3365626-1-tmaimon77@gmail.com> <20231012230057.3365626-4-tmaimon77@gmail.com> Content-Language: en-US From: Paul Menzel In-Reply-To: <20231012230057.3365626-4-tmaimon77@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 06:19:33 -0700 (PDT) Dear Tomer, Thank you for your patch. Am 13.10.23 um 01:00 schrieb Tomer Maimon: > Add Nuvoton NPCM BMC SoCs support to USB ChipIdea driver. > NPCM SoC include ChipIdea IP block that used for USB device controller include*s* “that *is* used” or just “… used for” > mode. Please add a line, how you tested this patch. > Signed-off-by: Tomer Maimon > Acked-by: Peter Chen > --- > drivers/usb/chipidea/Kconfig | 4 + > drivers/usb/chipidea/Makefile | 1 + > drivers/usb/chipidea/ci_hdrc_npcm.c | 114 ++++++++++++++++++++++++++++ > 3 files changed, 119 insertions(+) > create mode 100644 drivers/usb/chipidea/ci_hdrc_npcm.c > > diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig > index c815824a0b2d..bab45bc62361 100644 > --- a/drivers/usb/chipidea/Kconfig > +++ b/drivers/usb/chipidea/Kconfig > @@ -43,6 +43,10 @@ config USB_CHIPIDEA_MSM > tristate "Enable MSM hsusb glue driver" if EXPERT > default USB_CHIPIDEA > > +config USB_CHIPIDEA_NPCM > + tristate "Enable NPCM hsusb glue driver" if EXPERT > + default USB_CHIPIDEA > + > config USB_CHIPIDEA_IMX > tristate "Enable i.MX USB glue driver" if EXPERT > depends on OF > diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile > index 71afeab97e83..718cb24603dd 100644 > --- a/drivers/usb/chipidea/Makefile > +++ b/drivers/usb/chipidea/Makefile > @@ -13,6 +13,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o > > obj-$(CONFIG_USB_CHIPIDEA_GENERIC) += ci_hdrc_usb2.o > obj-$(CONFIG_USB_CHIPIDEA_MSM) += ci_hdrc_msm.o > +obj-$(CONFIG_USB_CHIPIDEA_NPCM) += ci_hdrc_npcm.o > obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o > obj-$(CONFIG_USB_CHIPIDEA_IMX) += usbmisc_imx.o ci_hdrc_imx.o > obj-$(CONFIG_USB_CHIPIDEA_TEGRA) += ci_hdrc_tegra.o > diff --git a/drivers/usb/chipidea/ci_hdrc_npcm.c b/drivers/usb/chipidea/ci_hdrc_npcm.c > new file mode 100644 > index 000000000000..37b64a3dbd96 > --- /dev/null > +++ b/drivers/usb/chipidea/ci_hdrc_npcm.c > @@ -0,0 +1,114 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (c) 2023 Nuvoton Technology corporation. > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ci.h" > + > +struct npcm_udc_data { > + struct platform_device *ci; > + struct clk *core_clk; > + struct ci_hdrc_platform_data pdata; > +}; > + > +static int npcm_udc_notify_event(struct ci_hdrc *ci, unsigned event) > +{ > + struct device *dev = ci->dev->parent; > + > + switch (event) { > + case CI_HDRC_CONTROLLER_RESET_EVENT: > + /* clear all mode bits */ > + hw_write(ci, OP_USBMODE, 0xffffffff, 0x0); > + break; > + default: > + dev_dbg(dev, "unknown ci_hdrc event\n"); Please print it out. > + break; > + } > + > + return 0; > +} > + > +static int npcm_udc_probe(struct platform_device *pdev) > +{ > + int ret; > + struct npcm_udc_data *ci; > + struct platform_device *plat_ci; > + struct device *dev = &pdev->dev; > + > + ci = devm_kzalloc(&pdev->dev, sizeof(*ci), GFP_KERNEL); > + if (!ci) > + return -ENOMEM; > + platform_set_drvdata(pdev, ci); > + > + ci->core_clk = devm_clk_get_optional(dev, NULL); > + if (IS_ERR(ci->core_clk)) > + return PTR_ERR(ci->core_clk); > + > + ret = clk_prepare_enable(ci->core_clk); > + if (ret) > + return dev_err_probe(dev, ret, "failed to enable the clock: %d\n", ret); > + > + ci->pdata.name = dev_name(dev); > + ci->pdata.capoffset = DEF_CAPOFFSET; > + ci->pdata.flags = CI_HDRC_REQUIRES_ALIGNED_DMA | > + CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS; > + ci->pdata.phy_mode = USBPHY_INTERFACE_MODE_UTMI; > + ci->pdata.notify_event = npcm_udc_notify_event; > + > + plat_ci = ci_hdrc_add_device(dev, pdev->resource, pdev->num_resources, > + &ci->pdata); > + if (IS_ERR(plat_ci)) { > + ret = PTR_ERR(plat_ci); > + dev_err(dev, "failed to register HDRC NPCM device: %d\n", ret); > + goto clk_err; > + } > + > + pm_runtime_no_callbacks(dev); > + pm_runtime_enable(dev); > + > + return 0; > + > +clk_err: > + clk_disable_unprepare(ci->core_clk); > + return ret; > +} > + > +static int npcm_udc_remove(struct platform_device *pdev) > +{ > + struct npcm_udc_data *ci = platform_get_drvdata(pdev); > + > + pm_runtime_disable(&pdev->dev); > + ci_hdrc_remove_device(ci->ci); > + clk_disable_unprepare(ci->core_clk); > + > + return 0; > +} > + > +static const struct of_device_id npcm_udc_dt_match[] = { > + { .compatible = "nuvoton,npcm750-udc", }, > + { .compatible = "nuvoton,npcm845-udc", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, npcm_udc_dt_match); > + > +static struct platform_driver npcm_udc_driver = { > + .probe = npcm_udc_probe, > + .remove = npcm_udc_remove, > + .driver = { > + .name = "npcm_udc", > + .of_match_table = npcm_udc_dt_match, > + }, > +}; > + > +module_platform_driver(npcm_udc_driver); > + > +MODULE_DESCRIPTION("NPCM USB device controller driver"); > +MODULE_AUTHOR("Tomer Maimon "); Should that address also be recorded as the patch author? > +MODULE_LICENSE("GPL v2"); Kind regards, Paul