From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796379590; b=DVWhwotNkOg4SwnBdzDdACxq9rxTJGN5rDwax1UbtMs4/uiRtUceoGrbZpOEF5MgrVwI H85sBkC2bwrOz6IOrAOpXKOsGQm3H1dSPA2xUu5BmmJNiOCZWE8EM6DMGp2SpgRPhm/CV XWjgyZap6kUzQBFWb09U+HfKImaRAQXS6rm55gIPCF1sHls4i9xicvNWVo1YAseengrKY VPgPFeQVn37LVLfNpm+djZd+nw6oOCBjJoCwr/Gq9Hl1sQkJA2iHRCrPm3+PbaaIWKfPu O1k2gSJhvBysLS6LXah0HPpFzmyJcvAF9EfwWi8kssMAFGqIkbXd9zIBivf0eWibzrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379590; 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-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Authority-Analysis:X-Proofpoint-Spam-Info: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=c6dlsbN3O6iGza/dxfhfkCCbIGWGKyh+mT3DKXpW+qI=; b=E70k6qM1QlTAacUDtliy6oexZm/3BRDINOYIdHqo8Kp176tVityWBQQjcb7hSJfaAlIE QlY9V09SdaLlCGg1opWGJXrYzjyWFaZ03W5DiBoRJC/dixxWcl51bWzJ8zDPxNb1Ka1uZ MrjG04p38eaSFrLhnz4eSsPMK3fGubv8GAg5s4GY+VXR2dCiRZbYthOSOwD/ROaBLGkAF NotDQuw8UJMkwU7ck2QP6HUn6QhpVcOcGY9514T3CpGlVhH5jm7fdO5VUNIcWBO/zkdUm fcBdPVEATrY6H4afU565huAiMr29H06u+GiCQA3wJBNDn41vbGFz7jg5O7LVJ70Yrjw== 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=QHaWoXu+; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b="eohTGez/"; 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 96CBC606A695 for ; Fri, 4 Dec 2026 10:19:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 96CBC606A695 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=QHaWoXu+; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=eohTGez/ Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B45ItHg2774553 for ; Fri, 4 Dec 2026 10:19:48 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= c6dlsbN3O6iGza/dxfhfkCCbIGWGKyh+mT3DKXpW+qI=; b=QHaWoXu+9XzzI2go J5KB1bAONE522kKagLexISD7iik7w2ns08I68vdoLvFc7aqRCH0T0Y++nfDGzBwb WVpw3RxWE4Z1L/bQUcgiZ1LeoI/udS03sMcQGtjwkALM6oLIJIzs09jC3msRl1K5 bmRnckIDRe9DRVAlYGJDNxSaFIDNP3EXM4AeniddMyu7QMvlr3pjd5ENYNhLENj2 3BHwj3AqCBSVUX/pQ28gRyul7wjsZnxLkazu7ECScjwoedIcj+MZRjfMmMGMm+U6 6ocSICgDe6xB83t+xKStxjers/8XoEvbiyleupu+L+w3RIlsf884YwDM0LnSWR/8 YqXDvQ== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jbq7s0w4h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 04 Dec 2026 10:19:48 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-544019b1831so10895551cf.0 for ; Fri, 04 Dec 2026 02:19:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796379588; x=1796984388; 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=c6dlsbN3O6iGza/dxfhfkCCbIGWGKyh+mT3DKXpW+qI=; b=eohTGez/jNnAerZD+ln+SwXUBt9BmAk+yUJKjmqZbfcauoDs28h4XwATjcOgzYyDEa 066XotPo3ZxBe7Mj7qJtcyurpdUZIaQHsm4xVQsVws8jAJ8/b7Uo4E+scJGJb3EY+21p h41qTBpt1GXqhDMH4pMIfe3LrxirYGf15VkW1k+FU3Z8Qzp86D+/9ZK3Gx8bH28zf2PJ GCh571xkHpZtSDV5xSz26kWtxH6x7jCds2u9Gsiov8dho6ebdZLRDzsGixf56flQBCcU 24PHBLVEhWfmKcgQ2iDZ7U06swu7RI3x//UgJSoIQ6SB5LeAX98BfvMlyCLRTME1ZTFU +T/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796379588; x=1796984388; 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=c6dlsbN3O6iGza/dxfhfkCCbIGWGKyh+mT3DKXpW+qI=; b=sJLAXmZRHAk3FLRg9GrK0RLEuvC0xeNMCCBxVkOrtS7psdMyVnD40/ujjdvDYoDDmu th2F2I+OcH4rjzJfWrRs6SUGpkT4Ow5zUL3V8CqCAvC5ACW2hEQtKHEUDoERdDfaAEfJ c++Hipgjmu40WJUxeRHx49yjX8hljiMHNzKtlzfq+9R7E2333No/lgMga1LgU76flfL6 BMXv1PTqFebM0NpWWp6gJcjQ5ub8ynuEdIjN1EHmBxGXVm1IIp4DEZj1RceJAcH5L38J xkUqu7OhOimb5uLN10SgVxOreU3yEI+iHP9u6MEjGrLb+ZokDNhAZ6pHsKPC2WVKzuNg AJ1A== X-Forwarded-Encrypted: i=1; AL+hErGpPA5U58IZz4yfNCBCeHqk4QVw2ev5N5w9+KgVBMX3zTk/eNX8Mi5tZDXYV2vFCj7YMkqgVkHvHKq/5Fo=@vger.kernel.org X-Gm-Message-State: APuU4Z8lV9RUlZ1NK+xUcsoSZMX+5x7EWrX/2YCCu7jWpEzBVvmTQgo6 X9dCNMYfX5+tOBqEt1oU/OW+iUG711EgSVlNENMK1R19kBwXUSB1P8cuEVrtcpNP11fnXWVOkIM uLJ//SItCXWve+Rkb24Onu1YYvuIRVZBI9HelJHvoGa3XXYC0M8MD2jt0+VDrbkxtHV0= X-Gm-Gg: AZFdTZdwYc7KRM6zNnu95z5d9FkxE4UkGKOy5u2uXW7oDS8VXZYLnPo0Qz2qX49f6hh XdEn0YLfgtfvX+K9HZCDnESNLIMgsio0wWEYcuKOJwMYwTq56uJy8vOXZGhWzK9Kwu0+3m3cl4L 1QIxBWJcr9+5R1tNQRZAJkOEUetX+Ucjb4gCNcIoLEj1Zi6JNwWXha3e5xBYPPiSQXwoTSVyp6U AD7q/mzL5rM8Els7KQcVxXhx9xOaz2KmSMtbEA+nUSxmi82STxkN8yyX4FQQsmQcLAoDH3JUXb0 toj2vBd52lK5vBN+nuOQbq8tkOUQ0gSLkC08txpE0xL8n/1xkIFPuVTN6POR4bUQ3/ZTqvv/WsT tEyp09xEhY41dfjm7wDVkXujdcisaYmYsACsCUWKxyN7GF4ywUDZAJqy9QNqGZvguhP8xjw9L+B o6PbHLlOoO3EqgzVLv0owhTxMc9+/vamqMbYeg0UDRipyIv6Rrp9ON9UJ2oWxp8wEWY8eIRW7cE O9TJ19RiK0Ct9seMM9KxWfKhbgM X-Received: by 2002:a05:620a:4441:b0:949:3c50:134 with SMTP id af79cd13be357-94a82bdda54mr204396485a.33.1796379587668; Fri, 04 Dec 2026 02:19:47 -0800 (PST) X-Received: by 2002:a05:620a:4441:b0:949:3c50:134 with SMTP id af79cd13be357-94a82bdda54mr204392785a.33.1796379587156; Fri, 04 Dec 2026 02:19:47 -0800 (PST) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:2022:3328:5af7:2b49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbea2886f6sm48049005e9.8.2026.12.04.02.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:19:46 -0800 (PST) From: Loic Poulain Date: Fri, 04 Dec 2026 11:19:42 +0100 Subject: [PATCH v6 3/7] i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtime X-Mailing-List: linux-kernel@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: <20261204-cci-imp-v6-3-bed67559c66a@oss.qualcomm.com> References: <20261204-cci-imp-v6-0-bed67559c66a@oss.qualcomm.com> In-Reply-To: <20261204-cci-imp-v6-0-bed67559c66a@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-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA0MCBTYWx0ZWRfX12qZakE+Zfbr S5ecbAlxupIweE7tCeM0L6xk9JpYhMB4bOosf6pGmD2V2+jBsW2UkqJEVD2InUoaDF423uev03Z W0VJJdV3lU2O3JhhkPL7knr6BFE3lGsyqlVwvkU3Tsqed8qCYnaNMyRScs46UosA6OLOQJ7pkqa f2cMmkiThzx5qOOFKPIOVdsC5YY9YEBBZT0Dgp2ncEnDfGfnf4Z6laj8UQGWF5wOpY/w0Th/3I3 SwjNkoOZ7cXjTQp2UvQFVaudMnqDbysaJWCiuFv4BCwc7qPYooD5KAk41mkB3gXYoRTXKUqorCo 1a7GcK/fH9V0cTXpSnQMo1pKwRZlx8FTxCCXtjsxznmFN5Ioe9AhsbLMFNnHfostjdWLN6/1Y99 1VRRj3PgJUe2eOcZZuuhTabXa6q838qFGTO0cNCVo3g/Pi2KVtuuDeNlWXT6PIqT6/+uy82IqTD 7foIrBDzoJF40kWrEKA== X-Proofpoint-ORIG-GUID: T2Z3LbhlYfRgJn9KJWd-OcIqmmelkQxK X-Proofpoint-GUID: T2Z3LbhlYfRgJn9KJWd-OcIqmmelkQxK X-Authority-Analysis: v=2.4 cv=AOKPfg2Y c=1 sm=1 tr=0 ts=6b1293c4 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=8R-5LDRAFMUVkZqLBecA:9 a=QEXdDO2ut3YA:10 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA0MCBTYWx0ZWRfX6Z+oZc4m8+sm Dk6Sv834DXfzCT3ZBW8B+4A8jL2Taw1nz/zdsgQV25Ty+pQWmH49UX25T272I6+deOgPfKXGTxo MwtVPXfiAt/v0J0XgYhf++BY2LkASes= 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-12-04_01,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 spamscore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040040 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 f138ddb91e4d9e8f863865e7ad551e8e3c45d1b0..5265f0d1a234dcdf33a67032e31d735f5e32b1bf 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; @@ -848,7 +928,7 @@ static void cci_remove(struct platform_device *pdev) struct cci *cci = platform_get_drvdata(pdev); int i; - 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); cci_halt(cci, i); @@ -856,51 +936,20 @@ static void cci_remove(struct platform_device *pdev) } } -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