Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp900487iob; Wed, 4 May 2022 10:13:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0XLO2pR7L2TjyBKH7Mnx8wRgCEKXZiy2s0f+uB8x9fs1ieJ6o59Bma1sKPgGei11RfTI0 X-Received: by 2002:a50:f69b:0:b0:425:e693:5d1f with SMTP id d27-20020a50f69b000000b00425e6935d1fmr24257712edn.272.1651684414656; Wed, 04 May 2022 10:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651684414; cv=none; d=google.com; s=arc-20160816; b=EYDpE3KmJ+0FEncEcoWkny5MO0fWhBCWG5UWOcvea+Qcb4sELOZA87Va4py+XeJhh5 zGTC8OLzC04EXMIEfUX8PdzBdmVZr6zVFgOrNVXbX0uR3u7jMoqwipbr7kNyTWh0mcMI APr5yBSNCFDSNVEOYHPelguauK8my6Vd2JfMaVbEjCX6VjRikF5i6eIaevJruO5y2JqR vd2NQ6tmjo/V3zxx3HiVd6Z5UNhxdvHJDz9yWhkr7NGs3VrR+bcbFRKLYXd6mdgE7MiP jhz3WWRDaf6r6L5hxE8BsGIxZq1Ld4E4LZrcg98uHrpCp+8xbCJUSGsWJ6F8D+dP7mOE R9MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=kAvAo0Xyh3tr65Bbm2f0YNCTB8PUXE60W2QC7FBw7fk=; b=Jx61QbmRZ31T/W0CO1chzZ9bvndy5ZyWoN852+SUcj8ytgiZM4Z2Oyr8CT5Q71eJsw Pr1WKIBmoJ8wOmaDj2+GoBeTHpsKNr03dZf/hGCMWLeVxam89Vr1DM7Bj/cyE5y21uAg XvbIPGQWzFSWNV7Ap2g49xmrGEsTpWye1k1jrzb0M2/2sP8qZn1FISUjKrhuu5yf3mdT BZvSzuE3jwyRC7U5wEWaXqV/HNgd6Tr8DROisfx/V6/qMj7HDZfjRXl0ldg2vIoBLF+X v8F+mKlmhvH0K7pDbFz+RvGXFMpkmZbeW0PLCoB29ueKFik8IxUf0+mooKiz3p2f/eS8 2SWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=BXNqjfro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a1709064ac400b006f38d89f91bsi16695434ejt.380.2022.05.04.10.13.10; Wed, 04 May 2022 10:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=BXNqjfro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242333AbiECUOb (ORCPT + 99 others); Tue, 3 May 2022 16:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242179AbiECUNo (ORCPT ); Tue, 3 May 2022 16:13:44 -0400 Received: from mail.baikalelectronics.ru (mail.baikalelectronics.com [87.245.175.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5951826AE3; Tue, 3 May 2022 13:10:10 -0700 (PDT) Received: from mail.baikalelectronics.ru (unknown [192.168.51.25]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 30DDA1DFF8; Tue, 3 May 2022 23:10:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.ru 30DDA1DFF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1651608643; bh=kAvAo0Xyh3tr65Bbm2f0YNCTB8PUXE60W2QC7FBw7fk=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=BXNqjfrowSppsCXS/eEP5oiCtRHrkp7J5zx8sF1YZJW5+CrDLPITMNPUP/7FO4VEo 7zPkkNjM0fLqUbG5puihgYgAl7YGF5iCyRNSvmuUpDcIsSqSK2+5mM4dpwnCLn0coP 387ayr7TmHmrUsQHgzMnNQVyNBeJ6Q6PNMEd0kac= Received: from localhost (192.168.53.207) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 3 May 2022 23:10:09 +0300 From: Serge Semin To: Damien Le Moal , Hans de Goede , Jens Axboe , Matthias Brugger , Patrice Chotard CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , , , , , Subject: [PATCH v2 10/23] ata: libahci_platform: Parse ports-implemented property in resources getter Date: Tue, 3 May 2022 23:09:25 +0300 Message-ID: <20220503200938.18027-11-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220503200938.18027-1-Sergey.Semin@baikalelectronics.ru> References: <20220503200938.18027-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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ports-implemented property is mainly used on the OF-based platforms with no ports mapping initialized by a bootloader/BIOS firmware. Seeing the same of_property_read_u32()-based pattern has already been implemented in the generic AHCI LLDD (glue) driver and in the Mediatek, St AHCI drivers let's move the property read procedure to the generic ahci_platform_get_resources() method. Thus we'll have the forced ports mapping feature supported for each OF-based platform which requires that, and stop re-implementing the same pattern in there a bit simplifying the code. Signed-off-by: Serge Semin --- drivers/ata/ahci_mtk.c | 2 -- drivers/ata/ahci_platform.c | 3 --- drivers/ata/ahci_st.c | 3 --- drivers/ata/libahci_platform.c | 3 +++ 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c index 1f6c85fde983..c056378e3e72 100644 --- a/drivers/ata/ahci_mtk.c +++ b/drivers/ata/ahci_mtk.c @@ -118,8 +118,6 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv, SYS_CFG_SATA_EN); } - of_property_read_u32(np, "ports-implemented", &hpriv->force_port_map); - return 0; } diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 28a8de5b48b9..9b56490ecbc3 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -56,9 +56,6 @@ static int ahci_probe(struct platform_device *pdev) if (rc) return rc; - of_property_read_u32(dev->of_node, - "ports-implemented", &hpriv->force_port_map); - if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c index 7526653c843b..068621099c00 100644 --- a/drivers/ata/ahci_st.c +++ b/drivers/ata/ahci_st.c @@ -168,9 +168,6 @@ static int st_ahci_probe(struct platform_device *pdev) st_ahci_configure_oob(hpriv->mmio); - of_property_read_u32(dev->of_node, - "ports-implemented", &hpriv->force_port_map); - err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, &ahci_platform_sht); if (err) { diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 4e54e19f07b2..f7f9cac10cb1 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -512,6 +512,9 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, goto err_out; } + of_property_read_u32(dev->of_node, + "ports-implemented", &hpriv->force_port_map); + if (child_nodes) { for_each_child_of_node(dev->of_node, child) { u32 port; -- 2.35.1