Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4465594imu; Tue, 18 Dec 2018 15:40:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8QtNN6h+WWAALperAzDn3TLeHhYJuBhdRJFtEFG7wNZuekLhQ040wwNZ/Fpqn60Z3XedL X-Received: by 2002:a17:902:9887:: with SMTP id s7mr17757118plp.199.1545176441507; Tue, 18 Dec 2018 15:40:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545176441; cv=none; d=google.com; s=arc-20160816; b=UxBYnB84+X/4txDnDBzBG88w+qwHmMbUNCk0DcdAvnq/ItjceMHpzdyCqdQR76IwaS hY1VeO0vbj1Rt/w4EfYTGGRHa3/xsru+TSHWaDSyhm2IV2ac/Sr5rAga6OyPdtq1/SRW 2M4Qk8b+bM48L6ziPxkqlaUKv0PlF/sFs9F3jVHry6P/68WM2ibYxNwH6znEXNbrbGx0 uz1BCcAZWAJ8a/uD1kjkNoOveiR+fRF3W0RnVM/uQoxiAx3yJNU3lcKGCHTB15C62K7b RLMahni1XjdjfcmckkISmXvqa0qasM+AgPFdcGMxKITK1/O5qHq7jjxeUqaHbCI9sUla OVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pBTid8kHcULZcrbVWeaQTB6XY9gUSm9fnu+LNqm1+ng=; b=GTVdfn+HtZW5mJ50DefrcZ/vh1dnfVJMMi2ccQgwBVizYgPUV8rMXdArmFVH4aBqVL q1ovfXPDaE7SqswQD+rpA8ghopJbJzxCqISc1U2KgpGI9zWfZazm05Z/gzdBtoZUqVos 8nBrG5M9R7rfWtl2vOdbMpZY1AP9Pqt2h+NM8Bpa5EVQXfHG24OrkU8A36hI+jHhX2uC R77j1hXcjMqpzPVTmik0t8Xr3DFg06yoRVJkSHNd5+6OCJ9sTfG7dU0vaWGbG4ETYCAX +essVJsUzz0aocAwRAfowTolGja78Trr0EHuhvWuH2QNBN7JjOPbhZXea57VMxP+qSf3 rQRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Awod3BNW; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n30si14388931pgb.406.2018.12.18.15.40.24; Tue, 18 Dec 2018 15:40:41 -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=@kernel.org header.s=default header.b=Awod3BNW; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbeLRWrM (ORCPT + 99 others); Tue, 18 Dec 2018 17:47:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:48764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbeLRWrL (ORCPT ); Tue, 18 Dec 2018 17:47:11 -0500 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1894221871; Tue, 18 Dec 2018 22:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545173230; bh=cnK5XvLVRJ49GBJdmk7hCbJ8Up1l19H1A9AWUVBiAus=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Awod3BNW073KN9DVtn3VhAkdFK+WH3vOTctETw/JfwkJwGZHl0RHyuR0Cjuo2tE/6 1YBGfxDYGlVweug7AQGTYUl1MoAt97mRz+zaLmo7f3+yhhAy60hDXY/oaGpAy6xvUm EA1QJ8u+HjHA73K6yjpWDIepyjDKVHOhM9GaRpSI= Date: Tue, 18 Dec 2018 16:47:08 -0600 From: Bjorn Helgaas To: Hanjie Lin Cc: Lorenzo Pieralisi , Yue Wang , Kevin Hilman , Carlo Caione , Jerome Brunet , Rob Herring , Gustavo Pimentel , Shawn Lin , Philippe Ombredanne , Cyrille Pitchen , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Yixun Lan , Liang Yang , Jianxin Pan , Qiufang Dai , Jian Hu Subject: Re: [PATCH v8 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver Message-ID: <20181218224708.GB22610@google.com> References: <1545120286-129258-1-git-send-email-hanjie.lin@amlogic.com> <1545120286-129258-3-git-send-email-hanjie.lin@amlogic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1545120286-129258-3-git-send-email-hanjie.lin@amlogic.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 18, 2018 at 04:04:46PM +0800, Hanjie Lin wrote: > From: Yue Wang > > The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare > PCI core. This patch adds the driver support for Meson PCIe controller. I don't have any comments on the code itself; just the trivial things below. No need to repost for these unless you're changing something else. I thought it looked very pretty overall, thanks for paying attention to that! > +static int meson_size_to_payload(struct meson_pcie *mp, int size) > +{ > + struct device *dev = mp->pci.dev; > + > + /* > + * dwc supports 2^(val+7) payload size, which val is 0~5 default to 1. > + * So if input size is not 2^order alignment or less than 2^7 or bigger > + * than 2^12, just set to default size 2^(1+7). > + */ > + if (!is_power_of_2(size) || size < 128 || size > 4096) { > + dev_warn(dev, "playload size %d, set to default 256\n", size); s/playload/payload/ > +static void meson_set_max_payload(struct meson_pcie *mp, int size) > +{ > + u32 val = 0; Unnecessary initialization. > + int max_payload_size = meson_size_to_payload(mp, size); > + > + val = meson_elb_readl(mp, PCIE_DEV_CTRL_DEV_STUS); > +static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, > + u32 *val) > +{ > + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); > + int ret; > + > + ret = dw_pcie_read(pci->dbi_base + where, size, val); > + if (ret != PCIBIOS_SUCCESSFUL) > + return ret; > + > + /* > + * There is a bug in the MESON AXG pcie controller whereby software > + * cannot programme the PCI_CLASS_DEVICE register, so we must fabricate > + * the return value in the config accessors. s/pcie/PCIe/ s/programme/program/ (IIUC, "programme" is British and only used as a noun, where here you need a verb) > +static int meson_pcie_link_up(struct dw_pcie *pci) > +{ > + struct meson_pcie *mp = to_meson_pcie(pci); > + struct device *dev = pci->dev; > + u32 smlh_up = 0; > + u32 ltssm_up = 0; > + u32 rdlh_up = 0; Unnecessary initialization of smlh_up, ltssm_up, and rdlh_up. > + u32 speed_okay = 0; > + u32 cnt = 0; > + u32 state12, state17; > + > + do { > + state12 = meson_cfg_readl(mp, PCIE_CFG_STATUS12); > + state17 = meson_cfg_readl(mp, PCIE_CFG_STATUS17); > + smlh_up = IS_SMLH_LINK_UP(state12); > + rdlh_up = IS_RDLH_LINK_UP(state12); > + ltssm_up = IS_LTSSM_UP(state12); > + dev_err(dev, "Error: Wait linkup timeout.\n"); Message doesn't match others from driver (capitalization and trailing period). > + dev_err(dev, "failed to get msi irq\n"); s/msi irq/MSI IRQ/ > + ret = meson_add_pcie_port(mp, pdev); > + if (ret < 0) { > + dev_err(dev, "Add PCIE port failed, %d\n", ret); s/PCIE/PCIe/ All the messages in this function are capitalized differently than other messages in the driver. Bjorn