From patchwork Tue May 21 18:37:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0FE6C25B7C for ; Tue, 21 May 2024 18:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gdkEcoatIOjVc+WszuMe/dYyZmQr027IxKBV6MMZCCk=; b=N/c30h3Xp2kkS6 w6fHrVb350bPRlgiQ1uakb0ZzRrP00eceAv23l5KksCCiM99Jrpaov22GYqcW/KX+qnVlHuhuqzfN 0I3Ed1IHfs267f7aTFTouXaeaTdT+IROWsTfrSuFdVc/izO9xYhFWwYHMlGa1Z4EWbzntTMN69u4t 6rmh8EeY2Dz52Lv18YCwst8B080cSOTf4PudeFGIAtXrd3+gYEZj66fdDJgMVWsQs3C9dtPCnKSSH dSy549PUOd8B4FhNfrhNCgL2K/gI30PqJQeTqh07BdchqtbEVmUtAwWOXt6e2EL07RlAqk5bcrNAa vPl4aBF9bqChII39WbHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNy-00000000nYX-42lK; Tue, 21 May 2024 18:38:54 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nS9-0ZHL for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:43 +0000 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LAA2GQ017585; Tue, 21 May 2024 18:38:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=wFapvs5sqECt2yxAZvhfcK0g+PRdjhRiLtTWYhQWucQ =; b=NAGyhtbMm5LAUGeze8VjPInLHswAvQtfgjjxfinPp7Jabyk95u7T2QAbTVj wId82CdOgOstbO2oesqg6JAoQbyhi62Ra6kebTfHLzXSFAomcl2xNDhE96GOQAE5 2nmamIZnNfKJhydqr/QMn0ERgbKWg8t16sLeY/x/N/zfSZt9wBiDeKSZP0wjjsOC EIl0QdsfZhYJ5d0By9bhSJu4njx/uQMePlcmNKMbGVjIW/ZDfUjr4obmlIdAv37s dwUUOqlzUhrK2q5LK1basyrsiYkUU4ScSnAKRnLvbAGtgXYy2JsjkEaWK2dSeU22 RWUPU81K6A+QU5BqNpiBAvpwPQQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pq5esgw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:27 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcP5U012112 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:25 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:24 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:37:58 -0700 Subject: [PATCH RFC v3 1/9] libfdt: board-id: Implement board-id scoring MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-1-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 97M0_qhDY4fDkHKWdgZ-TnVPL5Q5oHL6 X-Proofpoint-ORIG-GUID: 97M0_qhDY4fDkHKWdgZ-TnVPL5Q5oHL6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113840_256184_3760C727 X-CRM114-Status: GOOD ( 22.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The devicetree spec introduced a mechanism to match devicetree blobs to boards using firmware-provided identifiers. Although the matching can be implemented by DTB loaders, having a canonical implementation makes it easier to integrate and ensure consistent behavior across ecosystems. I've not yet investigated swig/python support for the new functions; I would work on that before submitting the patch to libfdt. Signed-off-by: Elliot Berman --- scripts/dtc/libfdt/fdt_ro.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ scripts/dtc/libfdt/libfdt.h | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index 9f6c551a22c2..b19b17127399 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c @@ -857,3 +857,79 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset, return offset; /* error from fdt_next_node() */ } + +int fdt_board_id_prop_matches(const void *fdt, + const struct fdt_property *prop, + fdt_get_board_id_t get_board_id_cb, + void *ctx) +{ + int data_len; + const void *data; + const char *name; + int name_len; + int string = 0; + + name = fdt_get_string(fdt, fdt32_to_cpu(prop->nameoff), &name_len); + if (!name) + return -FDT_ERR_BADOFFSET; + + if (name_len > 4 && !strcmp(name + name_len - 4, "_str")) + string = 1; + + data = get_board_id_cb(ctx, name, &data_len); + if (!data) + return -FDT_ERR_NOTFOUND; + + if (string) { + return fdt_stringlist_contains(prop->data, + fdt32_to_cpu(prop->len), + data); + } else { + // exact data comparison. data_len is the size of each entry + if (fdt32_to_cpu(prop->len) % data_len || data_len % 4) + return -FDT_ERR_BADVALUE; + + for (int i = 0; i < fdt32_to_cpu(prop->len); i += data_len) { + if (!memcmp(&prop->data[i], data, data_len)) + return 1; + } + + return 0; + } + + return 0; +} + +int fdt_board_id_score(const void *fdt, fdt_get_board_id_t get_board_id_cb, + void *ctx) +{ + const struct fdt_property *prop; + int node, property, ret, score = 0; + const char *name; + + node = fdt_path_offset(fdt, "/board-id"); + if (node < 0) + return node; + + fdt_for_each_property_offset(property, fdt, node) { + prop = fdt_get_property_by_offset(fdt, property, NULL); + if (!prop) + return -FDT_ERR_BADOFFSET; + + name = fdt_get_string(fdt, fdt32_to_cpu(prop->nameoff), NULL); + if (!name) + return -FDT_ERR_BADOFFSET; + + if (!strcmp(name, "phandle") || !strcmp(name, "linux,phandle")) + continue; + + ret = fdt_board_id_prop_matches(fdt, prop, get_board_id_cb, + ctx); + if (ret == 1) + score++; + else + return ret; + } + + return score; +} diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 77ccff19911e..de1cbc339315 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1230,6 +1230,60 @@ int fdt_address_cells(const void *fdt, int nodeoffset); */ int fdt_size_cells(const void *fdt, int nodeoffset); +/**********************************************************************/ +/* Read-only functions (board-id related) */ +/**********************************************************************/ + +/** + * fdt_get_board_id_t - callback to retrieve the board id for the platform + * @ctx: Context data passed from fdt_board_id_prop_matches() + * @name: board id name + * @data: Callback sets pointer to the board id data + * @datalen: Callback sets length of the board id data + * + * returns: + * Pointer to the board id data, NULL if the data doesn't exist + */ +typedef const void *(*fdt_get_board_id_t)(void *ctx, const char *name, + int *datalen); + +/** + * fdt_board_id_prop_matches - check if the property matches the platform's board id + * @fdt: pointer to the device tree blob + * @prop_offset: Offset of the property to match + * @get_board_id_cb: Function pointer to retrieve the platform's board id + * + * returns: + * 1: the property matches + * 0: the property doesn't match + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_board_id_prop_matches(const void *fdt, + const struct fdt_property *prop, + fdt_get_board_id_t get_board_id_cb, + void *ctx); + +/** + * fdt_board_id_score - calculate score of the fdt's board_id + * @fdt: pointer to the device tree blob + * @get_board_id_cb: Function pointer to retrieve the platform's board id + * + * returns: + * >0 for the number of board-id properties that were matched + * 0 if there was a mismatch in any of the board-id properties + * -FDT_ERR_BADMAGIC, + * -FDT_ERR_BADVERSION, + * -FDT_ERR_BADSTATE, + * -FDT_ERR_BADSTRUCTURE, + * -FDT_ERR_TRUNCATED, standard meanings + */ +int fdt_board_id_score(const void *fdt, fdt_get_board_id_t get_board_id_cb, + void *ctx); + /**********************************************************************/ /* Write-in-place functions */ From patchwork Tue May 21 18:37:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80388C25B78 for ; Tue, 21 May 2024 18:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wN8vJA4/+3bNuudOX9Kh4O53yZ7qqUXmP28Y9jNuqdA=; b=l0R/QxWM/PPdbW T8CwgP4w9Gh2rAODfQDhi8dmGXPmZdp/kXac5lwHHxYj9u9wGEV57US96O0WXr8k9y8T8ZAekppCC HOI0W9M8joSiuMHEe7oncvbAO1W2jE2yjLaxyyN/LwLTehZV43tI3tAsZLF25mtATNyuKtudM9+Oq VjPB2S2qxLNzuyoAf+fmXERYynaZ2/TkDqmdMmT7v7TXVnk0l0oPPMqTIsr1zuiuCIRylirxxq9Nc O770kFDNjwsJxzBvx+ZYPEFs97GHm3nYCuR+uHYeDmAia1+NT4/BDQcc1YZuwRDf5rbTZztjT5g0a YzGPuh9i89GmN35WvWdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UO6-00000000ndJ-0UdE; Tue, 21 May 2024 18:39:02 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nS8-44Lq for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:45 +0000 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LB0dRb026034; Tue, 21 May 2024 18:38:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=w9kemqzJHc5KJi/07GjBPv3Z1LtbiWjO0RJr47YrswM =; b=L0MXGCCD3LckxCy2bdHIMNbnB4BhahbK2eF0mrXpAflvFA7UMCGtEPy5jCQ mtIpy3h97XjW5A42mUsvqv8Hp1XAaLNPgVUV00hqx4X+zjwsN72urkCe4+5yZ7px Uknl1Rm410j40iB9HFG/A42XVT6cBAZ2SFNgtQlii2RzJh99jVXZooJ4/C9KG6ca +WKcc9X90g1oyU0PaCDGsHdSz55x7pT19K7FulCeX0tA32gBjCwAdxKx4VN4ArUL apDrl2LinU8rxGbcTic8z79daik/3fEIL+z8nWdTNYrfu03UrJUxQlx7/O+DTfK4 P50oyrGH/iJa61XZSZgKykjesbQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6n3tffjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:27 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcQvq014562 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:26 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:25 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:37:59 -0700 Subject: [PATCH RFC v3 2/9] dt-bindings: board: Introduce board-id MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-2-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: jbqTOGfdpodzcZLbBh5dXd8IYSoeJOXS X-Proofpoint-ORIG-GUID: jbqTOGfdpodzcZLbBh5dXd8IYSoeJOXS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=962 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113841_357721_923DE61D X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Device manufcturers frequently ship multiple boards or SKUs under a single softwre package. These software packages ship multiple devicetree blobs and require some mechanims to pick the correct DTB for the boards that use the software package. This patch introduces a common language for adding board identifiers to devicetrees. Signed-off-by: Elliot Berman --- .../devicetree/bindings/board/board-id.yaml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/board/board-id.yaml b/Documentation/devicetree/bindings/board/board-id.yaml new file mode 100644 index 000000000000..99514aef9718 --- /dev/null +++ b/Documentation/devicetree/bindings/board/board-id.yaml @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/board/board-id.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: board identifiers +description: Common property for board-id subnode + +maintainers: + - Elliot Berman + +properties: + $nodename: + const: '/' + board-id: + type: object + patternProperties: + "^.*(?!_str)$": + $ref: /schemas/types.yaml#/definitions/uint32-matrix + "^.*_str$": + $ref: /schemas/types.yaml#/definitions/string-array + +additionalProperties: true From patchwork Tue May 21 18:38:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F9E8C25B78 for ; Tue, 21 May 2024 18:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IVa2IM0OqdEFnD1FdiPDAH3n2a09l47bVnjNduCWzPs=; b=Lq5BI67Ok0FTb5 C8/8heHG9XJP/ZQlqBBzmzwzSs+zmC7yP1pRzswxULp1ujQ8JLuJF6Y+wJyy178irTYFgdcf7W2jI 5tRWIC0/c7zl76LxniDKuYam78VIliI1/XbMbWCDnG8GeItwzNRN9Uc0+vpWADJMak7Ez8Aqc/23Z Rnv/hgt7Fqlx9I/adiCHMQqGEFqK3I4gZFb45ZabgY1xRSBPx0a/XpEqo4g46ON4dcCwEKMZ05Rxc Do9jaU8oDNq4RuT/Ucqb/vOf0DR/Yynj/rjx53sm4lFFPZPMM3vVroNDYaO3xrl54vWQV/iVUtIMP mGOnBWLX070oVKxiHQdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UO0-00000000nZb-29tj; Tue, 21 May 2024 18:38:56 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nS2-0c71 for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:43 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LDQASj031060; Tue, 21 May 2024 18:38:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=88NHDvPij+mRH8DRPYPERvabYSKAr78Aq4d8qESSJx4 =; b=Dv6fvSdOfeRP1fIaLkqdmwaCjRcYmAwdjuGU1MBW/AaJ6wv38o4WVS711eO EzglyCJyd9YtQLdYSj8Xr7GtHtNoBW7kdZ2z0M80l3ftY6C0qeGLkCvBMabXz9c/ /4NoyU/TO9TbSoFGFjuLfq3RUPYmKF7kBTSdfO66aw+bwxzC84ATULDxndFDvNBj L6BW/+0MnTdy9jcnKcRBi4zOK/7UdlpB0S1123I9PyVFbYBG+MU2575wq8J/DUnR ywl10jXu5SQMzFQmbnMP1aFHaVFlK+I7mTBp3h1V0YdzcwMWxLkYZDIrBKqGvuiN H4xvn42swtXg2yMSXCtH3E9/dwA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6n45pue7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:27 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcQTw012119 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:26 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:26 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:00 -0700 Subject: [PATCH RFC v3 3/9] fdt-select-board: Add test tool for selecting dtbs based on board-id MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-3-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: K5cwYU7NhjfDktkbDUzCLcw99Op14pQM X-Proofpoint-ORIG-GUID: K5cwYU7NhjfDktkbDUzCLcw99Op14pQM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113840_262588_839CE21A X-CRM114-Status: GOOD ( 23.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce a tool which scores devicetrees based on their board-id and a supplied reference devicetree. This mechanism would be most similar to an proposal to EBBR where firmware provides a reference devicetree which contains the actual board identifier values, and an OS loader can choose to replace (or overlay) the firmware-provided devicetree. Signed-off-by: Elliot Berman --- scripts/dtc/.gitignore | 1 + scripts/dtc/Makefile | 3 +- scripts/dtc/fdt-select-board.c | 126 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 1 deletion(-) diff --git a/scripts/dtc/.gitignore b/scripts/dtc/.gitignore index e0b5c1d2464a..7f6d5202c0ba 100644 --- a/scripts/dtc/.gitignore +++ b/scripts/dtc/.gitignore @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only /dtc /fdtoverlay +/fdt-select-board diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 4d32b9497da9..a331f07091b3 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -2,7 +2,7 @@ # scripts/dtc makefile # *** Also keep .gitignore in sync when changing *** -hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay +hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay fdt-select-board hostprogs-always-$(CHECK_DT_BINDING) += dtc dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ @@ -14,6 +14,7 @@ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o libfdt-objs := fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o libfdt = $(addprefix libfdt/,$(libfdt-objs)) fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o +fdt-select-board-objs := $(libfdt) fdt-select-board.o util.o # Source files need to get at the userspace version of libfdt_env.h to compile HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt diff --git a/scripts/dtc/fdt-select-board.c b/scripts/dtc/fdt-select-board.c new file mode 100644 index 000000000000..a7f3dc715ed1 --- /dev/null +++ b/scripts/dtc/fdt-select-board.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ +#include +#include +#include +#include +#include +#include + +#include + +#include "util.h" + +static const char usage_synopsis[] = + "find the best matching device tree from a reference board\n" + " fdt-select-board []\n" + "\n"; +static const char usage_short_opts[] = "r:av" USAGE_COMMON_SHORT_OPTS; +static const struct option usage_long_opts[] = { + {"reference", required_argument, NULL, 'r'}, + {"verbose", no_argument, NULL, 'v'}, + {"all", no_argument, NULL, 'a'}, + USAGE_COMMON_LONG_OPTS +}; + +static const char * const usage_opts_help[] = { + "Reference DTB", + "Verbose messages", + "List all matches", + USAGE_COMMON_OPTS_HELP +}; + +int verbose = 0; + +struct context { + const void *fdt; + int node; +}; + +static const void *get_board_id(void *ctx, const char *name, int *datalen) +{ + struct context *c = ctx; + + return fdt_getprop(c->fdt, c->node, name, datalen); +} + +int main(int argc, char *argv[]) +{ + int opt; + char *input_filename = NULL; + const void *fdt; + const void *ref; + int ref_node; + int max_score = -1; + const char *best_match = NULL; + struct context ctx; + int all = 0; + + while ((opt = util_getopt_long()) != EOF) { + switch (opt) { + case_USAGE_COMMON_FLAGS + + case 'a': + all = 1; + break; + case 'r': + input_filename = optarg; + break; + case 'v': + verbose = 1; + break; + } + } + + if (!input_filename) + usage("missing reference file"); + + argv += optind; + argc -= optind; + + if (argc <= 0) + usage("missing candidate dtbs"); + + ref = utilfdt_read(input_filename, NULL); + if (!ref) { + fprintf(stderr, "failed to read reference %s\n", input_filename); + return -1; + } + + ref_node = fdt_path_offset(ref, "/board-id"); + if (ref_node < 0) { + fprintf(stderr, "reference blob doesn't have a board-id\n"); + return -1; + } + + ctx.fdt = ref; + ctx.node = ref_node; + + for (; argc > 0; --argc, ++argv) { + int score; + + fdt = utilfdt_read(*argv, NULL); + if (!fdt) { + fprintf(stderr, "failed to read %s\n", *argv); + return -1; + } + + score = fdt_board_id_score(fdt, get_board_id, &ctx); + if (verbose || (score > 0 && all)) + printf("%s: %d\n", *argv, score); + + if (score > max_score) { + max_score = score; + best_match = *argv; + } + + free(fdt); + } + + if (best_match && !all) + printf("%s\n", best_match); + + return 0; +} From patchwork Tue May 21 18:38:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C72D9C25B78 for ; Tue, 21 May 2024 18:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WZtg0eABk2DmodR/k/d7J6dLEf5kRsgmxZFSRZluMSw=; b=R8kmNqmV25l97j 7LtyIXfCKSIL8J+L6P8oFUDQxMoM29o8YUQdof2ollJDudLGfJVkN9ij3Ta4NnA5z0RZp6YHZDzVf +wC+pQgK4bAyfM6GVYp0HYr4mfTXm7s8I9+cgmoOPJIsFU6/Tnnw0OGWkqDmq9mrmB78+wmxwi6P7 AyBrpf9Ko9F9e6148wl1vSfecx2wEd0tfx37mFbqrDjXjk6tmne9iUqaHxSzm8ZpZrj9VmLx0i59c Ivq0ojo26jCznedRE8uZkRuPlpyLGq0tFYhsUf3TRDCA1otXvwBhR+scFVtenEh4kJf6uaXgL5rSb sc+KtN8dBN/E6QQxHJVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UO3-00000000nbL-19b8; Tue, 21 May 2024 18:38:59 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nSB-3fmS for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:43 +0000 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LCOAqL018275; Tue, 21 May 2024 18:38:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=bLJS9SRClb/39GErtcxjZ/NjKaKPQ4DvHuL8dZn9IE0 =; b=DmYV9SnTmnJEENuCi8lE85Te6Ld9IbF26dsEfeZqJNqFkx92+b279VNedis HlccHu/y1CkVtGYgdtS0IonaKw4V+i3elBViIusaUswasPtfu0dAbJvXWAIiGkRn 8Ekr9ZbU8VmatJ6EyNZIV+W1nkCDGuGjWMPZCDIwSe2wBxi59z7eqSUrzxxeOvZM KbOdDg+wKTqqSNPuswOcYRpBoDn03JVpt0Rdh5y3ZKMwwhxx4l/hmNx2I0BrK4s2 pDtlgmxufWkgBk/VENe2nBi74C2n+sEJZp3GvHYB1iaW4JKKZjqbdG4rpZOdoxz/ qcIU7lKDJEFOu53V0AdBR11TmKw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6n4p7c7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:28 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcRIA020132 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:27 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:26 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:01 -0700 Subject: [PATCH RFC v3 4/9] dt-bindings: arm: qcom: Update Devicetree identifiers MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-4-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: DtQhngKaOHN50LilzhejxnCo_Zg7dO3B X-Proofpoint-GUID: DtQhngKaOHN50LilzhejxnCo_Zg7dO3B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 spamscore=0 impostorscore=0 clxscore=1015 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=788 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113841_175674_7363C4E0 X-CRM114-Status: GOOD ( 16.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Amrit Anand Update existing documentation for qcom,msm-id (interchangeably: qcom,soc-id) and qcom,board-id. Add support for qcom,pmic-id, qcom,oem-id to support multi-DTB selection on Qualcomm's boards. "qcom,soc-id", "qcom,board-id" and "qcom,pmic-id" are tuples of two 32-bit values. The "qcom,oem-id" is a tuple of one 32-bit value. Introduce macros to help generate SOC, board, PMIC and OEM identifiers. QCOM_SOC_ID and QCOM_SOC_REVISION can be used to generate qcom,msm-id. QCOM_BOARD_ID and QCOM_BOARD_SUBTYPE can be used to generate qcom,board-id. QCOM_PMIC_SID and QCOM_PMIC_MODEL can be used to generate qcom,pmic-id. QCOM_OEM_ID can be used to generate qcom,oem-id. Add entries for different types of SoC, boards, DDR type, Boot device type which are currently used by Qualcomm based bootloader. Signed-off-by: Amrit Anand Signed-off-by: Elliot Berman --- include/dt-bindings/arm/qcom,ids.h | 86 ++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 9 deletions(-) diff --git a/include/dt-bindings/arm/qcom,ids.h b/include/dt-bindings/arm/qcom,ids.h index 51e0f6059410..0cb521f0c0e7 100644 --- a/include/dt-bindings/arm/qcom,ids.h +++ b/include/dt-bindings/arm/qcom,ids.h @@ -8,9 +8,14 @@ #define _DT_BINDINGS_ARM_QCOM_IDS_H /* - * The MSM chipset and hardware revision used by Qualcomm bootloaders, DTS for - * older chipsets (qcom,msm-id) and in socinfo driver: + * The MSM chipset ID (soc-id) used by Qualcomm bootloaders, + * and in socinfo driver: + * where, "a" indicates Qualcomm supported chipsets, example MSM8260, MSM8660 etc */ + +#define QCOM_SOC_ID(a) ((QCOM_ID_##a) && 0xffff) + + #define QCOM_ID_MSM8260 70 #define QCOM_ID_MSM8660 71 #define QCOM_ID_APQ8060 86 @@ -267,16 +272,79 @@ #define QCOM_ID_IPQ5302 595 #define QCOM_ID_IPQ5300 624 + /* The SOC revision used by Qualcomm bootloaders (soc-revision) */ + +#define QCOM_SOC_REVISION(a) (a & 0xff) + /* - * The board type and revision information, used by Qualcomm bootloaders and - * DTS for older chipsets (qcom,board-id): + * The board type and revision information (board-id), used by Qualcomm bootloaders + * where, "a" indicates board type which can be either MTP, QRD etc */ + #define QCOM_BOARD_ID(a, major, minor) \ - (((major & 0xff) << 16) | ((minor & 0xff) << 8) | QCOM_BOARD_ID_##a) + (((major & 0xff) << 16) | ((minor & 0xff) << 8) | ((QCOM_BOARD_ID_##a) & 0xff)) + +#define QCOM_BOARD_ID_MTP 0x8 +#define QCOM_BOARD_ID_LIQUID 0x9 +#define QCOM_BOARD_ID_DRAGONBOARD 0xA +#define QCOM_BOARD_ID_QRD 0x11 +#define QCOM_BOARD_ID_ADP 0x19 +#define QCOM_BOARD_ID_HDK 0x1F +#define QCOM_BOARD_ID_ATP 0x21 +#define QCOM_BOARD_ID_IDP 0x22 +#define QCOM_BOARD_ID_SBC 0x24 +#define QCOM_BOARD_ID_QXR 0x26 +#define QCOM_BOARD_ID_X100 0x26 +#define QCOM_BOARD_ID_CRD 0x28 + +/* + * The platform subtype is used by Qualcomm bootloaders and + * DTS (board-subtype) + * where, "a" indicates boot device type, it can be EMMC, + * UFS, NAND or OTHER (which can be used for default). + * "b" indicates DDR type which can be 128MB, 256MB, + * 512MB, 1024MB, 2048MB, 3072MB, 4096MB or ANY + * (which can be used for default). + */ +#define QCOM_BOARD_SUBTYPE(a, b, SUBTYPE) \ + (((QCOM_BOARD_BOOT_##a & 0xf) << 16) | ((QCOM_BOARD_DDRTYPE_##b & 0x7) << 8) | \ + (SUBTYPE & 0xff)) + +/* Board DDR Type where each value indicates higher limit */ +#define QCOM_BOARD_DDRTYPE_ANY 0x0 +#define QCOM_BOARD_DDRTYPE_128M 0x1 +#define QCOM_BOARD_DDRTYPE_256M 0x2 +#define QCOM_BOARD_DDRTYPE_512M 0x3 +#define QCOM_BOARD_DDRTYPE_1024M 0x4 +#define QCOM_BOARD_DDRTYPE_2048M 0x5 +#define QCOM_BOARD_DDRTYPE_3072M 0x6 +#define QCOM_BOARD_DDRTYPE_4096M 0x7 -#define QCOM_BOARD_ID_MTP 8 -#define QCOM_BOARD_ID_DRAGONBOARD 10 -#define QCOM_BOARD_ID_QRD 11 -#define QCOM_BOARD_ID_SBC 24 +/* Board Boot Device Type */ +#define QCOM_BOARD_BOOT_EMMC 0x0 +#define QCOM_BOARD_BOOT_UFS 0x1 +#define QCOM_BOARD_BOOT_NAND 0x2 +#define QCOM_BOARD_BOOT_OTHER 0x3 + +/* + * The PMIC slave id is used by Qualcomm bootloaders to + * indicates which PMIC is attached (pmic-sid) + */ + +#define QCOM_PMIC_SID(a) (a & 0xff) + +/* + * The PMIC ID is used by Qualcomm bootloaders to describe the ID + * of PMIC attached to bus described by SID (pmic-model) + */ + +#define QCOM_PMIC_MODEL(ID, major, minor) \ + (((major & 0xff) << 16) | ((minor & 0xff) << 8) | (ID & 0xff)) + +/* + * The OEM ID consists of 32 bit value to support OEM boards where they + * have slight differences on top of Qualcomm's standard boards + */ +#define QCOM_OEM_ID(a) (a & 0xffffffff) #endif /* _DT_BINDINGS_ARM_QCOM_IDS_H */ From patchwork Tue May 21 18:38:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C20BCC25B78 for ; Tue, 21 May 2024 18:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R/QItfMFP39DwnKpS99Dc1R3u1qKThdEOQgTe4V5Oto=; b=0i9LH3cOo4Q4gl ZJ5K2srAzf1Mgk47AQ2xa91hY58l6kbvGEcUx+iyVD2R2dOxH2q+cDHOHZhPweMjLTw5QfsWAhGGU EGdQ9MUVJ50Gu8OpA1E1QVual8qi1ij9tRutkqQo5wx8yu9TbGjHnSHIFjr7qUmYjUNthn6r0Y7nx 9L4IHHB5v9GF5bB0vvfgubyrKHafFhc20/mu929K+TWXALZ5b74SqawHoBCyjJu4jxF2mwhTHsr55 r3Y2voN1h2AOyY1TE/Vd0E9E87dacoYjTeM2UiWKbglYb8KEka1ay27bRbL9nzNM7nM4VA3xYw+gf pp9KkgckYIZaZN7dUW9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNz-00000000nYy-2RrC; Tue, 21 May 2024 18:38:55 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nSA-43yO for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:43 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LAFSRP010132; Tue, 21 May 2024 18:38:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=4tK395E3BNGPnsTLc8oXzJKzHE9Y3VtZZSlaaRbRHOc =; b=gMRYkvEpd9ILWOxDx/URCWTGEeoR+6mjzSTDpC8cyjgCyNJkzywxf/3L/uK WtUklj77XwhgYgDZYcn5A/ytu6kvdasYI/l14kI9+zUDQUce4l4qJAf/r2ou4ZYS f2GTYUDvdb8WCZKBf34tuA80uxoXcLUWcdCE/uw3sikdgn6TlQ0tqUMubGtLDJtd epoRbBCymrGk4PAhZngjUoYpQoMXYWHXdGo/HrQniPLQQCf1xIKjINTrbcgBbkug JPX8aI1i/MOxyZJdKSca02AZmEgyIuwMA7NCnWCgJh+cNhWczM7M1YP9P+Rr0csy T83S3dEzP/pCj4hEL6VolDYz7ZA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqapmmj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:29 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcRMg016643 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:28 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:27 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:02 -0700 Subject: [PATCH RFC v3 5/9] dt-bindings: board: Document board-ids for Qualcomm devices MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-5-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: wzhMXF8efEPNHx8infPzGAvwXcwa_CcT X-Proofpoint-ORIG-GUID: wzhMXF8efEPNHx8infPzGAvwXcwa_CcT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113841_306239_9FAAB1CF X-CRM114-Status: GOOD ( 15.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Document board identifiers for devices from Qualcomm Technologies, Inc. These platforms are described with two mechanisms: the hardware SoC registers and the "CDT" which is in a RO storage. The hardware SoC registers describe both the SoC (e.g. SM8650, SC7180) as well as revision. Add qcom,soc to describe only the SoC itself and qcom,soc-version when the devicetree only works with a certain revision. The CDT describes all other information about the board/platform. Besides the platform type (e.g. MTP, ADP, CRD), there are 3 further levels of versioning as well as additional fields to describe the PMIC and boot storage device attached. The 3 levels of versioning are a subtype, major, and minor version of the platform. Support describing just the platform type (qcom,platform), the platform type and subtype (qcom,platform-type), and all 4 numbers (qcom,platform-version). Signed-off-by: Elliot Berman --- .../devicetree/bindings/board/qcom,board-id.yaml | 144 +++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/Documentation/devicetree/bindings/board/qcom,board-id.yaml b/Documentation/devicetree/bindings/board/qcom,board-id.yaml new file mode 100644 index 000000000000..53ba7acab4c3 --- /dev/null +++ b/Documentation/devicetree/bindings/board/qcom,board-id.yaml @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/board/qcom,board-id.yaml +$schema: http://devicetree.org/meta-schemas/core.yaml + +title: Board identifiers for devices from Qualcomm Technologies, Inc. +description: Board identifiers for devices from Qualcomm Technologies, Inc. + +maintainers: + - Elliot Berman + +properties: + $nodename: + const: 'board-id' + + qcom,soc: + description: + List of Qualcomm SoCs this devicetree is applicable to. + + qcom,soc-version: + items: + items: + - description: Qualcomm SoC identifier + - description: SoC version + + qcom,platform: + description: + List of Qualcomm platforms this devicetree is applicable to. + + qcom,platform-type: + items: + items: + - description: Qualcomm platform type identifier + - description: Qualcomm platform subtype + + qcom,platform-version: + items: + items: + - description: Qualcomm platform type identifier + - description: Qualcomm platform subtype + - description: Qualcomm platform major and minor version. + + qcom,boot-device: + description: + Boot device type + + qcom,pmic: + description: + List of Qualcomm PMIC attaches + + qcom,pmic-id: + items: + items: + - description: Qualcomm PMIC identifier + - description: Qualcomm PMIC revision + +allOf: + # either describe soc or soc-version; it's confusing to have both + - if: + properties: + qcom,soc: true + then: + properties: + qcom,soc-version: false + - if: + properties: + qcom,soc-version: true + then: + properties: + qcom,soc: false + + # describe one of platform, platform-type, or platform-version; it's confusing to have multiple + - if: + properties: + qcom,platform: true + then: + properties: + qcom,platform-type: false + qcom,platform-version: false + - if: + properties: + qcom,platform-type: true + then: + properties: + qcom,platform: false + qcom,platform-version: false + - if: + properties: + qcom,platform: true + then: + properties: + qcom,platform: false + qcom,platform-type: false + + # either describe pmic or pmic-id; it's confusing to have both + - if: + properties: + qcom,pmic: true + then: + properties: + qcom,pmic-id: false + - if: + properties: + qcom,pmic-id: true + then: + properties: + qcom,pmic: false + +additionalProperties: true + +examples: + - | + #include + / { + compatible = "qcom,sm8650"; + board-id { + qcom,soc = ; + qcom,platform = ; + }; + }; + + - | + #include + / { + compatible = "qcom,sm8650"; + board-id { + qcom,soc-version = , + ; + qcom,platform-type = , ; + }; + }; + + - | + #include + / { + compatible = "qcom,sm8650"; + board-id { + qcom,soc = ; + qcom,platform-version = , + ; + qcom,boot-device = ; + }; + }; From patchwork Tue May 21 18:38:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6B47C25B7C for ; Tue, 21 May 2024 18:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fDGS6zS8zkPUpznMmtu1hDycp+t9dGqwhGqgYJw2SiA=; b=xuaijO9qk3olCk 4YrRC9GrhY+9awpeUen8B39eXY1wmNVite3CF0XpAv4xGHZYh2XvyvLxFzbdeNSTpFi77I7i0bqB/ DvRV1/6o1QRhPgtFbcap5Ar9D+tz93QgOu6bmVhDE00RA/DRZ0qYPbOugedS6CxiHpLlMFSC0KV9a fEmgQislWlwwes6RlP4/Lxojesp9+SaFWBzNsnexymoI7jsNAuiVQGpJVBYWRfgbesRTz2eKsUgQE EIwV2IvspUV5J+AMVZfvucap9enUShcRig3sl7POGZ+2nihWW8s3JbR3LHfVl1qBgl4Mrz7/YS5vj RCNeGevTdicIFDwcMuCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNn-00000000nV6-3pTO; Tue, 21 May 2024 18:38:43 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nS7-0eOH for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:41 +0000 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LE68Rc014675; Tue, 21 May 2024 18:38:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=VzKbfHDf0fqhXmtyi8ItUPPd79Km/KS343PqjUdhyFs =; b=k9o+E3DuiHDWkG5f4+wSphbLPoV/IfDjnlK3Ea5TG0nAWEDevRgtSyw/YQK fxcvD6qDTNaydW1GIpUgotaE+sIbKCzem2p34DLn60iwPHrs2Y2ANYIIM91Zdg5U 0m2IW0OmW2EQXN2MUUslnYQBBvaLjHpMqRCzBPuIJHqG1v5CjJXKLtBvW5tRlM8g gctZO3GGeVUGCZb0QQ4N+yHHsLho8v4FhzLigNbR5i82RkDpmq6f+X2ccaj5l1ky aGtMbzNUqgNc46TuKeM4q2whtaj/EVtXOp6kjOv04hU4qPNgzqI0lV+D+AJ/JDKZ ZmI1UWefUHoqTErNnch4MpvfYpg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqc6mbe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:29 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcSNr014859 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:28 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:27 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:03 -0700 Subject: [PATCH RFC v3 6/9] arm64: boot: dts: sm8650: Add board-id MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-6-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: m_PJAW8CYir9RzQ4q4aImaWRt4pEPHvl X-Proofpoint-GUID: m_PJAW8CYir9RzQ4q4aImaWRt4pEPHvl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=922 impostorscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113840_276881_8BB06BC2 X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add board-id to match sm8650 MTPs and QRDs. Signed-off-by: Elliot Berman --- arch/arm64/boot/dts/qcom/sm8650-mtp.dts | 6 ++++++ arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8650-mtp.dts b/arch/arm64/boot/dts/qcom/sm8650-mtp.dts index be133a3d5cbe..ceaf7cc270af 100644 --- a/arch/arm64/boot/dts/qcom/sm8650-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sm8650-mtp.dts @@ -5,6 +5,7 @@ /dts-v1/; +#include #include #include "sm8650.dtsi" #include "pm8010.dtsi" @@ -28,6 +29,11 @@ chosen { stdout-path = "serial0:115200n8"; }; + board-id { + qcom,soc = ; + qcom,platform = ; + }; + pmic-glink { compatible = "qcom,sm8650-pmic-glink", "qcom,sm8550-pmic-glink", diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts index b9151c2ddf2e..672ffcd0eaf0 100644 --- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts +++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts @@ -5,6 +5,7 @@ /dts-v1/; +#include #include #include #include "sm8650.dtsi" @@ -26,6 +27,11 @@ aliases { serial1 = &uart14; }; + board-id { + qcom,soc = ; + qcom,platform = ; + }; + chosen { stdout-path = "serial0:115200n8"; }; From patchwork Tue May 21 18:38:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EE70C25B74 for ; Tue, 21 May 2024 18:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JNyHInQXPQFzZYkbCYr0zkuj+MCQD9ggx9pQWf3vKj4=; b=ssruWhj6EMVtWY BiFYPjKxF8ZV2OdCQFcVWYYB8WtLNjba64vy5IkH3GhVblBzkvRLEmMBfIGpZDGdIlCfOU8csnVf7 UXu15O37vWWeFGIeZ3GRzbFetFlE/PHmO/d1a8X/cpzBdN9B+hThDAgWKC677HixdeUoaxvvfXQYR UJ2G+cWe9I/ayL67muu3365e+WjHI+QL9oZ6YYuzLFD882NHNJ3uDg3fYoEwhj2nKGKpYsHkSED9X uuyHmSR3vWv/uaAyIVuYWZFt2wpzNvw1AoId5FznbwhgErYT2bWjLW2RpLIbeQPo52pPS1Nss30CD MjlD4sbFPL0Idblr9+Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UO7-00000000nei-3QuN; Tue, 21 May 2024 18:39:03 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNl-00000000nTY-24no for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:45 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LEwuoJ020201; Tue, 21 May 2024 18:38:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=QwY0YQr84zBHrkcdkKsTRVkrZiZJkP64GeSk1KtlB8w =; b=l2A3MT++e/5WyLDXOWF8BagMKmPI4Zuv6DXIRaW8dr2sPefaM2E8sR81zkp v+r0IRB4ONgWrA1ftyO+2dEnW8yCRShpGDK46RqMxsDNt+b73LTgPvf9ofRtdbsE gRNNAbUoWFU2txpwgyRJ53BSKYXvaFnbAhGXtvUnfSL2B2nL2KJsXcNXDn+VPoTN xzzXupdmhcpMrla/l4dmsKvc0vKh4eu6huPhvKjpBZckoax2crsxUvAdYesnj0Pt yNa4VFULQsqBSsILKkYMCxJlTFRZAwu1kEbLFvAdgziAka/29TYLlx67SHa7K9I/ K7omTIqm+b5Kqe2IzDVVbQH6KJw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqapmmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:29 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcT7A016664 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:29 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:28 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:04 -0700 Subject: [PATCH RFC v3 7/9] arm64: boot: dts: qcom: Use phandles for thermal_zones MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-7-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: O8l3yje1EKD7HghNyRUlYyv4bHgIydEY X-Proofpoint-ORIG-GUID: O8l3yje1EKD7HghNyRUlYyv4bHgIydEY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=820 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113841_782938_302D23EE X-CRM114-Status: GOOD ( 13.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation for converting sm8550 to use devicetree overlays, use phandles for thermal_zones. Signed-off-by: Elliot Berman --- arch/arm64/boot/dts/qcom/pm8010.dtsi | 62 ++++++++-------- arch/arm64/boot/dts/qcom/pm8550.dtsi | 32 ++++---- arch/arm64/boot/dts/qcom/pm8550b.dtsi | 36 +++++---- arch/arm64/boot/dts/qcom/pm8550ve.dtsi | 38 +++++----- arch/arm64/boot/dts/qcom/pm8550vs.dtsi | 128 ++++++++++++++++---------------- arch/arm64/boot/dts/qcom/pmr735d_a.dtsi | 38 +++++----- arch/arm64/boot/dts/qcom/pmr735d_b.dtsi | 38 +++++----- arch/arm64/boot/dts/qcom/sm8550.dtsi | 2 +- arch/arm64/boot/dts/qcom/sm8650.dtsi | 2 +- 9 files changed, 181 insertions(+), 195 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/pm8010.dtsi b/arch/arm64/boot/dts/qcom/pm8010.dtsi index 0ea641e12209..a889df2f2f25 100644 --- a/arch/arm64/boot/dts/qcom/pm8010.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8010.dtsi @@ -6,47 +6,45 @@ #include #include -/ { - thermal-zones { - pm8010-m-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; +&thermal_zones { + pm8010-m-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8010_m_temp_alarm>; + thermal-sensors = <&pm8010_m_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; + }; - pm8010-n-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; + pm8010-n-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8010_n_temp_alarm>; + thermal-sensors = <&pm8010_n_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pm8550.dtsi b/arch/arm64/boot/dts/qcom/pm8550.dtsi index 797a18c249a4..cb5e70b28445 100644 --- a/arch/arm64/boot/dts/qcom/pm8550.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8550.dtsi @@ -6,26 +6,24 @@ #include #include -/ { - thermal-zones { - pm8550-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; +&thermal_zones { + pm8550-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8550_temp_alarm>; + thermal-sensors = <&pm8550_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pm8550b.dtsi b/arch/arm64/boot/dts/qcom/pm8550b.dtsi index 72609f31c890..b3cfa030679a 100644 --- a/arch/arm64/boot/dts/qcom/pm8550b.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8550b.dtsi @@ -6,26 +6,24 @@ #include #include -/ { - thermal-zones { - pm8550b-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; - - thermal-sensors = <&pm8550b_temp_alarm>; - - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; +&thermal_zones { + pm8550b-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pm8550b_temp_alarm>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pm8550ve.dtsi b/arch/arm64/boot/dts/qcom/pm8550ve.dtsi index 4dc1f03ab2c7..8ef57a51b5cd 100644 --- a/arch/arm64/boot/dts/qcom/pm8550ve.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8550ve.dtsi @@ -6,26 +6,24 @@ #include #include -/ { - thermal-zones { - pm8550ve-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; - - thermal-sensors = <&pm8550ve_temp_alarm>; - - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; - - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; +&thermal_zones { + pm8550ve-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pm8550ve_temp_alarm>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; + + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pm8550vs.dtsi b/arch/arm64/boot/dts/qcom/pm8550vs.dtsi index 97b1c18aa7d8..258526abcc21 100644 --- a/arch/arm64/boot/dts/qcom/pm8550vs.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8550vs.dtsi @@ -6,89 +6,87 @@ #include #include -/ { - thermal-zones { - pm8550vs-c-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; - - thermal-sensors = <&pm8550vs_c_temp_alarm>; - - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; - - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; +&thermal_zones { + pm8550vs-c-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pm8550vs_c_temp_alarm>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; + + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; + }; - pm8550vs-d-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; + pm8550vs-d-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8550vs_d_temp_alarm>; + thermal-sensors = <&pm8550vs_d_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; + }; - pm8550vs-e-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; + pm8550vs-e-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8550vs_e_temp_alarm>; + thermal-sensors = <&pm8550vs_e_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; + }; - pm8550vs-g-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; + pm8550vs-g-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; - thermal-sensors = <&pm8550vs_g_temp_alarm>; + thermal-sensors = <&pm8550vs_g_temp_alarm>; - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pmr735d_a.dtsi b/arch/arm64/boot/dts/qcom/pmr735d_a.dtsi index 37daaefe3431..251a16424d84 100644 --- a/arch/arm64/boot/dts/qcom/pmr735d_a.dtsi +++ b/arch/arm64/boot/dts/qcom/pmr735d_a.dtsi @@ -6,26 +6,24 @@ #include #include -/ { - thermal-zones { - pmr735d-k-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; - - thermal-sensors = <&pmr735d_k_temp_alarm>; - - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; - - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; +&thermal_zones { + pmr735d-k-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pmr735d_k_temp_alarm>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; + + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/pmr735d_b.dtsi b/arch/arm64/boot/dts/qcom/pmr735d_b.dtsi index 3b470f6ac46f..dbcfeb53d8ec 100644 --- a/arch/arm64/boot/dts/qcom/pmr735d_b.dtsi +++ b/arch/arm64/boot/dts/qcom/pmr735d_b.dtsi @@ -6,26 +6,24 @@ #include #include -/ { - thermal-zones { - pmr735d-l-thermal { - polling-delay-passive = <100>; - polling-delay = <0>; - - thermal-sensors = <&pmr735d_l_temp_alarm>; - - trips { - trip0 { - temperature = <95000>; - hysteresis = <0>; - type = "passive"; - }; - - trip1 { - temperature = <115000>; - hysteresis = <0>; - type = "hot"; - }; +&thermal_zones { + pmr735d-l-thermal { + polling-delay-passive = <100>; + polling-delay = <0>; + + thermal-sensors = <&pmr735d_l_temp_alarm>; + + trips { + trip0 { + temperature = <95000>; + hysteresis = <0>; + type = "passive"; + }; + + trip1 { + temperature = <115000>; + hysteresis = <0>; + type = "hot"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/sm8550.dtsi b/arch/arm64/boot/dts/qcom/sm8550.dtsi index ee1ba5a8c8fc..c68e08747b6f 100644 --- a/arch/arm64/boot/dts/qcom/sm8550.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8550.dtsi @@ -4452,7 +4452,7 @@ compute-cb@8 { }; }; - thermal-zones { + thermal_zones: thermal-zones { aoss0-thermal { polling-delay-passive = <0>; polling-delay = <0>; diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi b/arch/arm64/boot/dts/qcom/sm8650.dtsi index 2df77123a8c7..32198bf3cf7c 100644 --- a/arch/arm64/boot/dts/qcom/sm8650.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi @@ -5030,7 +5030,7 @@ compute-cb@8 { }; }; - thermal-zones { + thermal_zones: thermal-zones { aoss0-thermal { polling-delay-passive = <0>; polling-delay = <0>; From patchwork Tue May 21 18:38:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A307C25B74 for ; Tue, 21 May 2024 18:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q83M8eVK0ZZmeCJqfmZagxtI9O3AZqkaAns8AqQxrhg=; b=sUDppqQLOg49EG QSvL2yjXVMIBax3qWLMbi6hx4lV7LlWRPMsVnJPdQ0LHdJH0a//tf/LS1Ogba9XdFh1sk7IcOH8Jp 00DPje/gwOokBKXb1tyAlclg3dabIYWyBa0oE744CnCI7ZNB0epCc6J3Vv6yIiwi2s/og85bN2cX3 hCd2p12ZTmBriMV946vOloaQ6Qwv7RdHBksLKIvB59JEC2aB5S/5X3oyyWTGqO4tjcS5AA16bDFhT yNEYkVB6jhbTeXrnNWUPTO6UBjNUnOIXqixaz0ZUeQpf7KSIyDx8bu2K/t0TXVotsURFBjS15rkLe 1oLVPcIR3ch05IA4dDnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UO4-00000000ncB-1qS4; Tue, 21 May 2024 18:39:00 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nSC-449I for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:44 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LBtqRi008286; Tue, 21 May 2024 18:38:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=RFak83ZSaOcO33zmXVEQI6tnblOmnteiUxHPFFzQUQQ =; b=ar/GOIDCM8Sr/6pLo8AbESb1jj34AiqOqpLBrrgc6nG8/Nz7xE8cSy0scKk u91V4hS2NrP8lR7Ca3Nk1gON0Z87YBywasx8v9dE1B5lrGuA9wjHpVo+E1U0FMGq YVW5C5Ws5c8E7Cuwk3ftzpuXNOjVih9CxgvXkYCNapa26F99GfJe/hBhjMM6VQKZ Iw2KfS8r2BrI13RS6XYMc3aR4E08W359FWPdgjSumztnGbiG4Jgwi9MUROgXKe+0 5KUZlxklU5zh/5/5PRkv+PgrRR89cM+HCSP2ZYdSgnk5HwRwwq4sKYWF8az0sZFe /qeHCObkTy2X1irsuaIaPZfGl9w== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqapmmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:30 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcTb4014870 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:29 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:28 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:05 -0700 Subject: [PATCH RFC v3 8/9] arm64: boot: dts: qcom: sm8550: Split into overlays MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-8-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ElsVSSpLuJT7E_mI2Kgue_DaNc_8N-yN X-Proofpoint-ORIG-GUID: ElsVSSpLuJT7E_mI2Kgue_DaNc_8N-yN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113841_370918_84BEE3A1 X-CRM114-Status: GOOD ( 17.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Generic sm8550 devicetree is split into a dtsi. Move it into its own DTB and preserve the boards as overlays. When not using overlays, 264 KB needed to store the sm8550-mtp.dtb and sm8550-qrd.dtb. When using overlays, 188 KB is needed to store sm8550.dtb, sm8550-mtp.dtbo, and sm8550-qrd.dtbo; where the overlays are ~36 KB. Also add the board-ids for these DTBs. This change is not intended to be merged, it breaks aliases and I doubt it boots correct. The intent here is to show how board-id could be used with a DTB and DTBO. Signed-off-by: Elliot Berman --- arch/arm64/boot/dts/qcom/Makefile | 4 ++++ .../dts/qcom/{sm8550-mtp.dts => sm8550-mtp.dtso} | 24 ++++++++++++++++++++-- .../dts/qcom/{sm8550-qrd.dts => sm8550-qrd.dtso} | 22 +++++++++++++++++--- .../boot/dts/qcom/{sm8550.dtsi => sm8550.dts} | 8 ++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index 39889d5f8e12..7f137f274d8c 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -233,6 +233,10 @@ dtb-$(CONFIG_ARCH_QCOM) += sm8450-hdk.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8450-qrd.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8450-sony-xperia-nagara-pdx223.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8450-sony-xperia-nagara-pdx224.dtb + +sm8550-mtp-dtbs := sm8550.dtb sm8550-mtp.dtbo +sm8550-qrd-dtbs := sm8550.dtb sm8550-qrd.dtbo + dtb-$(CONFIG_ARCH_QCOM) += sm8550-mtp.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8550-qrd.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8650-mtp.dtb diff --git a/arch/arm64/boot/dts/qcom/sm8550-mtp.dts b/arch/arm64/boot/dts/qcom/sm8550-mtp.dtso similarity index 98% rename from arch/arm64/boot/dts/qcom/sm8550-mtp.dts rename to arch/arm64/boot/dts/qcom/sm8550-mtp.dtso index c1135ad5fa69..0ee4614719ca 100644 --- a/arch/arm64/boot/dts/qcom/sm8550-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sm8550-mtp.dtso @@ -4,9 +4,12 @@ */ /dts-v1/; +/plugin/; +#include +#include #include -#include "sm8550.dtsi" +#include #include "pm8010.dtsi" #include "pm8550.dtsi" #include "pm8550b.dtsi" @@ -17,13 +20,30 @@ #include "pmr735d_a.dtsi" #include "pmr735d_b.dtsi" +#define BOARD_ID qcom,soc = ; \ + qcom,platform-type = + / { + board-id { + BOARD_ID; + }; +}; + +&{/} { model = "Qualcomm Technologies, Inc. SM8550 MTP"; compatible = "qcom,sm8550-mtp", "qcom,sm8550"; chassis-type = "handset"; + /** + * Redefine the overlay in the DTBO so the sm8550-mtp.dtb that Kbuild + * generates has accurate board-id. + */ + board-id { + BOARD_ID; + }; + aliases { - serial0 = &uart7; + // serial0 = &uart7; }; wcd938x: audio-codec { diff --git a/arch/arm64/boot/dts/qcom/sm8550-qrd.dts b/arch/arm64/boot/dts/qcom/sm8550-qrd.dtso similarity index 98% rename from arch/arm64/boot/dts/qcom/sm8550-qrd.dts rename to arch/arm64/boot/dts/qcom/sm8550-qrd.dtso index d401d63e5c4d..f756c50a80b9 100644 --- a/arch/arm64/boot/dts/qcom/sm8550-qrd.dts +++ b/arch/arm64/boot/dts/qcom/sm8550-qrd.dtso @@ -4,10 +4,14 @@ */ /dts-v1/; +/plugin/; +#include +#include #include +#include #include -#include "sm8550.dtsi" +#include #include "pm8010.dtsi" #include "pm8550.dtsi" #include "pm8550b.dtsi" @@ -19,13 +23,25 @@ #include "pmr735d_b.dtsi" / { + board-id { + qcom,soc = ; + qcom,platform = ; + }; +}; + +&{/} { model = "Qualcomm Technologies, Inc. SM8550 QRD"; compatible = "qcom,sm8550-qrd", "qcom,sm8550"; chassis-type = "handset"; + board-id { + qcom,soc = ; + qcom,platform = ; + }; + aliases { - serial0 = &uart7; - serial1 = &uart14; + // serial0 = &uart7; + // serial1 = &uart14; }; wcd938x: audio-codec { diff --git a/arch/arm64/boot/dts/qcom/sm8550.dtsi b/arch/arm64/boot/dts/qcom/sm8550.dts similarity index 99% rename from arch/arm64/boot/dts/qcom/sm8550.dtsi rename to arch/arm64/boot/dts/qcom/sm8550.dts index c68e08747b6f..3546ea4b96f1 100644 --- a/arch/arm64/boot/dts/qcom/sm8550.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8550.dts @@ -3,6 +3,9 @@ * Copyright (c) 2022, Linaro Limited */ +/dts-v1/; + +#include #include #include #include @@ -32,6 +35,11 @@ / { chosen { }; + board_id: board-id { + qcom,soc-version = , + ; + }; + clocks { xo_board: xo-board { compatible = "fixed-clock"; From patchwork Tue May 21 18:38:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 13669638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52B09C25B74 for ; Tue, 21 May 2024 18:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=krMHVEPsuEByBL7YYGtgN2ySAz741nFPjSSCYlALrvk=; b=AMDHcwjLfuonKI 0AYDdMQ2u8kiTs+7GSuoaEBZCWcjqLcLgQX7lpyOlx2n1eFbeZ7l+DwinidfTnHxaCgaBjBVy54ZW KL0ax/zcL4pgRF0f8x40uzyrDNamAQH77bcbiBw/ulNgm/5g7ugJjXbUb1/DAh4qXGHqkRR/twCRz QhM2YtreAkZSP+7lxLgL1bKnWVjH4OB4j42DO1Vw75K3dsbTNbJcfGeL0awnztuA8exTuhgBr0jQf S4ljLJNtABZGNMYQWOJ+VItmmsVD2h3Y4IUuS/OvJ5Ly3h0ofad8Lfqp0LnIzaA9TKgOqtfSqyBy3 2nyf1Dk/FI0pKCi8KaFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNp-00000000nVk-0JOp; Tue, 21 May 2024 18:38:45 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9UNk-00000000nSD-0ZOS for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 18:38:42 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44L9xeRM004387; Tue, 21 May 2024 18:38:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=T5bkdynyzEdOYxsDcWGWLOmwsNAs+8sORtZJnwmIXto =; b=T3Gk4e3KMPegX3QRNTMViBKhX9eY9alLLW7mOuu35a1s9tEyp9obn+xowKL uNKE9UmbFEY+yeZJBksG8CZ40z0iaMjOSe2FppYbxcgF0QTH/eTsyZyCiicfJ445 G+sdnIsYHMFKtY6dNtvIs+PHFd/CIr/5bBiGkqIVGkSgnCj0droReA0GgP9Hs0dn PbGZ81dIsC20qxs8vDQ8+jSNEtDex4uHUa3IUv0o0CR3Byuw+zHlfsfPlc5DCnCi Ufq404XRm5832TTAjoCZnSKlbpYPTILK74/aotM+ShhNqKfjj1oKke7Bp0w9ewus jEY3iUq4P4txtkjiIrI0M1EKn2Q== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6pqapmmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:30 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44LIcUII016680 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 18:38:30 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 21 May 2024 11:38:29 -0700 From: Elliot Berman Date: Tue, 21 May 2024 11:38:06 -0700 Subject: [PATCH RFC v3 9/9] tools: board-id: Add test suite MIME-Version: 1.0 Message-ID: <20240521-board-ids-v3-9-e6c71d05f4d2@quicinc.com> References: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> In-Reply-To: <20240521-board-ids-v3-0-e6c71d05f4d2@quicinc.com> To: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio CC: Amrit Anand , Peter Griffin , Caleb Connolly , "Andy Gross" , Konrad Dybcio , "Doug Anderson" , Simon Glass , "Chen-Yu Tsai" , Julius Werner , "Humphreys, Jonathan" , Sumit Garg , "Jon Hunter" , Michal Simek , , , , , , Elliot Berman X-Mailer: b4 0.13.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Ens5k3tAv93QYqUh2XVDuDq_VJmZVmkJ X-Proofpoint-ORIG-GUID: Ens5k3tAv93QYqUh2XVDuDq_VJmZVmkJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_11,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_113840_251494_62ECE11D X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a short test suite to demonstrate board-id selection and scoring. This patch isn't intended to be merged here. After compiling the kernel (esp. arch/arm64/boot/dts/qcom DTBs), run tools/board-id/test.py. The test cases provide a hypothetical firmware-provied board-id and compares expected output for which DTBs gets matched. Signed-off-by: Elliot Berman --- tools/board-id/test.py | 151 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/tools/board-id/test.py b/tools/board-id/test.py new file mode 100644 index 000000000000..687b31ad73d2 --- /dev/null +++ b/tools/board-id/test.py @@ -0,0 +1,151 @@ +from collections import namedtuple +import glob +import os +import subprocess +from tempfile import NamedTemporaryFile +import unittest + + +LINUX_ROOT = os.path.abspath(os.path.join(__file__, "..", "..", "..")) +ENV_WITH_DTC = { + "PATH": os.path.join(LINUX_ROOT, "scripts", "dtc") + os.pathsep + os.environ["PATH"] +} + + +TestCase = namedtuple("TestCase", ["score_all", "board_id", "output"]) + +test_cases = [ + TestCase( + # A board_id that could be provided by firmware + board_id=""" + qcom,soc = ; + qcom,soc-version = ; + qcom,platform = ; + qcom,platform-type = ; + qcom,platform-version = ; + qcom,boot-device = ; + """, + score_all=False, + output=""" + qcom/sm8650-mtp.dtb + """, + ), + TestCase( + # A board_id that could be provided by firmware + board_id=""" + qcom,soc = ; + qcom,soc-version = ; + qcom,platform = ; + qcom,platform-type = ; + qcom,platform-version = ; + qcom,boot-device = ; + """, + score_all=True, + output=""" + qcom/sm8550.dtb: 1 + qcom/sm8550-mtp.dtb: 3 + qcom/sm8550-mtp.dtbo: 2 + """, + ), +] + + +def compile_board_id(board_id: str): + dts = f""" + /dts-v1/; + + #include + + / {{ + compatible = "linux,dummy"; + board-id {{ + {board_id} + }}; + }}; + """ + dts_processed = subprocess.run( + [ + "gcc", + "-E", + "-nostdinc", + f"-I{os.path.join(LINUX_ROOT, 'scripts', 'dtc', 'include-prefixes')}", + "-undef", + "-D__DTS__", + "-x", + "assembler-with-cpp", + "-o" "-", + "-", + ], + stdout=subprocess.PIPE, + input=dts.encode("utf-8"), + check=True, + ) + dtc = subprocess.run( + ["dtc", "-I", "dts", "-O", "dtb", "-o", "-", "-"], + stdout=subprocess.PIPE, + input=dts_processed.stdout, + env=ENV_WITH_DTC, + ) + return dtc.stdout + + +def select_boards(score_all, fwdtb): + with NamedTemporaryFile() as fwdtb_file: + fwdtb_file.write(fwdtb) + fwdtb_file.flush() + root_dir = os.path.join(LINUX_ROOT, "arch", "arm64", "boot", "dts") + return subprocess.run( + filter( + bool, + [ + "fdt-select-board", + "-a" if score_all else None, + "-r", + fwdtb_file.name, + *glob.glob( + "qcom/*.dtb*", + root_dir=root_dir, + ), + ], + ), + stdout=subprocess.PIPE, + text=True, + cwd=root_dir, + env=ENV_WITH_DTC, + stderr=subprocess.STDOUT, + ) + + +def fixup_lines(s): + return '\n'.join(filter(bool, sorted(_s.strip() for _s in s.split('\n')))) + + +class TestBoardIds(unittest.TestCase): + def __init__(self, index: int, args: TestCase) -> None: + super().__init__() + self.args = args + self.index = index + + def runTest(self): + fwdtb = compile_board_id(self.args.board_id) + output = select_boards(self.args.score_all, fwdtb) + if output.stderr: + self.assertMultiLineEqual(output.stderr, "") + expected = fixup_lines(self.args.output) + actual = fixup_lines(output.stdout) + self.assertMultiLineEqual(expected, actual) + + def __str__(self): + return f"Test case {self.index}" + + +def suite(): + suite = unittest.TestSuite() + for idx, test in enumerate(test_cases): + suite.addTest(TestBoardIds(idx + 1, test)) + return suite + + +if __name__ == "__main__": + runner = unittest.TextTestRunner() + runner.run(suite())