From patchwork Sat Oct 26 22:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13852386 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5FC11D7E26 for ; Sat, 26 Oct 2024 22:42:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729982563; cv=none; b=gJ85WfG7/1KMD/iJBQQC0fKXmc8Z/3+UxWNnuU2KO0yLK404ewy4o1NhZwXklRll9TfKASC18eAqPyewJJjGPi/y6qQiAlVq9FjlY9sA7apPChJAnvWwxhmha/wOsWDf3/5O7EcP7zWcu7KrZOJ9aMMjpwxGrDaaAkIzGwG+TRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729982563; c=relaxed/simple; bh=2ZgMrlkYpiDDrXAgozydYWw7D6SRYzHUM29VfbLRxDY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I8mhmep6NPlZzZu0NGRf/qP8w0KKsTDVnfkOdwk/eY5TOYhZ3OsYZS4YNd9UK97QBeEAY9UrTzFsrx6F9nOo95AqFmuTZzjPvSFGXByihV8+D7V8PbzF9VzW7Ea1InIAFw2XDYl9dJxH0ajaKQjtWxtNneNqz5t1b86NQFsg+VA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Z+M5bUWW; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z+M5bUWW" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-53b13ea6b78so5030671e87.2 for ; Sat, 26 Oct 2024 15:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729982559; x=1730587359; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XdlGUNfHa8IyN+iOnLwL2IFApp8c7i9bn9RNNG57Qvg=; b=Z+M5bUWWqS7i/P476pQOdra3FMSjFSZzxLP/0pj6ApZ4ePebz0fNyGVcSEgTB1y7+A 4PKhsAoKnBjpTMa6Uri/dVy/Av9bVCEX2pu9Y9Muuq9uyvzrGrl4p7SVybMHXRAl0Z+k PPAppF2jlnolULD4qKMR4ONXK92i0DwjL2s2i9Q3AxMH7EBH1FkhJIiamIAhHn72dznk jco5AEuYd08hNnwXukDx+b+dlZAMtyIgSVozEVNXpwg9y+pP6fs82TEIdxdzKY7iUep3 dMbCZdWFx0aUW8cIXwEw49LB7eLT2/L2fCVvLVpknb8hPkqO5Vw4gqxRSbzL7RHhihbf 5g+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729982559; x=1730587359; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XdlGUNfHa8IyN+iOnLwL2IFApp8c7i9bn9RNNG57Qvg=; b=PfOoOlS53MXAbyHd9ifpsQbvdICgVHELdSrjZKX11in5xKzw8Igcen3/4+/3/12yfV NhoIbYbZtrjQ86O9/peLwEgwiHE3jevHhdA6pakD3zJw4KLi97UyJwUqIP6A4D5w2WOQ eTOwfMrJj4767AHmbRN8+SQU6Rvts8bIfKjQpe7pMrxWQ7N52ci+Ma8qdt4JqJ21DHyl AkSPbK0cw06cKZ52S0TpQkr4fbT1CgD9k6uNYNLlHZ9G1Y5FBqjmedv6bSkYnCDBXCul fYtsRmXPXPOu0h4LBxz1BFxNV6TSjHis9KMOcPCnQCR69vlel3qcVpo0WEC/evX1EyYa 35ew== X-Gm-Message-State: AOJu0YzmWHhZ3bFHVGJ5vqw9/DczdOLruMv0DgchMHvUjChWjIxTZ9Yo lEeKtDO8/Xc2OXg0PThz4r1f9XIYkJv0j5IYst9Lhk/d39Rbn2pkxpI5K1Hc8Yk= X-Google-Smtp-Source: AGHT+IFfnu3oqJBcD+Y/PvxVjFG7fBkb1LOXV7EnrW7e9BO8EcLAEcAPbtJc+F5pO0UHvGfD04B9sw== X-Received: by 2002:a05:6512:3c97:b0:536:741a:6bc5 with SMTP id 2adb3069b0e04-53b348ba0d5mr2481610e87.12.1729982558964; Sat, 26 Oct 2024 15:42:38 -0700 (PDT) Received: from [127.0.1.1] (2001-14ba-a0c3-3a00-70b-e6fc-b322-6a1b.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:70b:e6fc:b322:6a1b]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53b2e10a6a1sm610517e87.47.2024.10.26.15.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Oct 2024 15:42:38 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 27 Oct 2024 01:42:33 +0300 Subject: [PATCH v2 1/2] nvmem: qfprom: Ensure access to qfprom is word aligned Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-sar2130p-nvmem-v2-1-743c1271bf2d@linaro.org> References: <20241027-sar2130p-nvmem-v2-0-743c1271bf2d@linaro.org> In-Reply-To: <20241027-sar2130p-nvmem-v2-0-743c1271bf2d@linaro.org> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Naman Jain X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1689; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=D7o6WbYbkVAW9OT4oiPZ8s1uCTCR6XpU8Gj0V5vCEww=; b=owEBbQKS/ZANAwAKARTbcu2+gGW4AcsmYgBnHXBcX8Ev71iAN5wcdwtrAgo+x+jN4fThZehuJ pYkJWpx7N2JAjMEAAEKAB0WIQRdB85SOKWMgfgVe+4U23LtvoBluAUCZx1wXAAKCRAU23LtvoBl uJ9GD/0YucfFg8dDv7xZj/DhFzCiGUtapFGXeo7V/LSG4wCaKoflvfa8OKezLDTYkT7MBHVgsNS TlFEDLavkyg7xlGfKU3530Ce2O5w6zwWufbpmJopyR3yuTQAmhbCFl71tJIG0a61CjES2Nyhy27 aKBsxgr5cYygwj1LCkLLMvLju1clL8Fnf+f27Abhq1B1XYcwjpoqw8axRgIJTsUlVda1RG0dITS NlO5zh6DQwdAKnDTWRKp4vCYjdt81dz24KgvQrsRfAdwxjP9B7qgko125oKQoz4UnlhZDtaZqQb WA6v6fT7x3uuWoXbybCcddVWrgfyW9kH5VY1S8biD23VDSGzig7s8QMk8cf971fmAxjHd8ubu8P SxmyNjkZwqMrIN83kWqLk85ZHYLhyYotqH/qks66EpDImXDn1Z821IqlYv998ucZwrLDttdw84D imYii/d0+Kl90BsrkS1AP9MgLB85cJ+/vX6U7PHWKf6dAx1vRUV3FW1GFFxPq9KgJ+LV77TqCRQ t1FwDuNbg6DmMDcEAV7xnOHGFjvOcByQ0ekXLz3cgQ14yg1sTq2gaOe8PSNL7OhZV3Vy1z4QGLj ZwVOfYwgO0SqQjKHHi5Lg4YHqqXs358X7JJ+N/xpy43cEr13UI7b/zd8ZXjR495SUAFxB340z74 wJjrLXf3yM6G26g== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A From: Naman Jain Add logic for alignment of address for reading in qfprom driver to avoid NOC error issues due to unaligned access. The problem manifests on the SAR2130P platform, but in msm-5.x kernels the fix is applied uncoditionally. Follow this approach and uncoditionally perform aligned reads. Fixes: 4ab11996b489 ("nvmem: qfprom: Add Qualcomm QFPROM support.") Signed-off-by: Naman Jain Signed-off-by: Dmitry Baryshkov --- drivers/nvmem/qfprom.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index 116a39e804c70b4a0374f8ea3ac6ba1dd612109d..cad319e7bfcf34c9b9ab15eb331efda822699cce 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -322,15 +322,28 @@ static int qfprom_reg_read(void *context, { struct qfprom_priv *priv = context; u8 *val = _val; - int i = 0, words = bytes; + int buf_start, buf_end, index, i = 0; void __iomem *base = priv->qfpcorrected; + char *buffer = NULL; + u32 read_val; if (read_raw_data && priv->qfpraw) base = priv->qfpraw; + buf_start = ALIGN_DOWN(reg, 4); + buf_end = ALIGN(reg + bytes, 4); + buffer = kzalloc(buf_end - buf_start, GFP_KERNEL); + if (!buffer) { + pr_err("memory allocation failed in %s\n", __func__); + return -ENOMEM; + } - while (words--) - *val++ = readb(base + reg + i++); + for (index = buf_start; index < buf_end; index += 4, i += 4) { + read_val = readl_relaxed(base + index); + memcpy(buffer + i, &read_val, 4); + } + memcpy(val, buffer + reg % 4, bytes); + kfree(buffer); return 0; } From patchwork Sat Oct 26 22:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13852387 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA6A41D7E37 for ; Sat, 26 Oct 2024 22:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729982563; cv=none; b=MQjWcEFAv87lwZ5PqP1Vgzi4qHclIDj7xXro5MPNa2gHuQn3b91BBNnbw7SB6McvxkYSrNhX2BlBm8RRxCN4Rw2owQm0RWCEtiOjdncSd++yFPp0WKuC4YkyRGqmdyF3Ol1McDsLHJ+QvN5aUmIeYYlmQpzDJ0MWVGEelpp/pXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729982563; c=relaxed/simple; bh=bFoUxd13xqGzTL8i0Uke1VWxv8nz0uckVKpDL5fYKp4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L+VAlcPvQk/5qGGumU3jpYtN5g5geXcpPWntEd5U6LdVXM3wk+FF3QoEQRLjkqwp+PyM1bV+fFINRAgd3CaxCeGJgC/Kmaqqd0pSDbC29TaxaXnH7tvs0KnS5ILAED6MTXZ9MKvHJ5KOkRdRy8xRm2QB3yf8Q5RDw8GQ0c5F9Vo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OyTSSofB; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OyTSSofB" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539e8607c2aso3363352e87.3 for ; Sat, 26 Oct 2024 15:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729982560; x=1730587360; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tBnHSa/ei6D2pomsNrU1v/8n3usXWfC08yobzI09Jro=; b=OyTSSofBtrAG9LrgQqokB28+dth5UCk8fh3eNSxiwmgfReKxm/oz3JIXU1F9mA/oKy Q0RDkFcVgRtKTkMf1XW5qAFTAfOMZs1HH8yQpI7x9rMWmB7Jz6P2Z7d4pZu620+7Lvnz TLqvQ0k+8gc7xjXN6iykxeFW4IPErTOLyb8OSINevjXxX6p/a68l/UJymYiya8+B3ehU 7eIrcR8iMuAm5mnpeg2DuO4dkr0UrEC4bDtf7P2ITaYkDxN+1ZfjtCA66+PWovvnGWYs 54nWr7M/2xwkaYmjDTAu9Y+kWUvp2qX14wVk23yGEwtm/usiExsgLCGmY/o47hRtTZFD RamQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729982560; x=1730587360; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tBnHSa/ei6D2pomsNrU1v/8n3usXWfC08yobzI09Jro=; b=hGK8ul0TcpnIm5C2i8CVM0COJKJtA+M7+99YPisu3u0PyLFw/XoRVUblSKLvKhbnG4 gPHyv51B7CzW2N8WgBtu5K6tnBuFPvpV2SE8WvxCby7IohLYoOPZhuXS8xZsBKNlq+NF z+7dzi1WijYQk3blsBlqHKQfA658ONKe1sei00u7keEseCPMkMCzczV0rwdCxdPbP1rM ktM5NUnF7OFsPloMXfk8JGJQxJ/iBmByImIRnbWGTVi9l/NRzzI7tSq/2wq5V/M/Ejtl CufgiVocvUmmN8cKhpMVyFa6KiWhB1ZaqNoPwWKAGDwAOMPesJIpRKl9ea+1Eoqmv89i ew5g== X-Gm-Message-State: AOJu0YzXTMnXoNqd7fmA7/IMCY1ymkdq9vBVlD67UvQ/wWQIxyCFgGN7 U7cxG8FqloGzvOe8sQMqIkUuHS8K3NqSlsPm8XIvorynQHI1/nfGsQV5HQpjWbg= X-Google-Smtp-Source: AGHT+IE7LWcHx8APs7QiwWkT5t7Mc8LsTbw9oYrg5clSJ3rGrkxsC9BX4lBy/f2TeoOFhnk7d1gHCw== X-Received: by 2002:a05:6512:1385:b0:539:e80c:23f with SMTP id 2adb3069b0e04-53b348c8d59mr1175329e87.14.1729982559686; Sat, 26 Oct 2024 15:42:39 -0700 (PDT) Received: from [127.0.1.1] (2001-14ba-a0c3-3a00-70b-e6fc-b322-6a1b.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:70b:e6fc:b322:6a1b]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53b2e10a6a1sm610517e87.47.2024.10.26.15.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Oct 2024 15:42:39 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 27 Oct 2024 01:42:34 +0300 Subject: [PATCH v2 2/2] dt-bindings: nvmem: qcom,qfprom: Add SAR2130P compatible Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241027-sar2130p-nvmem-v2-2-743c1271bf2d@linaro.org> References: <20241027-sar2130p-nvmem-v2-0-743c1271bf2d@linaro.org> In-Reply-To: <20241027-sar2130p-nvmem-v2-0-743c1271bf2d@linaro.org> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=866; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=bFoUxd13xqGzTL8i0Uke1VWxv8nz0uckVKpDL5fYKp4=; b=owEBbQKS/ZANAwAKARTbcu2+gGW4AcsmYgBnHXBcZyK1GzcMa0eAwvU1n16edXaMSnIUcRCHj /j7FaWbQYqJAjMEAAEKAB0WIQRdB85SOKWMgfgVe+4U23LtvoBluAUCZx1wXAAKCRAU23LtvoBl uA6dD/411VX5nd7qSBF/oDZNmzTS8cvtDYSJlwPWzBXTW2OZkU00OfTNCdj9c1Nj7zjtDrHNEom 4TCwPXC2yQfOaTxyUX3SWujt2nlXhFp/4upBNl7P5RNZoF3kWO47UPpa+8bpMc9ZZHqHvIWkOcC aVp9AC8wzk3KNtHCp5pz7kb560rrr+PvlDr1RnI/6F98KZeM1mIsW1P1dQFFpDtX5a18BqUSO5s YFTYDtg3PVzGdxN8qXinpm1le2zNQzzeKWpSm/eQ2zwRI0i9AGAI9t/RoFA1YdRYw5iY5wmfXoC Sdi9W76+SQvF5c20N3qq2EFYcLeKN4voXa1S3MMUMhj8ReWEEAC7yexGrsW3Qd2lOY8Z7KnuSrN jzDYVijGESnlor9qZg+bNYKGuRh46GPTxHOchB+SFaGqeQ2ok10Nd8u43XQXSJ+Js0sAKLT+NeN WI1ysqeaHVbJOPZ5pSbU+nAhVtrNcd4f1TANFwfFOyXIGD+pKQlQ63REBPxF1/fhPjfKVf/Y/Z4 J4qL5ecZ6P36a+gl+p2/S6RsJ603yKXJfEp1L6mBXBGnu/mJ2K17B7O6K0/2Fk5cUyPNr+AF1RU 0JvXe0unDKvMT6EldYP8EijMMlkECtpeOPm8IvbrR+OirHLaHR0DqELCc0xV3apWIV5PC6YO3Yf eIP2uh+PSuLoSVw== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Document compatible for the QFPROM on SAR2130P platform. Signed-off-by: Dmitry Baryshkov Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml index 80845c722ae46611c722effeaaf014a0caf76e4a..9755b31946bf9d4c1055a993145d06c274b61a37 100644 --- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml @@ -32,6 +32,7 @@ properties: - qcom,msm8998-qfprom - qcom,qcm2290-qfprom - qcom,qcs404-qfprom + - qcom,sar2130p-qfprom - qcom,sc7180-qfprom - qcom,sc7280-qfprom - qcom,sc8280xp-qfprom