From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from twmbx01.aspeedtech.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06E13348866; Thu, 28 May 2026 07:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779954116; cv=none; b=aFNCSinsUGIIl29b7NuCbNTK/SpxV83+uORA1U/ZVVGul/DwLjdl6F1zN2lIL9/yI8U1/cZE0rMLNy9vISQoCtYaOf051Zsf91hEjGOjiGRP0MxUzrlfu3X8nkMGRlD5+rMLgQoOhJnfAetj2Pc6ci01XQiUXvm8v5R27gZ/BhY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779954116; c=relaxed/simple; bh=hbcoVNA5J1bXCVOt2Zyea4rZOSjPJ+N0iRWHM0ixkfc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nERqaCXkC+HxqKN/3ErSeiKoOI3eId6ytcfneiBnHL4Uy4Qy81DN/bBxZF6hrntLjrASW5iJ+Ef+3xzZdGYsvzk00L/gdHHHdI2IoAfWJYNf9/9ugNp796rKaM9SPXt6E3ceXUxajqWoyAjXCmM3ZKxuIJ2R/Q5vtqnb6gwwtZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Thu, 28 May 2026 15:41:37 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Thu, 28 May 2026 15:41:37 +0800 From: Ryan Chen Date: Thu, 28 May 2026 15:41:37 +0800 Subject: [PATCH v30 2/5] i2c: aspeed: Read clock-frequency via i2c_parse_fw_timings() Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20260528-upstream_i2c-v30-2-5d4f9adc3530@aspeedtech.com> References: <20260528-upstream_i2c-v30-0-5d4f9adc3530@aspeedtech.com> In-Reply-To: <20260528-upstream_i2c-v30-0-5d4f9adc3530@aspeedtech.com> To: , , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Joel Stanley , Andrew Jeffery , "Benjamin Herrenschmidt" , Rayn Chen , Philipp Zabel CC: , , , , , , Ryan Chen X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779954097; l=1911; i=ryan_chen@aspeedtech.com; s=20251126; h=from:subject:message-id; bh=hbcoVNA5J1bXCVOt2Zyea4rZOSjPJ+N0iRWHM0ixkfc=; b=gsEAEdAMg6ck7BILVXtkvLp4+x/SBtdIry5jRBvDvmGpqolpVUJxoP/fpsw22To1Ebn1gc+9i smg9HKz/KRKC80eKp9el0e/KYQuiLGhMaBtwMUxhFRyFg1VskPtGb0x X-Developer-Key: i=ryan_chen@aspeedtech.com; a=ed25519; pk=Xe73xY6tcnkuRjjbVAB/oU30KdB3FvG4nuJuILj7ZVc= Use i2c_parse_fw_timings() to read the standard "clock-frequency" property, and fall back to "bus-frequency" only when the standard property is absent. This honors device trees written against the updated aspeed,ast2600-i2c binding without silently falling back to 100 kHz, while keeping existing in-tree device trees using "bus-frequency" working. Signed-off-by: Ryan Chen --- drivers/i2c/busses/i2c-aspeed.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index a26b74c71206..137889e57ddc 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -1000,6 +1000,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) const struct of_device_id *match; struct aspeed_i2c_bus *bus; struct clk *parent_clk; + struct i2c_timings timings; int irq, ret; bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); @@ -1025,12 +1026,18 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev) } reset_control_deassert(bus->rst); - ret = of_property_read_u32(pdev->dev.of_node, - "bus-frequency", &bus->bus_frequency); - if (ret < 0) { - dev_err(&pdev->dev, - "Could not read bus-frequency property\n"); - bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ; + i2c_parse_fw_timings(&pdev->dev, &timings, false); + if (timings.bus_freq_hz) { + bus->bus_frequency = timings.bus_freq_hz; + } else { + ret = of_property_read_u32(pdev->dev.of_node, + "bus-frequency", + &bus->bus_frequency); + if (ret < 0) { + dev_err(&pdev->dev, + "Could not read clock-frequency or bus-frequency property\n"); + bus->bus_frequency = I2C_MAX_STANDARD_MODE_FREQ; + } } match = of_match_node(aspeed_i2c_bus_of_table, pdev->dev.of_node); -- 2.34.1