{"id":1641653,"url":"http://patchwork.ozlabs.org/api/patches/1641653/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ide/patch/20220610081801.11854-7-Sergey.Semin@baikalelectronics.ru/","project":{"id":13,"url":"http://patchwork.ozlabs.org/api/projects/13/?format=json","name":"Linux IDE development","link_name":"linux-ide","list_id":"linux-ide.vger.kernel.org","list_email":"linux-ide@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20220610081801.11854-7-Sergey.Semin@baikalelectronics.ru>","list_archive_url":null,"date":"2022-06-10T08:17:44","name":"[v4,06/23] ata: libahci_platform: Convert to using platform devm-ioremap methods","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d0206e9d307075c6f11e72834d71d389d14e8823","submitter":{"id":78624,"url":"http://patchwork.ozlabs.org/api/people/78624/?format=json","name":"Serge Semin","email":"Sergey.Semin@baikalelectronics.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ide/patch/20220610081801.11854-7-Sergey.Semin@baikalelectronics.ru/mbox/","series":[{"id":304159,"url":"http://patchwork.ozlabs.org/api/series/304159/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ide/list/?series=304159","date":"2022-06-10T08:17:42","name":"ata: ahci: Add DWC/Baikal-T1 AHCI SATA support","version":4,"mbox":"http://patchwork.ozlabs.org/series/304159/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1641653/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1641653/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-ide-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["bilbo.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=baikalelectronics.ru header.i=@baikalelectronics.ru\n header.a=rsa-sha256 header.s=mail header.b=C3zlayNv;\n\tdkim-atps=neutral","ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2620:137:e000::1:20; helo=out1.vger.email;\n envelope-from=linux-ide-owner@vger.kernel.org; receiver=<UNKNOWN>)"],"Received":["from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 4LKDPc12fNz9s09\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Jun 2022 18:18:44 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n        id S1347279AbiFJISl (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n        Fri, 10 Jun 2022 04:18:41 -0400","from lindbergh.monkeyblade.net ([23.128.96.19]:34892 \"EHLO\n        lindbergh.monkeyblade.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n        with ESMTP id S1347162AbiFJISS (ORCPT\n        <rfc822;linux-ide@vger.kernel.org>); Fri, 10 Jun 2022 04:18:18 -0400","from mail.baikalelectronics.com (mail.baikalelectronics.com\n [87.245.175.230])\n        by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4359235B0A;\n        Fri, 10 Jun 2022 01:18:16 -0700 (PDT)","from mail (mail.baikal.int [192.168.51.25])\n        by mail.baikalelectronics.com (Postfix) with ESMTP id 3CD2F16A7;\n        Fri, 10 Jun 2022 11:19:00 +0300 (MSK)","from localhost (192.168.53.207) by mail (192.168.51.25) with\n Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 10 Jun 2022 11:18:07 +0300"],"DKIM-Filter":"OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 3CD2F16A7","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=baikalelectronics.ru; s=mail; t=1654849140;\n        bh=cwjTY+UXbYCa95/dq1KpC5+URj+jwo1L4bVykF4JcuI=;\n        h=From:To:CC:Subject:Date:In-Reply-To:References:From;\n        b=C3zlayNvOLSLbTJO3Mz1lUZzlLrubDMMSbB4otsv28Ez4JOHihCXHpi5Z77Emq/Ed\n         oKWWD1FmuX506t3osYyTIlZBhU8R/tXSYRw8ERDBKaejCFBqH/Ow1Bhb84X+Q/2S72\n         QDKmNq+23KBiI+cqbI8tOjBLqMHeIkN7l58aAidA=","From":"Serge Semin <Sergey.Semin@baikalelectronics.ru>","To":"Damien Le Moal <damien.lemoal@opensource.wdc.com>,\n        Hans de Goede <hdegoede@redhat.com>,\n        Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>","CC":"Serge Semin <Sergey.Semin@baikalelectronics.ru>,\n        Serge Semin <fancer.lancer@gmail.com>,\n        Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,\n        Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,\n        Rob Herring <robh+dt@kernel.org>, <linux-ide@vger.kernel.org>,\n        <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>","Subject":"[PATCH v4 06/23] ata: libahci_platform: Convert to using platform\n devm-ioremap methods","Date":"Fri, 10 Jun 2022 11:17:44 +0300","Message-ID":"<20220610081801.11854-7-Sergey.Semin@baikalelectronics.ru>","In-Reply-To":"<20220610081801.11854-1-Sergey.Semin@baikalelectronics.ru>","References":"<20220610081801.11854-1-Sergey.Semin@baikalelectronics.ru>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-ClientProxiedBy":"MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25)","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n        DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,\n        T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no\n        version=3.4.6","X-Spam-Checker-Version":"SpamAssassin 3.4.6 (2021-04-09) on\n        lindbergh.monkeyblade.net","Precedence":"bulk","List-ID":"<linux-ide.vger.kernel.org>","X-Mailing-List":"linux-ide@vger.kernel.org"},"content":"Currently the IOMEM AHCI registers space is mapped by means of the\ntwo functions invocation: platform_get_resource() is used to get the very\nfirst memory resource and devm_ioremap_resource() is called to remap that\nresource. Device-managed kernel API provides a handy wrapper to perform\nthe same in single function call: devm_platform_ioremap_resource().\n\nWhile at it seeing many AHCI platform drivers rely on having the AHCI CSR\nspace marked with \"ahci\" name let's first try to find and remap the CSR\nIO-mem with that name and only if it fails fallback to getting the very\nfirst registers space platform resource.\n\nSigned-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>\nReviewed-by: Hannes Reinecke <hare@suse.de>\n\n---\n\nChangelog v2:\n- Check whether there is \"ahci\" reg resource before using the\n  devm_platform_ioremap_resource_byname() method in order to prevent a\n  false error message printed in the log (@Damien)\n- Slightly update the patch title due to the change above and to be more\n  specific about what the platform device managed methods are utilized\n  for.\n---\n drivers/ata/libahci_platform.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c\nindex 32495ae96567..1e9e825d6cc5 100644\n--- a/drivers/ata/libahci_platform.c\n+++ b/drivers/ata/libahci_platform.c\n@@ -402,8 +402,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,\n \n \tdevres_add(dev, hpriv);\n \n-\thpriv->mmio = devm_ioremap_resource(dev,\n-\t\t\t      platform_get_resource(pdev, IORESOURCE_MEM, 0));\n+\t/*\n+\t * If the DT provided an \"ahci\" named resource, use it. Otherwise,\n+\t * fallback to using the default first resource for the device node.\n+\t */\n+\tif (platform_get_resource_byname(pdev, IORESOURCE_MEM, \"ahci\"))\n+\t\thpriv->mmio = devm_platform_ioremap_resource_byname(pdev, \"ahci\");\n+\telse\n+\t\thpriv->mmio = devm_platform_ioremap_resource(pdev, 0);\n \tif (IS_ERR(hpriv->mmio)) {\n \t\trc = PTR_ERR(hpriv->mmio);\n \t\tgoto err_out;\n","prefixes":["v4","06/23"]}