Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796035042; b=XZ/XitXoudE+IIDG/OBo7n4T01C7nQtiuyzMfbgVuNelZpxYtMQKQQfk55yyzBPvlfIk zLVcFDnsTvsAc1nNwZ8GZ7dAVlz9idxgrwq8wkAH8iEyDHlUf5WgivtRejYcXiQv+koeB xDZD4arNdNmnItwIEeYdPiNyjM+TlKBpFwX7jwkmNuerMFsbY7lVS9iaW0dc+hmk5uX81 wHJPIMVH/r6sujjQzJoNACK+OHAVXDtQ8LkuuYSQdXYdx6ElX8qhKuWhUl4mL8spNZQVF RmHKTMdjeayaHrubXFwcXQKVzwFvSsm+psjKVY5ORI3/56jTBy9a8UHEadXqjlHcV+A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796035042; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer:X-Proofpoint-GUID: X-Proofpoint-Spam-Info:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=cT219pMbAeWmm72NbFN32J64lIRpI60H6wmFocHcGlg=; b=5IiCZdCcFtmpqzYc+0pqOR2B2cjZbasto3+qvGeeQEMtRluMjuG2gOCQm1reac+vrgTu mFv45+8GUwSV/fgeYiIj+fISgSFuEo7eOSNFBY6USZp1Tbvjwnn9/7q/LI/EU54Oho5Pl R0OEoFo6NMJj2bA0Dk0UWpNi8G+H1VyDLHxVnbZ1MkYsuQn2dhiXPcCgAXieZILPxciVL 0WzNzmiXzzdWaBmWFamQzyov3k3I3E7C1Lnf+SV5GfVemkX9nclc3LF+T1Ct5F/OgTAP3 V2k/J0kijWp76IYe8qXDBEqLVYrZftoS+vCPuz19eDHQjYWOBRsrOmih4dMYjWtubLg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=JjLFla+X; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bSqdr0yS; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5335C606A333 for ; Mon, 30 Nov 2026 10:37:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5335C606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=JjLFla+X; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bSqdr0yS Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU9Uq6F2375740 for ; Mon, 30 Nov 2026 10:37:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= cT219pMbAeWmm72NbFN32J64lIRpI60H6wmFocHcGlg=; b=JjLFla+X2BrjmmTL TujIL1EQf/lYydQeLlsQx+hfIgUpsC9I7xcygBcnOQuzSY1jbMYR8hLAuvn3k5U/ RW5zed+FZ6Oe2qL3pX6Extns+VLOPorXksjNXVoTj4xzC8hYuBJr9ygdJoAAhTg1 y3Ex04mBQiT+joiHiL4oZpuOpRJM9hrSLfoxxq+2Aj6q5biCqP8AyKXpY6vFKGzS Y5YhGPCFHMdvljQhT1sVjF3084AXI4PWc+Z8GmGVlcnPjkXDIXZoWKmk6oqAaRdB rpj/4U+dVBKraada5Q5SlNuEbqOlFKtp9AXIzHnprjBFUHhBHNRtyFCGuxJjURB7 i0GNrQ== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j96c0ramh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 10:37:20 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-9493e89d4f9so1360983085a.2 for ; Mon, 30 Nov 2026 02:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796035040; x=1796639840; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cT219pMbAeWmm72NbFN32J64lIRpI60H6wmFocHcGlg=; b=bSqdr0ySmgShU1Yz6+lUbTEVfPZIOyWx9vHAB+fxGWTLsQOhrJOao9ThLO2wniEsQp 5d+nbjXSYO0WCHD2XD1ARsn/rxxO5+7aFTfSiKXXG/lMrxcwpYNuv8HK/FDdILlUt3JR n3XyXo+tUfbW9TS3pNeWG+s2K90FD8RpL/zbvbBLDGCisJfykObcX2aSFr8UQM18iVB2 RgRSW9gECYaU6jwXTX/aigfPoTHhTJiC9meqZ3IrsR7JmkpAyD5LgDnlALQlmQ0hJJl6 1O/COXmQpfM+ugHAKYPhXbznpKl6ZM9l8ToSvPy+PLZBMAWmaTPSGz/Oo8EZm9Qj3Pq9 A7oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796035040; x=1796639840; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=cT219pMbAeWmm72NbFN32J64lIRpI60H6wmFocHcGlg=; b=niq5+t5qm2xb0Y8tC0c4WaubWkXItEd0/vYlSpJR7IPZ1LTMD6GUpAsFjuhCdGCsn7 B+ka1sMP65jqldoqptclxFXMpp9yeBlITWi5GI5qH/UA8MChO9BN+1IBHZggCMQp/Jj9 HVGG0Ua5Ikf1KzYuGtPGkVgJE+k2d5jlw5W2KOu6wVuSwblTe2WGyE2L8hPPHng8jrK7 ToTdJG4X8LmsIoE1B2w367BCdl99G6swgdadgFaQIuBVemG6tjCut/00ZGiaHHOqcNF2 ckC3lIIef8d1d9eXmlsQIhe8+/lEuww0w7bs9gDxuLqm7p9VxRCApuzJrnhNmcsp1ySE ftrg== X-Forwarded-Encrypted: i=1; AL+hErFnIA3iBOTUsGB1Z0oidMvUO/LW4isdoEFItol/0DFiiovU933FcG3/12Qqv2m7Yd0EAeUN5SjGdL7QJ2kr@vger.kernel.org X-Gm-Message-State: APuU4Z8ynBe7O1fE0vAkja7Ji06wrpDNY/X9MIGYyg9MpnUAt/NODJ1l 3kLzTcDx8uIlbgbz6UGtdn6daIYGYfLfC6wY0cGzWBnTkMooStPNweqUzeA/l5qHgqIf5rSnkYL Cqavae6Qel957FWubwOjpg3vmYNMi7vHEHCcppbwuRvxwZAcPs+s2m2zt8Ybc1S9333up X-Gm-Gg: AZFdTZeraKXBjBU3yS5nh9yY/tBi3uEMWC7YHZ6w6yflDiDlNu6KeG6G+hvo3NvrO5m Hoy8YljkkLOkN+tQ8hxkKxTmHOoHSyCLu8e1fk82foQjoQIgVHTPmmWFy8Cvvd2gguOqerrw3cl 5DgXjEG9m7UvYo9WnqYwby3jmb4PO0tERPI0fQEorgcqGPpSWQTG+tA6eF2aE2khI+r2NWyUwj7 aB0bQvGbBBQVtFCzwCdkyoUvFbZojrtURH0Xxh8M52bjRGsCuAOAOfUq+oqbUIjYQBsIyBs8Tch XnX+Ulz+oVMVMyallFI2NTSlC9NqlbFB1zfALsW79S7bML1E7BXzhlEcQp7kMqIb3UkStbunT8D 14gKNAETJF3Z1e6ftvgglOIplC61pJyMQfKpF2MMzrqdiW+t8I+tWOBb11T7XSBKW3BJuiI43X6 jmTLLtRI5kqE4hn3biB/NJra+lX5V6CBKc3sUcnyeeCFSDNXaq+Ob/oewwx1U9YWJFOIEfv85Bi AiFRXmy4z7F+NLf5ZjT+ge24au7 X-Received: by 2002:a05:620a:27c1:b0:93f:1ed3:a9cc with SMTP id af79cd13be357-949ba9b3a47mr5553430085a.17.1796035039504; Mon, 30 Nov 2026 02:37:19 -0800 (PST) X-Received: by 2002:a05:620a:27c1:b0:93f:1ed3:a9cc with SMTP id af79cd13be357-949ba9b3a47mr5553427685a.17.1796035038932; Mon, 30 Nov 2026 02:37:18 -0800 (PST) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:6046:9c83:ea4b:ae9c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbab390cf5sm486441005e9.7.2026.11.30.02.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 02:37:18 -0800 (PST) From: Loic Poulain Date: Mon, 30 Nov 2026 11:36:59 +0100 Subject: [PATCH v5 3/7] i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtime X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-cci-imp-v5-3-d2ac891f2bc6@oss.qualcomm.com> References: <20261130-cci-imp-v5-0-d2ac891f2bc6@oss.qualcomm.com> In-Reply-To: <20261130-cci-imp-v5-0-d2ac891f2bc6@oss.qualcomm.com> To: Robert Foss , Andi Shyti , Konrad Dybcio Cc: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Loic Poulain X-Mailer: b4 0.14.2 X-Proofpoint-GUID: MPwn7gVauYbXCJPK7qBHLMc69nEgmKyX X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfX8uODxFDHS47H tc6vv9luW+k5UI3eR5mTl7FxPGvJNelIiM1dktbo+2CntZzmLk1lYGXQSEvKobpyWEaapp/LM+w 1wChrwnsj8O8qe4quxl2OBoWgqMAeew= X-Authority-Analysis: v=2.4 cv=OvnaWC/t c=1 sm=1 tr=0 ts=6b0d51e0 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=8R-5LDRAFMUVkZqLBecA:9 a=QEXdDO2ut3YA:10 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfX3e9V6W5mWmjd WCKoRrVP01qyIIc6ngQlFBdxwE0RYT4btq552vuqrLPe0PpkwDzjzs1S7M8HgjAAHHMwXKPRaZo +4Mbh8bkGmORYT0P4XF8G7lMaNOEfX8EeaMGEOPSqq46AlR3XsirdRwVEw5XIHhy9P5ywj7VUsh 7vIdcw5VAfoHmuZRkcpBrrZ2KyA5M2O7QPKgCMQHPetL9q8sjWiDoiPRHr4paN7Z52fvedEbA73 rIqOqHFGd5/iYSwUOcwyl76QG5FvEvD+IzI1Tva5nMj3eMVDeiiSAE3ZjSr7jTRm3GUb4F6VK+1 /2xqJ1VFzoqURMdktlklhsm3M1qCVhL4D25frrHNd8MVS0sRWacjjyiUHXRXY7MGrayyMVykRSb I61PZ/EBUqREWRMrO7XjsN9g+sBwXlyoBAmTut7mT9S5wjg/gc2y/VStA8RPxAR3ka5iUX4vT2+ OrK5AvlBBZGKV7mJLMA== X-Proofpoint-ORIG-GUID: MPwn7gVauYbXCJPK7qBHLMc69nEgmKyX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_03,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300042 In theory, every SoC integrating a CCI revision that differs from an existing one should introduce a dedicated compatible string. In practice, most CCI instances still fall back to the msm8996 compat (v1.4.0), one of the oldest supported versions. In order to take advantage of capabilities introduced in later versions, such as larger queues (v1.6.0) or threshold IRQ support (v1.7.0), we need to properly distinguish the different variants. Replace the static per-compatible cci_data definitions with a version-sorted capability table keyed by (hw_major, hw_minor). During probe, read CCI hardware revision register and select the newest capability entry whose version is less than or equal to the detected hardware revision. This allows revisions to automatically inherit the closest supported capability set without requiring additional compatible strings. Several compatibles that currently fall back to the msm8996 configuration (e.g. sdm845, sm8250 and sm8450) will now resolve to the corresponding capability tier, gaining access to their larger queue sizes instead of the conservative msm8996 defaults. - v1.2.x CCI increase I2C write payload + burst write support - v1.6.x CCI has increased queue sizes (64,16) -> (128,32) - v1.7.x CCI introduces threshold IRQs (leveraged later) - v1.10.x CCI increase queue 0 size (128) -> (1024) Suggested-by: Konrad Dybcio Reviewed-by: Konrad Dybcio Signed-off-by: Loic Poulain --- drivers/i2c/busses/i2c-qcom-cci.c | 165 ++++++++++++++++++++++++-------------- 1 file changed, 107 insertions(+), 58 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c index fff71c5e4ea544f5d4c57916f25eaced74fc3aa1..02e170182357fba4cb05113c3eb9665cc03ebad5 100644 --- a/drivers/i2c/busses/i2c-qcom-cci.c +++ b/drivers/i2c/busses/i2c-qcom-cci.c @@ -2,6 +2,7 @@ // Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. // Copyright (c) 2017-2022 Linaro Limited. +#include #include #include #include @@ -14,6 +15,10 @@ #include #define CCI_HW_VERSION 0x0 +#define CCI_HW_VERSION_MAJOR_MASK GENMASK(31, 28) +#define CCI_HW_VERSION_MINOR_MASK GENMASK(27, 16) +#define CCI_HW_VERSION_STEP_MASK GENMASK(15, 0) +#define QCOM_CCI_VERSION(major, minor) .hw_major = (major), .hw_minor = (minor) #define CCI_RESET_CMD 0x004 #define CCI_RESET_CMD_MASK 0x0f73f3f7 #define CCI_RESET_CMD_M0_MASK 0x000003f1 @@ -133,7 +138,8 @@ struct cci_master { }; struct cci_data { - unsigned int num_masters; + u16 hw_major; + u16 hw_minor; struct i2c_adapter_quirks quirks; u16 queue_size[NUM_QUEUES]; /* Highest I2C mode supported by this variant. */ @@ -144,6 +150,7 @@ struct cci { struct device *dev; void __iomem *base; unsigned int irq; + unsigned int num_masters; const struct cci_data *data; struct clk_bulk_data *clocks; int nclocks; @@ -245,7 +252,7 @@ static int cci_halt(struct cci *cci, u8 master_num) struct cci_master *master; u32 val; - if (master_num >= cci->data->num_masters) { + if (master_num >= cci->num_masters) { dev_err(cci->dev, "Unsupported master idx (%u)\n", master_num); return -EINVAL; } @@ -366,7 +373,7 @@ static int cci_init(struct cci *cci) writel(val, cci->base + CCI_IRQ_MASK_0); - for (i = 0; i < cci->data->num_masters; i++) { + for (i = 0; i < cci->num_masters; i++) { int mode = cci->master[i].mode; const struct hw_params *hw; @@ -616,7 +623,7 @@ static int cci_get_required_rate(struct cci *cci, unsigned long *rate) if (clk_round_rate(cci->cci_clk, cci_clk_rates[ri]) != cci_clk_rates[ri]) continue; - for (int i = 0; i < cci->data->num_masters; i++) { + for (int i = 0; i < cci->num_masters; i++) { int mode = cci->master[i].mode; if (!cci->master[i].cci) @@ -696,6 +703,81 @@ static void cci_put_of_node(void *data) of_node_put(data); } +/* Hardware capabilities, ascending by version major,minor */ +static const struct cci_data cci_hw_catalog[] = { + { + QCOM_CCI_VERSION(1, 0), + .max_mode = I2C_MODE_FAST, + .queue_size = { 64, 16 }, + .quirks = { + .max_write_len = 10, + .max_read_len = 12, + }, + }, + { + QCOM_CCI_VERSION(1, 2), + .max_mode = I2C_MODE_FAST_PLUS, + .queue_size = { 64, 16 }, + .quirks = { + .max_write_len = 11, + .max_read_len = 12, + }, + }, + { + QCOM_CCI_VERSION(1, 6), + .max_mode = I2C_MODE_FAST_PLUS, + .queue_size = { 128, 32 }, + .quirks = { + .max_write_len = 11, + .max_read_len = 12, + }, + }, + { + QCOM_CCI_VERSION(1, 7), + .max_mode = I2C_MODE_FAST_PLUS, + .queue_size = { 128, 32 }, + .quirks = { + .max_write_len = 11, + .max_read_len = 12, + }, + }, + { + QCOM_CCI_VERSION(1, 10), + .max_mode = I2C_MODE_FAST_PLUS, + .queue_size = { 1024, 32 }, + .quirks = { + .max_write_len = 11, + .max_read_len = 12, + }, + }, +}; + +static void cci_detect_hw_caps(struct cci *cci, u32 hw_version) +{ + u8 major = FIELD_GET(CCI_HW_VERSION_MAJOR_MASK, hw_version); + u16 minor = FIELD_GET(CCI_HW_VERSION_MINOR_MASK, hw_version); + u16 step = FIELD_GET(CCI_HW_VERSION_STEP_MASK, hw_version); + const struct cci_data *data = &cci_hw_catalog[0]; + int i; + + for (i = 0; i < ARRAY_SIZE(cci_hw_catalog); i++) { + if (cci_hw_catalog[i].hw_major > major || + (cci_hw_catalog[i].hw_major == major && cci_hw_catalog[i].hw_minor > minor)) + break; + data = &cci_hw_catalog[i]; + } + + dev_dbg(cci->dev, "CCI HW version %u.%u.%u, using caps tier %u.%u\n", + major, minor, step, data->hw_major, data->hw_minor); + + cci->data = data; + + for (i = 0; i < cci->num_masters; i++) { + if (cci->master[i].cci) + cci->master[i].adap.quirks = &cci->data->quirks; + } +} + static int cci_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -710,9 +792,6 @@ static int cci_probe(struct platform_device *pdev) cci->dev = dev; platform_set_drvdata(pdev, cci); - cci->data = device_get_match_data(dev); - if (!cci->data) - return -ENOENT; for_each_available_child_of_node_scoped(dev->of_node, child) { struct cci_master *master; @@ -724,14 +803,16 @@ static int cci_probe(struct platform_device *pdev) continue; } - if (idx >= cci->data->num_masters) { + if (idx >= NUM_MASTERS) { dev_err(dev, "%pOF invalid 'reg' value: %u (max is %u)", - child, idx, cci->data->num_masters - 1); + child, idx, NUM_MASTERS - 1); continue; } + if (idx >= cci->num_masters) + cci->num_masters = idx + 1; + master = &cci->master[idx]; - master->adap.quirks = &cci->data->quirks; master->adap.algo = &cci_algo; master->adap.dev.parent = dev; master->adap.dev.of_node = of_node_get(child); @@ -785,16 +866,14 @@ static int cci_probe(struct platform_device *pdev) if (ret && ret != -ENODEV) return dev_err_probe(dev, ret, "failed to add OPP table\n"); - ret = cci_set_core_rate(cci); - if (ret) - return ret; - ret = cci_enable_clocks(cci); if (ret < 0) return ret; - /* Interrupt */ + val = readl(cci->base + CCI_HW_VERSION); + cci_detect_hw_caps(cci, val); + /* Interrupt */ ret = platform_get_irq(pdev, 0); if (ret < 0) goto disable_clocks; @@ -806,8 +885,9 @@ static int cci_probe(struct platform_device *pdev) goto disable_clocks; } - val = readl(cci->base + CCI_HW_VERSION); - dev_dbg(dev, "CCI HW version = 0x%08x", val); + ret = cci_set_core_rate(cci); + if (ret) + goto disable_clocks; ret = cci_reset(cci); if (ret < 0) @@ -820,7 +900,7 @@ static int cci_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(dev); - for (i = 0; i < cci->data->num_masters; i++) { + for (i = 0; i < cci->num_masters; i++) { if (!cci->master[i].cci) continue; @@ -855,7 +935,7 @@ static void cci_remove(struct platform_device *pdev) /* Ensure the device is clocked before issuing the halt requests */ ret = pm_runtime_get_sync(cci->dev); - for (i = 0; i < cci->data->num_masters; i++) { + for (i = 0; i < cci->num_masters; i++) { if (cci->master[i].cci) { i2c_del_adapter(&cci->master[i].adap); if (ret >= 0) @@ -866,51 +946,20 @@ static void cci_remove(struct platform_device *pdev) pm_runtime_put_sync(cci->dev); } -static const struct cci_data cci_v1_data = { - .num_masters = 1, - .queue_size = { 64, 16 }, - .quirks = { - .max_write_len = 10, - .max_read_len = 12, - }, - .max_mode = I2C_MODE_FAST, -}; - -static const struct cci_data cci_v1_5_data = { - .num_masters = 2, - .queue_size = { 64, 16 }, - .quirks = { - .max_write_len = 10, - .max_read_len = 12, - }, - .max_mode = I2C_MODE_FAST, -}; - -static const struct cci_data cci_v2_data = { - .num_masters = 2, - .queue_size = { 64, 16 }, - .quirks = { - .max_write_len = 11, - .max_read_len = 12, - }, - .max_mode = I2C_MODE_FAST_PLUS, -}; - static const struct of_device_id cci_dt_match[] = { - { .compatible = "qcom,msm8226-cci", .data = &cci_v1_data}, - { .compatible = "qcom,msm8953-cci", .data = &cci_v2_data}, - { .compatible = "qcom,msm8974-cci", .data = &cci_v1_5_data}, - { .compatible = "qcom,msm8996-cci", .data = &cci_v2_data}, - + { .compatible = "qcom,msm8226-cci" }, + { .compatible = "qcom,msm8953-cci" }, + { .compatible = "qcom,msm8974-cci" }, + { .compatible = "qcom,msm8996-cci" }, /* * Legacy compatibles kept for backwards compatibility. * Do not add any new ones unless they introduce a new config */ - { .compatible = "qcom,msm8916-cci", .data = &cci_v1_data}, - { .compatible = "qcom,sdm845-cci", .data = &cci_v2_data}, - { .compatible = "qcom,sm8250-cci", .data = &cci_v2_data}, - { .compatible = "qcom,sm8450-cci", .data = &cci_v2_data}, + { .compatible = "qcom,msm8916-cci" }, + { .compatible = "qcom,sdm845-cci" }, + { .compatible = "qcom,sm8250-cci" }, + { .compatible = "qcom,sm8450-cci" }, {} }; MODULE_DEVICE_TABLE(of, cci_dt_match); -- 2.34.1