From patchwork Mon May 25 16:48:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 187193 Delivered-To: patches@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp5097042ilb; Mon, 25 May 2020 09:48:19 -0700 (PDT) X-Received: by 2002:a2e:7504:: with SMTP id q4mr11283561ljc.339.1590425299478; Mon, 25 May 2020 09:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590425299; cv=none; d=google.com; s=arc-20160816; b=QEg+vQTrMO8H6m9PTQZ53kcLcejRmX67171vBxaUk7jJY3ICbvNRka3tc3bCyfLY0h PJxICpnQ3zoahaNttzb26vIhDgep9w82gvgbX2s5PQUAfruBKbvugMXQbCr7h1EDJZrO IIWEo3zJP7QbF6347Pobv82f2+CJSZt+1k2HMUwnxnn+KCz3j6NhMe7BOEsUp37x070T dcWzVrqoFGNmXcScot7HhcrI8AjwBXkdTo89cz0JvjNdwiCa8GfgDxy1fklFWOCbRcaa 2vsvW1/VoGBl7XOx/NIzi9wZUiAp2ksQQUjeyCNagpefvMGE1s/BY+woyeOgdPz9sTz8 uAZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=qFuxiaLQtj25y9sBPvZbzcmOPRrE2+OoU7mnXmLdh80=; b=P15Kb00ZSS9Z5DYEu6aPw1axYGGzLiI1fcgu3ViGH1UKfMpxvCiFSm70rWfpIO7AV4 LJ0hXHeI+PPS2oIzd05z1dBXAaQSTpSE14pQFvozW+DtP1DS6LEM+p9x09kWRqxUGghr Spe50NUtBGVLwppTA53urLmUS3/A0vz5E15d1qoHNqbpNXsBXlkMTefzi7hlGawf0VFi t3sIfMlIt0Zj0skC/46FRkvBNIXhUV+52TDAK9f/Ld0j70wCxpVoPuAn7AP8AeB52/vU LQnMTGS3Cjlv3Ti5dZWPjRFahqvcsFDUIg5rNGc7Bbi7jO4nA8UVS/7zuRBW+GiLq8qL ZbfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AAkQHu34; spf=pass (google.com: domain of dmitry.baryshkov@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dmitry.baryshkov@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m28sor8915150ljc.10.2020.05.25.09.48.19 for (Google Transport Security); Mon, 25 May 2020 09:48:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dmitry.baryshkov@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AAkQHu34; spf=pass (google.com: domain of dmitry.baryshkov@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dmitry.baryshkov@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qFuxiaLQtj25y9sBPvZbzcmOPRrE2+OoU7mnXmLdh80=; b=AAkQHu34gVqwD+D2io1X/xsVdIEw5/KTRUNCC/awsiMQ7KbAutU7D0Y6s7rtgmWObv Zi//1vNOknwT67jcp752ncHZHZmVuzUv8CaK3P1lHjNrxZUqfhhQv2YiCzPT4+PMXxHt fEE+b0SIKZS66MDiQCMKoJehuSg/kotgyd/+oUhBS0Sqq5dblAiVlGJ67aejHulH7PKD 4ZpllbZtsuxUOjvq8z+ubrFYZEUa+Zyq3cmG6ReT1nMbqxDsQujN1wfqUO2VUCsO4r3I GOlwv7hIA3RVr2E1QGWDGfZ5wVhl1zebLP6Yoqe8sN75tXTR0z69yj4SgO0/ZTbylcM3 khhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qFuxiaLQtj25y9sBPvZbzcmOPRrE2+OoU7mnXmLdh80=; b=EN5nlEmE1OMLZZchJEVZ+n+nN++fORSn12C++R9WH4fgBynQABSJ7G5fIUqrgtmSBk xQ+HXslnggD0L0E+aeEvi/aiYPWpzR/r18ktgZHHjpwTQ0/xtdqqguDsNsvvVvm5dplt 0k7ZPzLJ20cuULiBtv+3FewHErj7c7H0r89z16JYa0LBsCTf+U45qDK71Kt6xGwDxaMB QNwvMAQtzMXkOjhXKDlJaQDWP4oSAtWmGj4ml/OqSyO+7bzbck370PmhN2elOwo0xJyj qwEttEp8kong4xg+d/0l+1VA0RMJ4diAZT/cieJgmDUGgtObaQW8+twi/h5lEARCoelK Ttrw== X-Gm-Message-State: AOAM530ZSq6sYiA/aQx5P6fgQWGMfPmfXJisL2rQLUTog6eoKnSVI+dp dGXi1Xshe9YT6qPS0wUwUV+nz6mH X-Google-Smtp-Source: ABdhPJyeiI7t9sxbcbWgBBAvyIrby0YcjkJfjSkpCvcX492Za8Xf13NcKAnKE4AknK9Swn5an8h1MA== X-Received: by 2002:a2e:8018:: with SMTP id j24mr13760743ljg.99.1590425299065; Mon, 25 May 2020 09:48:19 -0700 (PDT) Return-Path: Received: from lothlann.lan ([188.162.64.24]) by smtp.gmail.com with ESMTPSA id y21sm2914337ljg.48.2020.05.25.09.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:48:18 -0700 (PDT) From: Dmitry Baryshkov To: linux-arm-msm@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH 1/4] soc: qcom: socinfo: add support for newer socinfo data Date: Mon, 25 May 2020 19:48:14 +0300 Message-Id: <20200525164817.2938638-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Add support for newer Qualcomm SoC info structures (up to version 0.15). Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/socinfo.c | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) -- 2.26.2 Reviewed-by: Bjorn Andersson diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index ebb49aee179b..0e6adf1161c0 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -24,6 +24,7 @@ #define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff)) #define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 /* * SMEM item id, used to acquire handles to respective @@ -121,6 +122,16 @@ struct socinfo { __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; }; #ifdef CONFIG_DEBUG_FS @@ -135,6 +146,12 @@ struct socinfo_params { u32 raw_ver; u32 hw_plat; u32 fmt; + u32 nproduct_id; + u32 num_clusters; + u32 ncluster_array_offset; + u32 num_defective_parts; + u32 ndefective_parts_array_offset; + u32 nmodem_supported; }; struct smem_image_version { @@ -268,9 +285,19 @@ static int qcom_show_pmic_die_revision(struct seq_file *seq, void *p) return 0; } +static int qcom_show_chip_id(struct seq_file *seq, void *p) +{ + struct socinfo *socinfo = seq->private; + + seq_printf(seq, "%s\n", socinfo->chip_id); + + return 0; +} + QCOM_OPEN(build_id, qcom_show_build_id); QCOM_OPEN(pmic_model, qcom_show_pmic_model); QCOM_OPEN(pmic_die_rev, qcom_show_pmic_die_revision); +QCOM_OPEN(chip_id, qcom_show_chip_id); #define DEFINE_IMAGE_OPS(type) \ static int show_image_##type(struct seq_file *seq, void *p) \ @@ -309,6 +336,34 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo, qcom_socinfo->info.fmt = __le32_to_cpu(info->fmt); switch (qcom_socinfo->info.fmt) { + case SOCINFO_VERSION(0, 15): + qcom_socinfo->info.nmodem_supported = __le32_to_cpu(info->nmodem_supported); + + debugfs_create_u32("nmodem_supported", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.nmodem_supported); + /* Fall through */ + case SOCINFO_VERSION(0, 14): + qcom_socinfo->info.num_clusters = __le32_to_cpu(info->num_clusters); + qcom_socinfo->info.ncluster_array_offset = __le32_to_cpu(info->ncluster_array_offset); + qcom_socinfo->info.num_defective_parts = __le32_to_cpu(info->num_defective_parts); + qcom_socinfo->info.ndefective_parts_array_offset = __le32_to_cpu(info->ndefective_parts_array_offset); + + debugfs_create_u32("num_clusters", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_clusters); + debugfs_create_u32("ncluster_array_offset", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.ncluster_array_offset); + debugfs_create_u32("num_defective_parts", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.num_defective_parts); + debugfs_create_u32("ndefective_parts_array_offset", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.ndefective_parts_array_offset); + /* Fall through */ + case SOCINFO_VERSION(0, 13): + qcom_socinfo->info.nproduct_id = __le32_to_cpu(info->nproduct_id); + + debugfs_create_u32("nproduct_id", 0400, qcom_socinfo->dbg_root, + &qcom_socinfo->info.nproduct_id); + DEBUGFS_ADD(info, chip_id); + /* Fall through */ case SOCINFO_VERSION(0, 12): qcom_socinfo->info.chip_family = __le32_to_cpu(info->chip_family);