Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp166612iob; Mon, 2 May 2022 16:06:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcg9V7v/DTBpX+c4yTD+yPWwra5gLLwqmG3QlPyXPnb192+VhdNbGv0U4CIVniHLZI6Avw X-Received: by 2002:a17:902:ab56:b0:15a:ccc7:a311 with SMTP id ij22-20020a170902ab5600b0015accc7a311mr14109756plb.22.1651532770456; Mon, 02 May 2022 16:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532770; cv=none; d=google.com; s=arc-20160816; b=d5LXnDlxix6Wak6Zk549lrite+FjR2wu18ip2pPE6G+5BU9ZJetw1SHWR9rGpjEU+k FfZwpUP3prF1ub9b6rJ7snrmNNwvqn52URJmDNTSdHh8mQUzH1goyTtj6H63ebErSJLG IIZGbCv25FPFfNYokSiZuJ5nFZUGoe9YN8bvDh0fjhnBz5ce1C9ITXYmdATHGUFBf/cN yW/He04ZpWQwyBo23bpMhI7jxXZ1Hic/Dxa71M1QvKs6j6s39RovSG6RNbymiGdbd7Oo 2ExFJ92dmj0QFD1yabj2ThD3mkQmS8sPUC+etHQTbRkKSZ179zrBBcdY0EqQT6FbQRLA Q42w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tIN2H8kb2fa/eH/YRrsU7QoGkmM1iwcSJVD0ufxZrns=; b=O+xdKejhfc8PGgLacBe9350h3l9SbSnxW0sIRw8y7HBsCA2zJNh+IQJXK8xFu9b1Y+ +1ziU9BiwKYPKPMMsSCVafwcul8O8UnUZMxEYtHWYBjsiAgWlDbAloY1DMdfOYdGERUW XzeRKtttAdjLZemGysZ2PWdCTrWQm5XQCNQ/YGifbXnNa7niexclS+RViELEuAYke681 Rxq7Ujt74mTxqbXxuBBJlyIjSb0STo29eJU/pTZrtlAai5qZWLyYmq0k4TASU7UQQ6GZ 3e6efF4/UdsgXj3U6DPo9qzSG1j+t4l96ZKIo+mOw9cENt1TmjMay2RxlpY5ay9O5DQL 0V9w== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x11-20020a63170b000000b003c1eb460705si6698065pgl.33.2022.05.02.16.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:06:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AFA6E28E1E; Mon, 2 May 2022 16:06:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238891AbiD3B3e (ORCPT + 99 others); Fri, 29 Apr 2022 21:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240105AbiD3B3b (ORCPT ); Fri, 29 Apr 2022 21:29:31 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B838A7F209 for ; Fri, 29 Apr 2022 18:26:11 -0700 (PDT) Received: (qmail 966577 invoked by uid 1000); 29 Apr 2022 21:26:11 -0400 Date: Fri, 29 Apr 2022 21:26:11 -0400 From: Alan Stern To: Vincent Shih Cc: gregkh@linuxfoundation.org, p.zabel@pengutronix.de, davem@davemloft.net, vladimir.oltean@nxp.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org, wells.lu@sunplus.com Subject: Re: [PATCH v4 1/2] usb: host: ehci-sunplus: Add driver for ehci in Sunplus SP7021 Message-ID: References: <1651220876-26705-1-git-send-email-vincent.sunplus@gmail.com> <1651220876-26705-2-git-send-email-vincent.sunplus@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1651220876-26705-2-git-send-email-vincent.sunplus@gmail.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 29, 2022 at 04:27:55PM +0800, Vincent Shih wrote: > Add driver for ehci in Sunplus SP7021 > > Signed-off-by: Vincent Shih > --- > diff --git a/drivers/usb/host/ehci-sunplus.c b/drivers/usb/host/ehci-sunplus.c > new file mode 100644 > index 0000000..4d8e20d > --- /dev/null > +++ b/drivers/usb/host/ehci-sunplus.c > +static struct usb_ehci_pdata usb_ehci_pdata = { > + .has_tt = 1, > + .has_synopsys_hc_bug = 1, > + .big_endian_desc = 1, > + .big_endian_mmio = 1, > + .power_on = sp_ehci_platform_power_on, > + .power_suspend = sp_ehci_platform_power_off, > + .power_off = sp_ehci_platform_power_off, > + > +}; > + > +static int ehci_sunplus_reset(struct usb_hcd *hcd) > +{ > + struct platform_device *pdev = to_platform_device(hcd->self.controller); > + struct usb_ehci_pdata *pdata = pdev->dev.platform_data; > + struct ehci_hcd *ehci = hcd_to_ehci(hcd); > + int retval; > + > + hcd->has_tt = pdata->has_tt; > + ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; > + ehci->big_endian_desc = pdata->big_endian_desc; > + ehci->big_endian_mmio = pdata->big_endian_mmio; By the way, you don't need to add all this pdata stuff. You can just set hcd->has_tt, ehci->has_synopsys_hc_bug, ehci_big_endian_desc, and ehci->big_endian_mmio directly, since you already know what their values should be. It looks like you simply copied the code from the ehci-platform driver. But that driver has to handle many different kinds of platform devices, so it needs to be told about their individual differences, whereas your driver only has to handle one kind. In fact, there's no obvious reason why you didn't just use the ehci-platform driver instead of writing your own driver. That's the sort of thing you need to explain the patch description. Alan Stern