{"id":815813,"url":"http://patchwork.ozlabs.org/api/patches/815813/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-3-tuomas.tynkkynen@iki.fi/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170919201808.11433-3-tuomas.tynkkynen@iki.fi>","list_archive_url":null,"date":"2017-09-19T20:18:04","name":"[U-Boot,v2,2/6] pci: xilinx: Use pci_generic_mmap_{read, write}_config()","commit_ref":"75e3feac1bd707f205705d8e8d233db4c2e752fd","pull_url":null,"state":"accepted","archived":false,"hash":"977171293f6586edea26ac6fc2a65d52d4000600","submitter":{"id":32296,"url":"http://patchwork.ozlabs.org/api/people/32296/?format=json","name":"Tuomas Tynkkynen","email":"tuomas.tynkkynen@iki.fi"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-3-tuomas.tynkkynen@iki.fi/mbox/","series":[{"id":3961,"url":"http://patchwork.ozlabs.org/api/series/3961/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3961","date":"2017-09-19T20:18:02","name":"Board for QEMU's '-machine virt' on ARM","version":2,"mbox":"http://patchwork.ozlabs.org/series/3961/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815813/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815813/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"nLf7Uhg9\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxZ4g01X2z9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 06:20:34 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C3FACC21DC1; Tue, 19 Sep 2017 20:19:05 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 1BE44C21D93;\n\tTue, 19 Sep 2017 20:18:35 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 8EB01C21DA1; Tue, 19 Sep 2017 20:18:28 +0000 (UTC)","from mail-lf0-f67.google.com (mail-lf0-f67.google.com\n\t[209.85.215.67])\n\tby lists.denx.de (Postfix) with ESMTPS id 4E691C21C4F\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 20:18:26 +0000 (UTC)","by mail-lf0-f67.google.com with SMTP id m199so346972lfe.5\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 13:18:26 -0700 (PDT)","from localhost.localdomain (85-76-68-181-nat.elisa-mobile.fi.\n\t[85.76.68.181]) by smtp.gmail.com with ESMTPSA id\n\ta197sm21154lfe.95.2017.09.19.13.18.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 13:18:24 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=UVFhMUZXfpnzQUGBWX3oZ8gKq79pewYAoj4hC/G0L1c=;\n\tb=nLf7Uhg9I1BF1x6iHGBC2TOQO/ybe8ymDalEeJIV4pXkXa9PVEV/Wwg3JsU98c4QcF\n\t1+rrsCoOWZersqfAxd4Poo22VKvnhWUpMnQOLd0FpB78KW4v3KQ5IhSnjkXuYp3hWYnG\n\toUjR5wC5Cu6f5uiG7/dsfwQTZfJCw6MBT62KdlNHfQNhf8o7u61fwNRpK18Wmc6LUs+v\n\tOQLizxhrRMv1F4vc7AaXX7Ol3ia4Pg1EismHTjIQGIUIRhkRlm5t4z8GtVx6R3120cud\n\tJli8u3gNAWuy1klRFzYrN3UmcNJ0yyTQvThKhIPEuSviZxn5NuzJG464xp3p4HwIiQrH\n\t/cHA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=UVFhMUZXfpnzQUGBWX3oZ8gKq79pewYAoj4hC/G0L1c=;\n\tb=okvC62QLN37BHcVUGlxSH+ZKugj1ewlbwqbGpMTQz7Zr99hUEPADyYXg5DvEuhtnjI\n\tbUAqGdWYKJidGGNpnsf1ZpYLFfwJxTU5XMn92z8fj46JHK52yTS/W/OymB/Mp3kkgAwV\n\tjFTpj+Ge5Z2f7fI65fpf9mMwLQx8MTf+WYBOxAs/2Hrz5SnRhMXivU5CMyoHPytNaNYu\n\tpEvSz/DIzxSEYQnhxbKo+66WcmXii5P5qAxhm/7o+vOdZ+NwHnWkrwj/i1hvvCYfu3pI\n\tF0X1/MAGIwcwan8gV8Fyo0VSd8D3e7ofmLkZZJuN16ZNEe2DWa9x/ZdRgVetZR2hYt5k\n\tW5+w==","X-Gm-Message-State":"AHPjjUiIWjWeGyb122+GwEc2CEIwQbVobQCwrLSiNY/gnAMUUdl6xyVr\n\t49MQDUkN3nHcdG2y15CGOkRkMQ==","X-Google-Smtp-Source":"AOwi7QBTiEkzIA/9pnMW6V7d8e9n03Y+UF12pYfNpcgoZ6XJnhO3DkQNpiJPFIqE6tC70GltYu668w==","X-Received":"by 10.25.156.143 with SMTP id f137mr893463lfe.178.1505852305559; \n\tTue, 19 Sep 2017 13:18:25 -0700 (PDT)","From":"Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>","To":"u-boot@lists.denx.de","Date":"Tue, 19 Sep 2017 23:18:04 +0300","Message-Id":"<20170919201808.11433-3-tuomas.tynkkynen@iki.fi>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>","References":"<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>","Cc":"Tom Rini <trini@konsulko.com>","Subject":"[U-Boot] [PATCH v2 2/6] pci: xilinx: Use pci_generic_mmap_{read,\n\twrite}_config()","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Use the new helper function to avoid boilerplate in the driver.\n\nNote that this changes __raw_writel et al. to writel. AFAICT this is\nno problem because:\n\n- The Linux driver for the same hardware uses the non-__raw variants as\n  well (via pci_generic_config_write()).\n- This driver seems to be used only on MIPS so far, where the __raw and\n  non-__raw accessors are the same.\n\nSigned-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>\n---\n drivers/pci/pcie_xilinx.c | 53 +++++++----------------------------------------\n 1 file changed, 7 insertions(+), 46 deletions(-)","diff":"diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c\nindex 08e2e93445..d788552fed 100644\n--- a/drivers/pci/pcie_xilinx.c\n+++ b/drivers/pci/pcie_xilinx.c\n@@ -43,7 +43,7 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie)\n \n /**\n  * pcie_xilinx_config_address() - Calculate the address of a config access\n- * @pcie: Pointer to the PCI controller state\n+ * @udev: Pointer to the PCI bus\n  * @bdf: Identifies the PCIe device to access\n  * @offset: The offset into the device's configuration space\n  * @paddress: Pointer to the pointer to write the calculates address to\n@@ -57,9 +57,10 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie)\n  *\n  * Return: 0 on success, else -ENODEV\n  */\n-static int pcie_xilinx_config_address(struct xilinx_pcie *pcie, pci_dev_t bdf,\n+static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf,\n \t\t\t\t      uint offset, void **paddress)\n {\n+\tstruct xilinx_pcie *pcie = dev_get_priv(udev);\n \tunsigned int bus = PCI_BUS(bdf);\n \tunsigned int dev = PCI_DEV(bdf);\n \tunsigned int func = PCI_FUNC(bdf);\n@@ -103,29 +104,8 @@ static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf,\n \t\t\t\t   uint offset, ulong *valuep,\n \t\t\t\t   enum pci_size_t size)\n {\n-\tstruct xilinx_pcie *pcie = dev_get_priv(bus);\n-\tvoid *address;\n-\tint err;\n-\n-\terr = pcie_xilinx_config_address(pcie, bdf, offset, &address);\n-\tif (err < 0) {\n-\t\t*valuep = pci_get_ff(size);\n-\t\treturn 0;\n-\t}\n-\n-\tswitch (size) {\n-\tcase PCI_SIZE_8:\n-\t\t*valuep = __raw_readb(address);\n-\t\treturn 0;\n-\tcase PCI_SIZE_16:\n-\t\t*valuep = __raw_readw(address);\n-\t\treturn 0;\n-\tcase PCI_SIZE_32:\n-\t\t*valuep = __raw_readl(address);\n-\t\treturn 0;\n-\tdefault:\n-\t\treturn -EINVAL;\n-\t}\n+\treturn pci_generic_mmap_read_config(bus, pcie_xilinx_config_address,\n+\t\t\t\t\t    bdf, offset, valuep, size);\n }\n \n /**\n@@ -146,27 +126,8 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf,\n \t\t\t\t    uint offset, ulong value,\n \t\t\t\t    enum pci_size_t size)\n {\n-\tstruct xilinx_pcie *pcie = dev_get_priv(bus);\n-\tvoid *address;\n-\tint err;\n-\n-\terr = pcie_xilinx_config_address(pcie, bdf, offset, &address);\n-\tif (err < 0)\n-\t\treturn 0;\n-\n-\tswitch (size) {\n-\tcase PCI_SIZE_8:\n-\t\t__raw_writeb(value, address);\n-\t\treturn 0;\n-\tcase PCI_SIZE_16:\n-\t\t__raw_writew(value, address);\n-\t\treturn 0;\n-\tcase PCI_SIZE_32:\n-\t\t__raw_writel(value, address);\n-\t\treturn 0;\n-\tdefault:\n-\t\treturn -EINVAL;\n-\t}\n+\treturn pci_generic_mmap_write_config(bus, pcie_xilinx_config_address,\n+\t\t\t\t\t     bdf, offset, value, size);\n }\n \n /**\n","prefixes":["U-Boot","v2","2/6"]}