Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2386135rwn; Fri, 9 Sep 2022 12:54:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5tvIaR04qNix/PQFGasHgnEH8+9w3dmRCIJoZkNiqtjGhz30uPW5NGa5IyhhCANhFJPiU8 X-Received: by 2002:a17:907:3e8b:b0:741:9b21:f2a5 with SMTP id hs11-20020a1709073e8b00b007419b21f2a5mr11180162ejc.320.1662753246681; Fri, 09 Sep 2022 12:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662753246; cv=none; d=google.com; s=arc-20160816; b=Dnv95YEmKqAP47DUI1q806IfpVojEeCHG9l7P3xMmYnUW/SmOuRl8/piNL0CAFhP72 wyOzndy4s+l9IMS5GrY1GQnUhU0r69btmTqSXEUlnGYCDKZNuR9FLJjfkJkghFA/D1fo H8GJRn87dVbBjkGhlCPSvowKv34fKdryFfWiMoznD+E94KlX1K8CkG08QjsCP0N/XzO0 X6RQxdop1CV8nJQO0PMZxwGJ3qhAmHKZMTudu5ogtlSzQZE9svl0LOmYZiQvgUUyTwL7 fU8woPvdv2yqPJsY9uXpHyWBJgA78xn+HD7EcBFHU6tEuYkBV/JI6j+vtOyssSJxo6r3 jKag== 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=UQ0nLdDhSzWtNcB1iar518w4MATzJhPIimxsv/c0UjM=; b=P9X6AdKRWQSx5zExXsFM3aJpqnEI8XLRlWC01fzGwuKaRox+DnD5lLxlaB8IVuBmr6 4gi8ke8SetJYByHUd8nRZmmxGmkYLW19haTLbgSuS0O2UMg8h2CqfW3zhoD3agFPSCod XcXMMicSHY0fkAXspGQJzsbvsVmNhYLzUtuTwNYB4uwKVRVtaLNM2Z52xlA9GsO0zJGj wH1aq6RS9GpDpUbt/Qy5EU9cY8EvF8T6WUFVKOJT4cUtNJV98lepu0/LBmDG+r3ypb9G xMyoe4qzP0Xng/hbEOjhDBWRXyfAVOviObu65+mEOcyeAhuXWz36vmolYz8lDV598UuX nwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=CL2Dv+vj; 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 y22-20020a056402441600b00447d6f244c6si1435338eda.248.2022.09.09.12.53.42; Fri, 09 Sep 2022 12:54:06 -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=CL2Dv+vj; 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 S231808AbiIITiD (ORCPT + 99 others); Fri, 9 Sep 2022 15:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbiIIThL (ORCPT ); Fri, 9 Sep 2022 15:37:11 -0400 Received: from mail.baikalelectronics.com (mail.baikalelectronics.com [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EC6FA116B6A; Fri, 9 Sep 2022 12:36:45 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 0C05FDC1; Fri, 9 Sep 2022 22:40:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 0C05FDC1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1662752427; bh=UQ0nLdDhSzWtNcB1iar518w4MATzJhPIimxsv/c0UjM=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=CL2Dv+vjBwE9UIQ2KIJlrxBZMxuyvJUp2RindUWWCN5kQg91TgrDmdxrRt3Kv0lIE NLzhoVUdJxkE034Ht2rQrHugRsxjJRwQnYccUrmYUp8RILHkwN83C/4xqcPruImhG9 8eS0iaZIv148OrI0zPzXJYR9qzyP3tNJTI1IEGeQ= 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:38 +0300 From: Serge Semin To: Damien Le Moal , Hans de Goede , Jens Axboe , Hannes Reinecke , Rob Herring , Krzysztof Kozlowski CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , , , , Rob Herring Subject: [PATCH v8 11/23] dt-bindings: ata: ahci: Add platform capability properties Date: Fri, 9 Sep 2022 22:36:09 +0300 Message-ID: <20220909193621.17380-12-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 In case if the platform doesn't have BIOS or a comprehensive firmware installed then the HBA capability flags will be left uninitialized. As a good alternative we suggest to define the DT-properties with the AHCI platform capabilities describing all the HW-init flags of the corresponding capability register. Luckily there aren't too many of them. SSS - Staggered Spin-up support and MPS - Mechanical Presence Switch support determine the corresponding feature availability for the whole HBA by means of the "hba-cap" property. Each port can have the "hba-port-cap" property initialized indicating that the port supports some of the next functionalities: HPCP - HotPlug capable port, MPSP - Mechanical Presence Switch attached to a port, CPD - Cold Plug detection, ESP - External SATA Port (eSATA), FBSCP - FIS-based switching capable port. Signed-off-by: Serge Semin Reviewed-by: Rob Herring --- Changelog v4: - Fix some misspelling in the patch log. - Convert the boolean properties to the bitfield properties. (@Rob) - Remove Hannes' rb tag due to the patch content change. Changelog v5: - Dual-licese the include/dt-bindings/ata/ahci.h file. (@Rob) --- .../devicetree/bindings/ata/ahci-common.yaml | 16 +++++++++++++++ .../bindings/ata/ahci-platform.yaml | 10 ++++++++++ include/dt-bindings/ata/ahci.h | 20 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 include/dt-bindings/ata/ahci.h diff --git a/Documentation/devicetree/bindings/ata/ahci-common.yaml b/Documentation/devicetree/bindings/ata/ahci-common.yaml index 12a97b56226f..94d72aeaad0f 100644 --- a/Documentation/devicetree/bindings/ata/ahci-common.yaml +++ b/Documentation/devicetree/bindings/ata/ahci-common.yaml @@ -58,6 +58,14 @@ properties: phy-names: const: sata-phy + hba-cap: + $ref: '/schemas/types.yaml#/definitions/uint32' + description: + Bitfield of the HBA generic platform capabilities like Staggered + Spin-up or Mechanical Presence Switch support. It can be used to + appropriately initialize the HWinit fields of the HBA CAP register + in case if the system firmware hasn't done it. + ports-implemented: $ref: '/schemas/types.yaml#/definitions/uint32' description: @@ -101,6 +109,14 @@ $defs: target-supply: description: Power regulator for SATA port target device + hba-port-cap: + $ref: '/schemas/types.yaml#/definitions/uint32' + description: + Bitfield of the HBA port-specific platform capabilities like Hot + plugging, eSATA, FIS-based Switching, etc (see AHCI specification + for details). It can be used to initialize the HWinit fields of + the PxCMD register in case if the system firmware hasn't done it. + required: - reg diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.yaml b/Documentation/devicetree/bindings/ata/ahci-platform.yaml index 15be98e0385b..e19cf9828e68 100644 --- a/Documentation/devicetree/bindings/ata/ahci-platform.yaml +++ b/Documentation/devicetree/bindings/ata/ahci-platform.yaml @@ -111,6 +111,8 @@ examples: - | #include #include + #include + sata@f7e90000 { compatible = "marvell,berlin2q-ahci", "generic-ahci"; reg = <0xf7e90000 0x1000>; @@ -119,15 +121,23 @@ examples: #address-cells = <1>; #size-cells = <0>; + hba-cap = ; + sata0: sata-port@0 { reg = <0>; + phys = <&sata_phy 0>; target-supply = <®_sata0>; + + hba-port-cap = <(HBA_PORT_FBSCP | HBA_PORT_ESP)>; }; sata1: sata-port@1 { reg = <1>; + phys = <&sata_phy 1>; target-supply = <®_sata1>; + + hba-port-cap = <(HBA_PORT_HPCP | HBA_PORT_MPSP | HBA_PORT_FBSCP)>; }; }; diff --git a/include/dt-bindings/ata/ahci.h b/include/dt-bindings/ata/ahci.h new file mode 100644 index 000000000000..77997b35612c --- /dev/null +++ b/include/dt-bindings/ata/ahci.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause */ +/* + * This header provides constants for most AHCI bindings. + */ + +#ifndef _DT_BINDINGS_ATA_AHCI_H +#define _DT_BINDINGS_ATA_AHCI_H + +/* Host Bus Adapter generic platform capabilities */ +#define HBA_SSS (1 << 27) +#define HBA_SMPS (1 << 28) + +/* Host Bus Adapter port-specific platform capabilities */ +#define HBA_PORT_HPCP (1 << 18) +#define HBA_PORT_MPSP (1 << 19) +#define HBA_PORT_CPD (1 << 20) +#define HBA_PORT_ESP (1 << 21) +#define HBA_PORT_FBSCP (1 << 22) + +#endif -- 2.37.2