{"id":1641676,"url":"http://patchwork.ozlabs.org/api/patches/1641676/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ide/patch/20220610081801.11854-19-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-19-Sergey.Semin@baikalelectronics.ru>","list_archive_url":null,"date":"2022-06-10T08:17:56","name":"[v4,18/23] ata: libahci_platform: Add function returning a clock-handle by id","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"be932f4bcb98b9b4cadfb39ca711a3bdc068c39b","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-19-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/1641676/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/1641676/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=PxmFGZU5;\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 4LKDQ110Vmz9s09\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Jun 2022 18:19:05 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n        id S244704AbiFJITC (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n        Fri, 10 Jun 2022 04:19:02 -0400","from lindbergh.monkeyblade.net ([23.128.96.19]:35932 \"EHLO\n        lindbergh.monkeyblade.net\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n        with ESMTP id S1347294AbiFJISm (ORCPT\n        <rfc822;linux-ide@vger.kernel.org>); Fri, 10 Jun 2022 04:18:42 -0400","from mail.baikalelectronics.com (mail.baikalelectronics.com\n [87.245.175.230])\n        by lindbergh.monkeyblade.net (Postfix) with ESMTP id A011B24B617;\n        Fri, 10 Jun 2022 01:18:33 -0700 (PDT)","from mail (mail.baikal.int [192.168.51.25])\n        by mail.baikalelectronics.com (Postfix) with ESMTP id 2DE9F16A6;\n        Fri, 10 Jun 2022 11:19:10 +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:17 +0300"],"DKIM-Filter":"OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 2DE9F16A6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=baikalelectronics.ru; s=mail; t=1654849150;\n        bh=Zs+DSEKY2IttBFqufTGwQAL3Q0cOXZPxf2nj/K3Sq/s=;\n        h=From:To:CC:Subject:Date:In-Reply-To:References:From;\n        b=PxmFGZU5FzCcwVJf/nb6amCx7GL7b9RTwYrXfd2oXmm4OZRuDcHfbh/a5lxwpDEI9\n         EKDJPVd5reLR8AoI9w7dY+zPso9+4zpbaVV6acaaXLDYW9n4kOdPWcTa17m02+Ncpp\n         mTOwj/XPR0HChB8bYKVzvVB/qRq7CS+PxPRQKJ9g=","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 18/23] ata: libahci_platform: Add function returning a\n clock-handle by id","Date":"Fri, 10 Jun 2022 11:17:56 +0300","Message-ID":"<20220610081801.11854-19-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":"Since all the clocks are retrieved by the method\nahci_platform_get_resources() there is no need for the LLD (glue) drivers\nto be looking for some particular of them in the kernel clocks table\nagain. Instead we suggest to add a simple method returning a\ndevice-specific clock with passed connection ID if it is managed to be\nfound. Otherwise the function will return NULL. Thus the glue-drivers\nwon't need to either manually touching the hpriv->clks array or calling\nclk_get()-friends. The AHCI platform drivers will be able to use the new\nfunction right after the ahci_platform_get_resources() method invocation\nand up to the device removal.\n\nNote the method is left unused here, but will be utilized in the framework\nof the DWC AHCI SATA driver being added in the next commit.\n\nSigned-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>\n\n---\n\nChangelog v2:\n- Fix some grammar mistakes in the method description.\n\nChangelog v4:\n- Add a note regarding the new method usage.\n---\n drivers/ata/libahci_platform.c | 27 +++++++++++++++++++++++++++\n include/linux/ahci_platform.h  |  3 +++\n 2 files changed, 30 insertions(+)","diff":"diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c\nindex 8b542a8bc487..418961f954af 100644\n--- a/drivers/ata/libahci_platform.c\n+++ b/drivers/ata/libahci_platform.c\n@@ -95,6 +95,33 @@ void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)\n }\n EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);\n \n+/**\n+ * ahci_platform_find_clk - Find platform clock\n+ * @hpriv: host private area to store config values\n+ * @con_id: clock connection ID\n+ *\n+ * This function returns a pointer to the clock descriptor of the clock with\n+ * the passed ID.\n+ *\n+ * RETURNS:\n+ * Pointer to the clock descriptor on success otherwise NULL\n+ */\n+struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id)\n+{\n+\tstruct clk *clk = NULL;\n+\tint i;\n+\n+\tfor (i = 0; i < hpriv->n_clks; i++) {\n+\t\tif (!strcmp(hpriv->clks[i].id, con_id)) {\n+\t\t\tclk = hpriv->clks[i].clk;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\treturn clk;\n+}\n+EXPORT_SYMBOL_GPL(ahci_platform_find_clk);\n+\n /**\n  * ahci_platform_enable_clks - Enable platform clocks\n  * @hpriv: host private area to store config values\ndiff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h\nindex 6d7dd472d370..3418980b0341 100644\n--- a/include/linux/ahci_platform.h\n+++ b/include/linux/ahci_platform.h\n@@ -13,6 +13,7 @@\n \n #include <linux/compiler.h>\n \n+struct clk;\n struct device;\n struct ata_port_info;\n struct ahci_host_priv;\n@@ -21,6 +22,8 @@ struct scsi_host_template;\n \n int ahci_platform_enable_phys(struct ahci_host_priv *hpriv);\n void ahci_platform_disable_phys(struct ahci_host_priv *hpriv);\n+struct clk *\n+ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id);\n int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);\n void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);\n int ahci_platform_deassert_rsts(struct ahci_host_priv *hpriv);\n","prefixes":["v4","18/23"]}