Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp603552ybk; Wed, 20 May 2020 07:31:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhDCbId/1O+OAX4TXvN3aZcteNOKwEPYbaJy400ZLdPqsyNG9ETyXB6U7C5oY8S3ZeIoLu X-Received: by 2002:a50:9e2a:: with SMTP id z39mr3766776ede.371.1589985103264; Wed, 20 May 2020 07:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589985103; cv=none; d=google.com; s=arc-20160816; b=lvpoD1iMT8a8SOhqKSQ0yoTtBzFNhRDKOoJtN7dg89v86lCODB7F94XjubzDKA/+Di Xy9bsKzk2rglNqkfepLTTG8XCJmiuF0RJBSLudy8ksLUbebLea5kESi8ET1SBj8ZRAo0 vUPjb6ggUOdLiKitWCOf6UHKweA5PJkWxZM7MaQfDBRb1i79nv6hppzYUPOSXxmhesFi fuBYjPSWL+vI/TkS+450N0YutyG2x7aIwqMRd13y/RIJN2oN2c68wwDHzznvZL+2AwHP x9KnwnKDr1wtJkv53Jhq1GxAn/+Kn8f3hyRv9oyByAXJRZPPuQaWIUOKLwSncVo71r0g I4sw== 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=ptEFNOIgk4B9+DYPafEJRUQDpVN+/z6CM7j9644NXs0=; b=w+/7wJNkgzASyyhjRVCP4nYCYX4RQBNG5xSkLOMOeSCDU1BevT2bZYf7kUVxn/KDvL mnu0fsiZR2z9B8oxict6Chlu1IoXF2uJQBmnk9bcg3L6XeFquSFHDr7KZyevKULWx7z4 AqSYSEZqfhhBtXJ9EvyULq0+8W9p5IYlaHAhfBMjXn+5CWfZWCwzO0gb0TiEDYtUBzgT oSgGiG4cw9L7xSElTJi4SHmr9w8Jy8YsVsoEfFn52nFWyL0c4DmxoEUJWstX0fM/NF5e CguDwrWtxS8fHwfdGlkmAjX1GwSlPZYYfmiAaZ16JMCMBYsBzjRpUXahIM43qDk14NMb PHwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=N6+F8AHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si1102132edv.606.2020.05.20.07.31.20; Wed, 20 May 2020 07:31:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=N6+F8AHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728535AbgETO1g (ORCPT + 99 others); Wed, 20 May 2020 10:27:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727937AbgETO1c (ORCPT ); Wed, 20 May 2020 10:27:32 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E4EC061A0E for ; Wed, 20 May 2020 07:27:31 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id g14so174887wme.1 for ; Wed, 20 May 2020 07:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ptEFNOIgk4B9+DYPafEJRUQDpVN+/z6CM7j9644NXs0=; b=N6+F8AHyBsGr0JrchNCjPmACddbP02WM42JVatgqpfz453fPvPxNSwETDM9nnCuNdx lmwiFvLsbcA8X8p1dCkos0MC1aP9vojACfnbjOWQMj89Vrd6li3tz3eZNJvm6Cey3kdh ibmCBGe++ATvMcSFUTOTMoFa+1gS6rUIgVBiM= 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=ptEFNOIgk4B9+DYPafEJRUQDpVN+/z6CM7j9644NXs0=; b=J1SHxp2qPTf2VR2JysNZjLVTlgSk7m7QAb8San70Z8kjFVcgMbewAMNjJ5R5+QZPRO iK///XzJliOjVZJ8y2iktebJMkfx5htSSL9IqyVMtebxL8QialDDLlN0JUelGFvzCCit wtvq4YxAjwxny62IUcvHEatoaPQpARHAVb2kLicTIjubdsDd5/6h6Kk0v5badRzs8uyo cRINV1tQCAv0dkm7EA5HPwrP93ALpw5BiyRb+0cRoyoNGk7LX+fVs4SHI0h4Gg291KxM qmexRSDYBpA4rFJ6R13aL87KTP9XtARgGTbwGBjQe31BkPKCTBqXtMOxZJuSwi3miBaL jQkQ== X-Gm-Message-State: AOAM533pT5nngP4sZ+Y1g2lgMWlPKAtRJgsiJ7ppSSIxn29nfXlq4sMx TCuodybanpC5VxIS4yrGWZjsmAyWnvQnSEasguJ9zw== X-Received: by 2002:a1c:7d02:: with SMTP id y2mr3542879wmc.92.1589984850314; Wed, 20 May 2020 07:27:30 -0700 (PDT) MIME-Version: 1.0 References: <20200519203419.12369-1-james.quinlan@broadcom.com> <20200519203419.12369-15-james.quinlan@broadcom.com> <4a49e7724e9a12e4f128a5e9ff4181da7af40bd3.camel@suse.de> In-Reply-To: <4a49e7724e9a12e4f128a5e9ff4181da7af40bd3.camel@suse.de> From: Jim Quinlan Date: Wed, 20 May 2020 10:27:17 -0400 Message-ID: Subject: Re: [PATCH 14/15] PCI: brcmstb: Set bus max burst side by chip type To: Nicolas Saenz Julienne Cc: Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Florian Fainelli , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" , open list 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, May 20, 2020 at 9:44 AM Nicolas Saenz Julienne wrote: > > On Tue, 2020-05-19 at 16:34 -0400, Jim Quinlan wrote: > > From: Jim Quinlan > > > > The proper value of the parameter SCB_MAX_BURST_SIZE varies > > per chip. The 2711 family requires 128B whereas other devices > > can employ 512. The assignment is complicated by the fact > > that the values for this two-bit field have different meanings; > > > > Value Type_Generic Type_7278 > > > > 00 Reserved 128B > > 01 128B 256B > > 10 256B 512B > > 11 512B Reserved > > > > Signed-off-by: Jim Quinlan > > --- > > drivers/pci/controller/pcie-brcmstb.c | 18 +++++++++++++++--- > > 1 file changed, 15 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/pci/controller/pcie-brcmstb.c > > b/drivers/pci/controller/pcie-brcmstb.c > > index 7bf945efd71b..0dfa1bbd9764 100644 > > --- a/drivers/pci/controller/pcie-brcmstb.c > > +++ b/drivers/pci/controller/pcie-brcmstb.c > > @@ -53,7 +53,7 @@ > > #define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000 > > #define PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000 > > #define PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000 > > -#define PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_128 0x0 > > + > > #define PCIE_MISC_MISC_CTRL_SCB0_SIZE_MASK 0xf8000000 > > #define PCIE_MISC_MISC_CTRL_SCB1_SIZE_MASK 0x07c00000 > > #define PCIE_MISC_MISC_CTRL_SCB2_SIZE_MASK 0x0000001f > > @@ -276,6 +276,7 @@ struct brcm_pcie { > > int num_memc; > > u64 memc_size[PCIE_BRCM_MAX_MEMC]; > > u32 hw_rev; > > + const struct of_device_id *of_id; > > }; > > > > /* > > @@ -841,7 +842,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) > > int num_out_wins = 0; > > u16 nlw, cls, lnksta; > > int i, ret, memc; > > - u32 tmp, aspm_support; > > + u32 tmp, burst, aspm_support; > > > > /* Reset the bridge */ > > brcm_pcie_bridge_sw_init_set(pcie, 1); > > @@ -857,10 +858,20 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) > > /* Wait for SerDes to be stable */ > > usleep_range(100, 200); > > > > + /* > > + * SCB_MAX_BURST_SIZE is a two bit field. For GENERIC chips it > > + * is encoded as 0=128, 1=256, 2=512, 3=Rsvd, for BCM7278 it > > + * is encoded as 0=Rsvd, 1=128, 2=256, 3=512. > > + */ > > + if (strcmp(pcie->of_id->compatible, "brcm,bcm2711-pcie") == 0) > > Would it make sense to use pcie->type here? I know GENERIC != BCM2711, but we > could define it and avoid adding redundant info in struct brcm_pcie. Yes, that would get rid of the need for keeping of_id around. Thanks, Jim > > Regards, > Nicolas > > > + burst = 0x0; /* 128B */ > > + else > > + burst = (pcie->type == BCM7278) ? 0x3 : 0x2; /* 512 bytes */ > > + > > /* Set SCB_MAX_BURST_SIZE, CFG_READ_UR_MODE, SCB_ACCESS_EN */ > > u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK); > > u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK); > > - u32p_replace_bits(&tmp, PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_128, > > + u32p_replace_bits(&tmp, burst, > > PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK); > > writel(tmp, base + PCIE_MISC_MISC_CTRL); > > > > @@ -1200,6 +1211,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) > > pcie->reg_offsets = data->offsets; > > pcie->reg_field_info = data->reg_field_info; > > pcie->type = data->type; > > + pcie->of_id = of_id; > > > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > pcie->base = devm_ioremap_resource(&pdev->dev, res); >