From patchwork Sat Mar 4 15:39:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 658797 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D2BCC6FA99 for ; Sat, 4 Mar 2023 15:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbjCDPjc (ORCPT ); Sat, 4 Mar 2023 10:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjCDPja (ORCPT ); Sat, 4 Mar 2023 10:39:30 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521D410403 for ; Sat, 4 Mar 2023 07:39:28 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id j11so7238058lfg.13 for ; Sat, 04 Mar 2023 07:39:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677944366; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=9paeHp+07qtpfuYo/tQXtDjNkaBqslOTssto+pQozeo=; b=CuS1rbmeyF9jWQnBlPitLbL8VaTcKqsbyS/ObvHmoHemsLv0X/4deI63Z1MFKXQzS1 zsbP3yW8kroFZIlmyHOgY+80/zHheHwJ/My0IRM2RfDGQwp9hItbWJPH6FUSn+1Nn98w 48HbpiT6DY/7QUEXZiAybJD+F7XHukJFXtjrDlG0JrDXRdDFkkJdnNgIKh4iSgri3iI4 x7FWPEy8HN8721gkkFqxCzm5m/45q1imdyYU40q/BJBAZCJLToXPouzfY8pa5xCywN8V Ct4GO+NXd9anikiKiym5lZbKBNciHEmTYJ9A2DTlY67X7otmp5fXExuctd6ivaVExEca Y7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677944366; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9paeHp+07qtpfuYo/tQXtDjNkaBqslOTssto+pQozeo=; b=bUConbXvG2BSmYaPqYK+r3Uh8etMsVNx8wwWLuPqpJU5uFo3VVEDUTtmVMK1rHLM5n fPGzA7oRVaiCjbQL9H4+BR2eNI7TkDgNpUzhtsGyI6W0LAoMXem2NehTRl3z3v+a8Coc F228WY8MDlKxzl+QdwNlNyEJtvxIrtOkPOMrZyrrwluzYbBu3U0AtgnWKAwRGPxWg6CT mWcgjcKZUXvk+KoBLt270a3qYex+pq1kHpa748OesDGHk076X/gKvljtH/eRWA97PmeY QC+r/Yi/MN6o2xEmYmQcPT96CcZaPWgZCmY/VrCa/zZsuDD8LCWlHxOdRESOzB7akYLw MHNg== X-Gm-Message-State: AO0yUKW+Xedh4H0+cIJIeFasV/JPEW08YW+z8oLAJN6UgNjAkE4C0akT tFw2Tiy+LZdmSrnCLZ/17FoPYQ== X-Google-Smtp-Source: AK7set8sr+Xp7qat1I3ccKEdugetU6vb3agdy2j/9e6AYxb0X0dCgZeKcsTs2TLXKv+nuhC48oCRDg== X-Received: by 2002:a19:c208:0:b0:4bc:af5:b8d9 with SMTP id l8-20020a19c208000000b004bc0af5b8d9mr1289964lfc.6.1677944366490; Sat, 04 Mar 2023 07:39:26 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id f14-20020ac2532e000000b004ab52b0bcf9sm855065lfh.207.2023.03.04.07.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Mar 2023 07:39:26 -0800 (PST) From: Konrad Dybcio Subject: [PATCH 0/3] Fix BWMONv4 for MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACZmA2QC/x2NWwrCQAwAr1LybWDdbQW9iojsI9pAzZZs1ULp3 Q1+zsAwGzRSpgaXbgOlDzeuYnA8dJDHKE9CLsbgnQ8uuB6XOnPGUvSevq8qeHJn530uA4UBrEq xESaNkkfr5D1NJmelB6//zfW27z/tl1ykdgAAAA== To: Andy Gross , Bjorn Andersson , Krzysztof Kozlowski , Georgi Djakov , Rob Herring , Thara Gopinath Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677944365; l=2383; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=fwdbbzi8OngqlWoVwF8HJxscMkiKpnd+ydCW2XQ3Bb4=; b=Ywxdv2lXbMrvAoH/8qjB+lGNe2qfxuooyV4dR+6Bkp7KO0Z4YC+d4Z9Zo9CnPA3P1/RwlT8SZIaK NrrcInHwB+MTJP1zEJSgXYwsJlfJtRwfX4xe9PmC3fa4uVXmJHRn X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org BWMONv4 (the one used for DDR scaling on all SoCs from msm8998 to sm8550) features two register regions: "monitor" and "global" with the first one containing registers specific to the throughput monitor itself and the second one containing some sort of a head switch. The register layout on all BWMON versions an implementations up to that looked like this: |..........[GLOBAL].........[MONITOR]........| however with SDM845 somebody thought it would be a good idea to turn it into this: |................[GLOBAL]....................| |....................[MONITOR]...............| Sadly, the existing upstream driver was architected with SDM845 in mind, which means it doesn't support the global registers being somewhere else than near the beginning of the monitor space. This series tries to address that in the hopefully least painful way. Tested on msm8998 (the count unit seems to be wrong, should probably be 1MiB and not 64 KiB but the point is that this series makes it work at all, as without it the headswitch is never turned on) and SM6375 (with the "combined" layout introduced in SDM845). Equally sadly, everybody uses the qcom,msm8998-bwmon compatible (which frankly should have been just qcom,bwmon-v4) that never actually worked on MSM8998 , which prevents us from handling it in a simpler way.. While at it, an unused struct member is removed. One suboptimal feature of this patchset is that it introduces an "invalid resource" print from within devres. This could be solved with an introduction of devm_ioremap_resource_optional or by dropping devres functions in place of manual handling, which also doesn't sound great.. I'll leave it up to the reviewers to decide. Signed-off-by: Konrad Dybcio --- Konrad Dybcio (3): dt-bindings: interconnect: qcom,msm8998-bwmon: Add global registers soc: qcom: icc-bwmon: Handle global registers correctly soc: qcom: icc-bwmon: Remove unused struct member .../bindings/interconnect/qcom,msm8998-bwmon.yaml | 28 ++++- drivers/soc/qcom/icc-bwmon.c | 137 ++++++++++++++++++--- 2 files changed, 142 insertions(+), 23 deletions(-) --- base-commit: 1acf39ef8f1425cd105f630dc2c7c1d8fff27ed1 change-id: 20230304-topic-ddr_bwmon-609022cd5e35 Best regards,