From patchwork Sat Jan 21 11:29:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 46817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp680182wrn; Sat, 21 Jan 2023 03:31:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUCt9et+nWGve7wsRY3+rlGYHE2ewpWX41bJEt9mG5Mjs3HCkPqTXbu0ynXrND4aLMmGFp X-Received: by 2002:a17:90b:4acb:b0:22b:b794:bb47 with SMTP id mh11-20020a17090b4acb00b0022bb794bb47mr4685388pjb.23.1674300683013; Sat, 21 Jan 2023 03:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674300682; cv=none; d=google.com; s=arc-20160816; b=XAl8d3W7NcHL35iYOSbi3/6yT7JJoQtcGKTxXgamEBzxTea/bVorhmxdkOn8o0H4m2 3fypHtZCuJmxaHL3rtncRqM9haAkAsQjuhSSrLJu2R61joWaIM5ahnDbLkZ11jS8xBSa jqbkx49mS7tsESXaPrIswhO2MzK197NnoAWduNtsgZ8dFhLY/L2rpMoAnU85mC6bg5Kz 3x252+6jjWLabFBBy3d3gdsIj7DMIHl+US9I209sV0/SzYCXWVNMiI60jGE/7UirJygp Op7n/PNxxMaoyp57FWF8eJQoI7MLuuTMsSn3SqC3sh8QiF+5DhKxP2wzdaOUEYSbLQaP 8b7A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=tQtA9gnXbHiCVZ0cdHgz61/mVXx++tAhOoDuPrap8Z8=; b=Fg1ZJdvS86/m7z9hxGTVfSfn6ywx2EvAmYWKT5RV172qGw8SYcy/J0DsIPcholgBC8 mK1Xb03Kjc87Hn+G7Sio45mqwUMqlGjJkQQjzdmZFgvRXMzSXlEq+oozhlXkRkZNb00K bfubQHMPURXa99gc8sCR/Nif2lM8sLoYc/k60+XukKRJAqr96nT1k7CyK0yWd9noLO4j kg76KbUq7JI1bhmHNKuQoBJ1YF+o8D3QqtVf304oaOJ1xDuUBjzX4SOZWncUnUq+wXBO RXCk9m/IZxyI6Us0stCvWVMGwh5Intsj0CvWJTNc24cii6Gv7hgJpmVTKgwzvVvl+6Db Fiow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IrfWZ6nn; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo9-20020a17090b090900b0020d5dfb9d69si5582284pjb.187.2023.01.21.03.31.11; Sat, 21 Jan 2023 03:31:22 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=IrfWZ6nn; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbjAUL36 (ORCPT + 99 others); Sat, 21 Jan 2023 06:29:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjAUL3x (ORCPT ); Sat, 21 Jan 2023 06:29:53 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16EF93B3DC; Sat, 21 Jan 2023 03:29:51 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id y11so9450891edd.6; Sat, 21 Jan 2023 03:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tQtA9gnXbHiCVZ0cdHgz61/mVXx++tAhOoDuPrap8Z8=; b=IrfWZ6nnGNuKzRQyWZxpXbc/uAwXN43BQn8gO3yrJq2u3+D/z8GgtpgGunHjw7ig5o pbJ8RLv0KPCELe3aZpmvWDkSnx0R2vaOT0K8hMNZ9qONHT+Nz6pquv5j0JNGDSx0jLb8 mlntWNQt3gvIbnQrVG+p6iOGnxyARi05vZnjC6aiPspZReA/kCrUlRI7scCaXJB9TdXO 0RftYK4T6hdaTXHH86j+ZHaJtPB5WYueVscMBR3jz0io+Jof3qcYptT8dxBw762lYnTy d7+T8gctiDul0KmQVJ1s8ShAo9X5HKbNCHSIB7qGXhlkDl1vLVlMn2EobIfVzYXPGntD U2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tQtA9gnXbHiCVZ0cdHgz61/mVXx++tAhOoDuPrap8Z8=; b=rI7//64ZdgKn9b1XfLm9YzUkJmDRBi9kQFbHZ7X62/V0g82KhIpSn3HQELIufuuOOI Q0mOkb3uOAgh49RkObKaV8z4X7A0yzY7yAusZmywN7qHz8fesYRz7N+1WXWxNpG75hPL 4ePwNtZ3PvTEtEJ8/SEI8ImP8tVody0j3pXjUAoCKhmCBxVZs+xWthxsiDY249GPupRD ogDzOgmeodk3Jd9OeLFP6uBN6Mkxxl8FOxNsJMdYzvG17/2EFm0jpQDiAOYhWIHgbDsn 3IZ5ozmiRiQfYb+tjxXLoC9zd9bngUFFypz9sS6EmYf9V+W++KQoik2azptFGeSeTMFz 5mpg== X-Gm-Message-State: AFqh2kqoVFpQ242MUI6HF3jS+SRKTXmPnP++e7x2++oJOVMu6ww/RUK6 TGxgx3HtrHvYko9qMbGowx4= X-Received: by 2002:a05:6402:2055:b0:479:6c4f:40df with SMTP id bc21-20020a056402205500b004796c4f40dfmr16794615edb.18.1674300589520; Sat, 21 Jan 2023 03:29:49 -0800 (PST) Received: from fedora.. ([188.252.220.152]) by smtp.googlemail.com with ESMTPSA id d26-20020a056402401a00b0046c7c3755a7sm5152151eda.17.2023.01.21.03.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 03:29:48 -0800 (PST) From: Robert Marko To: ilia.lin@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Robert Marko Subject: [PATCH 1/4] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Sat, 21 Jan 2023 12:29:44 +0100 Message-Id: <20230121112947.53433-1-robimarko@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755631512725490753?= X-GMAIL-MSGID: =?utf-8?q?1755631512725490753?= Move SMEM item struct and related defines to a header in order to be able to reuse them in the Qualcomm NVMEM CPUFreq driver instead of duplicating them. Signed-off-by: Robert Marko --- drivers/soc/qcom/socinfo.c | 65 +----------------------------- include/linux/soc/qcom/socinfo.h | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 64 deletions(-) create mode 100644 include/linux/soc/qcom/socinfo.h diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 3b970a80f3aa..5919f863f369 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -32,15 +33,6 @@ #define qcom_board_id(id) QCOM_ID_ ## id, __stringify(id) #define qcom_board_id_named(id, name) QCOM_ID_ ## id, (name) -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 - -/* - * SMEM item id, used to acquire handles to respective - * SMEM region. - */ -#define SMEM_HW_SW_BUILD_ID 137 - #ifdef CONFIG_DEBUG_FS #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32 #define SMEM_IMAGE_VERSION_SIZE 4096 @@ -121,62 +113,7 @@ static const char *const pmic_models[] = { [58] = "PM8450", [65] = "PM8010", }; -#endif /* CONFIG_DEBUG_FS */ - -/* Socinfo SMEM item structure */ -struct socinfo { - __le32 fmt; - __le32 id; - __le32 ver; - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; - /* Version 2 */ - __le32 raw_id; - __le32 raw_ver; - /* Version 3 */ - __le32 hw_plat; - /* Version 4 */ - __le32 plat_ver; - /* Version 5 */ - __le32 accessory_chip; - /* Version 6 */ - __le32 hw_plat_subtype; - /* Version 7 */ - __le32 pmic_model; - __le32 pmic_die_rev; - /* Version 8 */ - __le32 pmic_model_1; - __le32 pmic_die_rev_1; - __le32 pmic_model_2; - __le32 pmic_die_rev_2; - /* Version 9 */ - __le32 foundry_id; - /* Version 10 */ - __le32 serial_num; - /* Version 11 */ - __le32 num_pmics; - __le32 pmic_array_offset; - /* Version 12 */ - __le32 chip_family; - __le32 raw_device_family; - __le32 raw_device_num; - /* Version 13 */ - __le32 nproduct_id; - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; - /* Version 14 */ - __le32 num_clusters; - __le32 ncluster_array_offset; - __le32 num_defective_parts; - __le32 ndefective_parts_array_offset; - /* Version 15 */ - __le32 nmodem_supported; - /* Version 16 */ - __le32 feature_code; - __le32 pcode; - __le32 npartnamemap_offset; - __le32 nnum_partname_mapping; -}; -#ifdef CONFIG_DEBUG_FS struct socinfo_params { u32 raw_device_family; u32 hw_plat_subtype; diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h new file mode 100644 index 000000000000..6a175d635617 --- /dev/null +++ b/include/linux/soc/qcom/socinfo.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __QCOM_SOCINFO_H__ +#define __QCOM_SOCINFO_H__ + +/* + * SMEM item id, used to acquire handles to respective + * SMEM region. + */ +#define SMEM_HW_SW_BUILD_ID 137 + +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 + +/* Socinfo SMEM item structure */ +struct socinfo { + __le32 fmt; + __le32 id; + __le32 ver; + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; + /* Version 2 */ + __le32 raw_id; + __le32 raw_ver; + /* Version 3 */ + __le32 hw_plat; + /* Version 4 */ + __le32 plat_ver; + /* Version 5 */ + __le32 accessory_chip; + /* Version 6 */ + __le32 hw_plat_subtype; + /* Version 7 */ + __le32 pmic_model; + __le32 pmic_die_rev; + /* Version 8 */ + __le32 pmic_model_1; + __le32 pmic_die_rev_1; + __le32 pmic_model_2; + __le32 pmic_die_rev_2; + /* Version 9 */ + __le32 foundry_id; + /* Version 10 */ + __le32 serial_num; + /* Version 11 */ + __le32 num_pmics; + __le32 pmic_array_offset; + /* Version 12 */ + __le32 chip_family; + __le32 raw_device_family; + __le32 raw_device_num; + /* Version 13 */ + __le32 nproduct_id; + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; + /* Version 14 */ + __le32 num_clusters; + __le32 ncluster_array_offset; + __le32 num_defective_parts; + __le32 ndefective_parts_array_offset; + /* Version 15 */ + __le32 nmodem_supported; + /* Version 16 */ + __le32 feature_code; + __le32 pcode; + __le32 npartnamemap_offset; + __le32 nnum_partname_mapping; +}; + +#endif