Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5D62C432BE for ; Wed, 1 Sep 2021 21:59:58 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F00D6056B for ; Wed, 1 Sep 2021 21:59:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F00D6056B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 117328327E; Wed, 1 Sep 2021 23:59:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="fPSffgS8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 12F2A8327E; Wed, 1 Sep 2021 23:59:54 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0621.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::621]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFD7E83296 for ; Wed, 1 Sep 2021 23:59:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vladimir.oltean@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpIkrF4MKVAkvhixf//uAfxPM8R6tZ8hD4egbioaDdyLLa3kE2YC434tRUadrFr8r5Ct0wG7UQYWRzkae3relnTTcgrpTUSBVtu5GwPGLuN1QVuHRjYFhFsU1bZJDAUQzcmnODI94BboK3uqXk3ZGhwm3TYaX4IrWQOMauVEIhM9BgNzJcrq/Xv0U4+U6rKBTFRaieJ6LC3Yr/qjTTyIf6xFyougU7s83bE1j7J4eSur9iQZgZo6fTvsa8qXVqcm5BS7k1XQyJHA0OBPEZTOrKzvi5PnhKmfSwAVR4hR8lu+SU1s5JcHF3duuRyPy8nZAMpObCNaj8gtI4KgCvKPjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dlaDxeAnARt7zUbpM8jt543QMAJyvRJXD0eOwXOdb/U=; b=gOGpy9FAilgNx20PNqoGNA9bfmlmP/F+ZKQkqi9o/lJq1nm6HSaqR4fgJDiiUxmVyLQTKoiSYYeglECZ8VbpHeSSlXF63Yatpkv/yJ1H65qtX1tPnS+7h+xcWBtHur1UbuAUwAnz6b4EZuvTSULPsKz/zLHNdXnmwLs9da+hFprV4AjSWGpHMUltM2o4LzlrhYvDl+ppSVR2VKb/lN/GvYH/qB0jg/bkJzR51i2ibF2bygtV6hCkQ1Nb+yKAmqi7Ca6rnILgzwOsXPDgurYQ5Sv112Ul84BB0+O9N6l2S4fP+Ty1YFq+oK9gjV7dejsDY2wqKESWiF997TNBjylrkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dlaDxeAnARt7zUbpM8jt543QMAJyvRJXD0eOwXOdb/U=; b=fPSffgS8dDOZrxFyisp+jfBVXDNuIgGc5SNMvjEsvsCrYLfbz3gKEbS+0La/Xzj0TssLTqKfajvGEQPFHc+b2v5R2lk7KAxV0NRIdwIFjQ2/5RlMvy8MhyLwtJN56nEYV//6mkiPT4KmZbgMUuGh8vpE4KmGIKWcZvZV2EsGwz4= Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR0401MB2512.eurprd04.prod.outlook.com (2603:10a6:800:4e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Wed, 1 Sep 2021 21:59:47 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4457.026; Wed, 1 Sep 2021 21:59:47 +0000 From: Vladimir Oltean To: Michael Walle CC: "u-boot@lists.denx.de" , Jagan Teki , Priyanka Jain , Tom Rini , Peter Griffin , Manivannan Sadhasivam Subject: Re: [PATCH v2 8/9] arm: dts: ls1028a: sync the fsl-ls1028a.dtsi with linux Thread-Topic: [PATCH v2 8/9] arm: dts: ls1028a: sync the fsl-ls1028a.dtsi with linux Thread-Index: AQHXnw8zF5C1Uvh2g0iSq7vYJL/03quO+l0AgAC55wCAAAb3AA== Date: Wed, 1 Sep 2021 21:59:47 +0000 Message-ID: <20210901215946.4nm5euczfndn4jd7@skbuf> References: <20210901085522.1712104-1-michael@walle.cc> <20210901085522.1712104-9-michael@walle.cc> <20210901102928.7m37vmk3s6nw3h6p@skbuf> <0ed0e06382a3a6f8de1c754965c3e492@walle.cc> In-Reply-To: <0ed0e06382a3a6f8de1c754965c3e492@walle.cc> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: walle.cc; dkim=none (message not signed) header.d=none;walle.cc; dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eb977770-4bc6-42b2-3074-08d96d93d079 x-ms-traffictypediagnostic: VI1PR0401MB2512: x-ld-processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rjMwM8TA6Na2URDVI7OUL82MpJ6GHPv5xD7I0c/ff06UeUfIzCngJe1kidnCmJW5qBSpyv0KkIoAmN5hQ6JOaM6lVEDXZRZOfQGJ675XUeqrXmw5aPxKcrFtgu5KsrrfUSk7yQ7PgVMI4RSR7xx6ru5cLWOir6nwXG03+0dUvLS3RAwY3Hyze0xvlY+wXBm8mWEZfUnUSdAgG75u0Kdn5kOlmWBKlhDobpcuxs10gH2UnTGKU1jCI21tKG2ppQzSETQkej+yHrVcF6J53PfBQkodJ9kj+FtR1rRbHFOLjYwBi12OoPDSODLfPw20JeLemKdnPnoNZLK5mjokUxz4Ww0nwQDcxn/J4UJpEhjiNb29L+NfErHxB40zs0X2eyiTk6xLT+JEmmREk1Mn7kY28M7k6/JSUgu/bIqO08lOxm3fxDFoA7G+Kipxn9qdvm5UK24R64AqR417pFQOErJmdaPvUjLMJR/BXsCgRD951wEOjJK8dy7BRpyP44dRPEcBHU9ANzBDJNUXVYn6SDalqjGUae4EoJc4X+biVthxvXYLegKL4f4PEpVaAaE2zVJ1zj6gY/CUctOrD9Xr1XXu1+xJR5JV4HbZXpCMkacL0oCTSOcrSctAGNm+Z+/bipDK+PxsPXXLHE5SbIAKRjzXyL82/gKPJyELbcsS29LFmy93cVLz6XPVVaFQqTTlDL5dg/nq3+/mFjYCawb0QUDjRGyX7/ok6EriEGhZFZVTR0mWvR6qtf7jCk8mS/qabMPNr11c4Mvflym4yfgk6LwjU2IjyK0Zhl9RgWuGmQeVc4I= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(7916004)(366004)(6512007)(6506007)(6916009)(9686003)(54906003)(83380400001)(2906002)(316002)(6486002)(66446008)(508600001)(76116006)(66556008)(966005)(26005)(91956017)(186003)(33716001)(4326008)(64756008)(44832011)(1076003)(38070700005)(8676002)(66476007)(71200400001)(66946007)(38100700002)(8936002)(122000001)(86362001)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?31ARQqWLF2J5orzIX4prKHv/DWMyn+KuIro6dQtRTdi1wHRAN4zBTE9UL0xE?= =?us-ascii?Q?l/mXuo0YlgmVU7ooGaDaWCEEaJzwwiZfOeLd7YH/BLuwO6WuAeyVKtQdDI0H?= =?us-ascii?Q?bWjNecK15v9Iym89ulX9e1kf3d++p8205L7AUzR9O4bQUFoXv9zGl0y6p+jD?= =?us-ascii?Q?JCCW65xFndAftYbXo5+XOlf6+fTq0lzEAJgJqqnZDphgy9idD5SxIORCFiIF?= =?us-ascii?Q?9JKQCcsoHjAoswJRNHHFcYB1of8bB9KWitmq1XeL11Nlfb4U5BYaKMHlmmj/?= =?us-ascii?Q?cb+qabYZ54DQ6yYcNPttCHVXl38PNWTCz9puHHzqh3XlKkNoNnmAqbF+tl6P?= =?us-ascii?Q?HqZrEu3tIW/x33AskErjIH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?= =?us-ascii?Q?77DpCRxwCvSaOEFwouKJPAo/PsiSlafagvmOxaGJIRJP0WGuUnbJcCP/GaUg?= =?us-ascii?Q?bfaKaw32h1TXmztXp9gfQBRg?= Content-Type: text/plain; charset="us-ascii" Content-ID: <03941985B8DBDB4D98D60CCE6EB69D97@eurprd04.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb977770-4bc6-42b2-3074-08d96d93d079 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Sep 2021 21:59:47.1381 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 39A1IslDEfyMXwv6n59kAbfnTk16iduannnsdK8139RcRBXwjREsMFJLyoW1YhtzRUGs9tdzySN/kbuhoAZP/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2512 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Wed, Sep 01, 2021 at 11:34:50PM +0200, Michael Walle wrote: > Am 2021-09-01 12:29, schrieb Vladimir Oltean: > > On Wed, Sep 01, 2021 at 10:55:21AM +0200, Michael Walle wrote: > > > - pcie1: pcie@3400000 { > > > - compatible =3D "fsl,ls-pcie", "fsl,ls1028-pcie", "snps,dw-pcie= "; > > > - reg =3D <0x00 0x03400000 0x0 0x80000 > > > - 0x00 0x03480000 0x0 0x40000 /* lut registers */ > > > - 0x00 0x034c0000 0x0 0x40000 /* pf controls registers */ > > > - 0x80 0x00000000 0x0 0x20000>; /* configuration space */ > > > - reg-names =3D "dbi", "lut", "ctrl", "config"; > > > - #address-cells =3D <3>; > > > - #size-cells =3D <2>; > > > - device_type =3D "pci"; > > > - num-lanes =3D <4>; > > > - bus-range =3D <0x0 0xff>; > > > - ranges =3D <0x81000000 0x0 0x00000000 0x80 0x00020000 0x0 > > > 0x00010000 /* downstream I/O */ > > > - 0x82000000 0x0 0x40000000 0x80 0x40000000 0x0 0x40000000>; > > > /* non-prefetchable memory */ > > > - }; > > > + pcie1: pcie@3400000 { > > > + compatible =3D "fsl,ls1028a-pcie"; > > > + reg =3D <0x00 0x03400000 0x0 0x00100000>, /* controller registers= */ > > > + <0x80 0x00000000 0x0 0x00002000>; /* configuration space */ > >=20 > > This doesn't look good, the conversion is lossy. The Linux driver > > (drivers/pci/controller/dwc/pci-layerscape.c) knows the lut_offset by > > compatible string, but the U-Boot driver > > (drivers/pci/pcie_layerscape_rc.c) > > calls fdt_get_named_resource("lut"). I.... don't think that the driver > > works with a NULL pcie->lut pointer? The StreamID writes in > > fdt_fixup_pcie_device_ls probably didn't explode because I don't have > > any PCIe card plugged in. >=20 > I guess it didn't probe anyway, because there is no driver for that > compatible string ;) omg, "ls1028" vs "ls1028a" :-/ > > Similar thing for the PEX PF control memory region. In the LS1028A RM, > > technically this is part of the larger PEX_LUT memory map, just startin= g > > from the 4_0014h offset. > >=20 > > U-Boot has this piece of logic to deduce pcie->ctrl based on pcie->lut, > > but it seems that it needs to be extended to cover LS1028A: >=20 > Only that one probably don't want to overwrite cfg_res.start and > cfg_res.end. My internal parser is broken by this phrase's syntax, but yes. > > /* > > * Fix the pcie memory map address and PF control registers address > > * for LS2088A series SoCs > > */ > > svr =3D get_svr(); > > svr =3D (svr >> SVR_VAR_PER_SHIFT) & 0xFFFFFE; > > if (svr =3D=3D SVR_LS2088A || svr =3D=3D SVR_LS2084A || > > svr =3D=3D SVR_LS2048A || svr =3D=3D SVR_LS2044A || > > svr =3D=3D SVR_LS2081A || svr =3D=3D SVR_LS2041A) { > > pcie_rc->cfg_res.start =3D LS2088A_PCIE1_PHYS_ADDR + > > LS2088A_PCIE_PHYS_SIZE * pcie->idx; > > pcie_rc->cfg_res.end =3D pcie_rc->cfg_res.start + cfg_size; > > pcie->ctrl =3D pcie->lut + 0x40000; > > } >=20 > Oh the horror! Why didn't one just change the config register value in > the (u-boot) device tree instead of overwriting the value for some > specific SoCs. Code added in commit 3d8553f0a3ee ("pci: layerscape: add LS2088A series SoC pcie support"). As to why the differentiation between LS2080A and LS2088A/LS2084A and the 4-core variants is done through code rather than through DT, Zhiqiang said: | There isn't LS2088A DT file, actually it reuse LS2080A DT file | under u-boot, while under kernel there are DT files for LS2080A | and LS2088A respectively with different PCIe node compatible | string. https://u-boot.denx.narkive.com/XVDnIKG9/patchv3-1-2-pci-layerscape-add-ls2= 088a-series-soc-pcie-support Again, as to why that is, no clue whatsoever. >=20 > > As for pcie->lut itself, simplest would be to just default to what is > > now the "dbi" reg value, plus a .lut_offset determined by compatible > > string, in the case of "fsl,ls1028a-pcie" 0x80000, just like Linux. > >=20 > > Ah, and not to mention that the reg-names are not even the same between > > U-Boot and Linux. What is "dbi" in U-Boot is "regs" in Linux :) >=20 > Well and there is a big-endian property, which of course is set for any > Layerscape but the LS1028A. linux has instead just one endianess, but > use a shift offset. You lost me here. How are registers accessed with the right endianness in Linux and in U-Boot? > Mh, I'm for sure not going to fix all these hacks in there. I'm thinking > about bascially branching to a different probe for the ls1028a based on > the compatible string (or rather if .data is set or not). Makes sense to introduce a driver data structure for LS1028A.=