Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2418528rwn; Fri, 9 Sep 2022 13:28:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6oQ1+JKf/mZYAbin81JKMXunQbMzEdYOGR1HoZJCqtqMMMq0yifbUp/hwhvgsq4CVJDz0b X-Received: by 2002:aa7:c9c2:0:b0:440:b458:9403 with SMTP id i2-20020aa7c9c2000000b00440b4589403mr12913843edt.132.1662755321364; Fri, 09 Sep 2022 13:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662755321; cv=none; d=google.com; s=arc-20160816; b=zmXE0YV2aiVJidbxUobKU00BB1zX8yC9spyg8zwdtpY618F72NOgB5vHqh5pid86F1 X7cvbJtuaiI9MzB/2mWBwCzH4+Se5Q2pbms6eZlR8/FdhHgX0Mf/hF4MQnm04MXoqBsD +yHEH5JwIC/d9ZoQajUNf/rebVPDU4dW8/F6InXyf+nQmvhT/K6EDgxgg9FxPs7tXU2G 8cO/Z0Qy5+KR0CcEQLzpaaqakCDwsw6WFimZ7eEoJq7urm/7uu7UGBsNwSO+gkzligiw x82iujhUPRV4nyTNRdVPU261C2rga775nJtGwP79SsUiSe+mN10LzNVpfSW7i2k3sczb Fsbg== 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=rhrnZSbWpC1+1M+RgTKZFn+aypUJXi4N7nzDSxZUsFI=; b=HyC2Ybjr0J9k0dWF6YvrRqXGKz5DvUGaTYyJ1XE5UtlsZ1KRHe3tH8vK9KQKduryeE hoDrn3wA28ox5/xV+9r+jbs7ZQoPYrqF4irOZYgqBWYpfwNALB7Mvyr2/pl5pbBn9q/i Jaz+ur4EQHFyeaRy4VLUBZkweNqBP015UAuAwOFUvqh+lrFm9qa2fdAXU27uCve3U8lU yE1bgv9WhgRzR27UIsvtB5EQCvyMIxWEBPGAORUpNQyBP2RmeZ3WiCZONausgZtLe7fh X3fg9xSMPuaov4GXTDlQP+934V2pKC8QSCcj94KzJdRwR+/FHVvof1za9rVBcOHkrjNY Xtcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=X1RgDR7u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc40-20020a17090716a800b00730c9a41812si1213342ejc.723.2022.09.09.13.28.15; Fri, 09 Sep 2022 13:28:41 -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=X1RgDR7u; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbiIITh1 (ORCPT + 99 others); Fri, 9 Sep 2022 15:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbiIITg7 (ORCPT ); Fri, 9 Sep 2022 15:36:59 -0400 Received: from mail.baikalelectronics.com (mail.baikalelectronics.com [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 777A5114A65; Fri, 9 Sep 2022 12:36:41 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 0E152DC0; Fri, 9 Sep 2022 22:40:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 0E152DC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1662752425; bh=rhrnZSbWpC1+1M+RgTKZFn+aypUJXi4N7nzDSxZUsFI=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=X1RgDR7uBneTQoIDep2jJUEo9CCjeOOta0eN3C0t+s9oksDoa/hc5XjEHFo986btS GQ8+NfzEKF/dc4GRQG8N6zUeDvO385oY84GPutS5oXYG65TvoeDDGnTPheVogbuwGv Z26tuO6krIsRSLJsuZUgBNBMftqtOGYtSFJ3fJ2A= Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 9 Sep 2022 22:36:36 +0300 From: Serge Semin To: Damien Le Moal , Hans de Goede , Jens Axboe , Hannes Reinecke , Matthias Brugger , Patrice Chotard CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , Krzysztof Kozlowski , , , , , Subject: [PATCH v8 09/23] ata: libahci_platform: Parse ports-implemented property in resources getter Date: Fri, 9 Sep 2022 22:36:07 +0300 Message-ID: <20220909193621.17380-10-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220909193621.17380-1-Sergey.Semin@baikalelectronics.ru> References: <20220909193621.17380-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_PASS,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 bacb974c1b16..085f99b2eb5a 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -485,6 +485,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.37.2