<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[t113 i2c 总线时钟调节不起作用]]></title><description><![CDATA[<p dir="auto">mangopi dual 的板子，调试触摸屏的时候发现tw2 i2c 调节不生效，无论输入400K还是100K，实际都以1.2M左右运行，查看 /sys目录下和 /proc 目录下i2c 节点的频率都已经是修改过的频率了，请问是否是i2c总线驱动的问题？ 使用的是buidlroot<br />
设备树：</p>
<pre><code>&amp;twi2 {
clock-frequency = &lt;400000&gt;;
pinctrl-0 = &lt;&amp;twi2_pins_a&gt;;
pinctrl-1 = &lt;&amp;twi2_pins_b&gt;;
pinctrl-names = "default", "sleep";
twi_drv_used = &lt;1&gt;;
dmas = &lt;&amp;dma 45&gt;, &lt;&amp;dma 45&gt;;
dma-names = "tx", "rx";
status = "okay";
ctp@14 {
compatible = "allwinner,goodix，gt911";
device_type = "ctp";
reg = &lt;0x14&gt;;
status = "disabled";
ctp_name = "gt9xxnew_ts";
ctp_twi_id = &lt;0x2&gt;;
ctp_twi_addr = &lt;0x14&gt;;
ctp_screen_max_x = &lt;0x320&gt;;
ctp_screen_max_y = &lt;0x1e0&gt;;
ctp_revert_x_flag = &lt;0x0&gt;;
ctp_revert_y_flag = &lt;0x0&gt;;
ctp_exchange_x_y_flag = &lt;0x0&gt;;
ctp_int_port = &lt;&amp;pio PB 2 GPIO_ACTIVE_HIGH&gt;;
ctp_wakeup = &lt;&amp;pio PB 3 GPIO_ACTIVE_HIGH&gt;;
/ctp-supply = &lt;&amp;reg_aldo2&gt;;/
/ctp_power_ldo = &lt;&amp;reg_aldo2&gt;;/
/ctp_power_ldo_vol = &lt;3300&gt;;/
};
};
</code></pre>
]]></description><link>https://bbs.aw-ol.com/topic/1500/t113-i2c-总线时钟调节不起作用</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 19:30:46 GMT</lastBuildDate><atom:link href="https://bbs.aw-ol.com/topic/1500.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 May 2022 21:51:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Thu, 09 Jun 2022 15:06:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/1081">@duowei1987</a> ，谢谢！我对比下看看这两个版本的文件有什么不一样。</p>
]]></description><link>https://bbs.aw-ol.com/post/7582</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7582</guid><dc:creator><![CDATA[efancier]]></dc:creator><pubDate>Thu, 09 Jun 2022 15:06:56 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Thu, 09 Jun 2022 13:54:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/866">@efancier</a> 将longan的i2c-sunxi.c和i2c-sunxi.h更换为tina linux的文件就可以了，测试过i2c正常</p>
]]></description><link>https://bbs.aw-ol.com/post/7578</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7578</guid><dc:creator><![CDATA[duowei1987]]></dc:creator><pubDate>Thu, 09 Jun 2022 13:54:06 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Tue, 07 Jun 2022 16:32:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/472">@suitjune</a> , 用的这个构建的：<br />
<a href="https://github.com/YuzukiHD/Buildroot-YuzukiSBC" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/YuzukiHD/Buildroot-YuzukiSBC</a></p>
]]></description><link>https://bbs.aw-ol.com/post/7519</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7519</guid><dc:creator><![CDATA[efancier]]></dc:creator><pubDate>Tue, 07 Jun 2022 16:32:27 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Tue, 07 Jun 2022 13:16:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/866">@efancier</a> 啥意思？longan sdk不都有自己的SDK的内核？你是指内核是buildroot编译出来的？</p>
]]></description><link>https://bbs.aw-ol.com/post/7516</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7516</guid><dc:creator><![CDATA[suitjune]]></dc:creator><pubDate>Tue, 07 Jun 2022 13:16:16 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Tue, 07 Jun 2022 12:46:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/472">@suitjune</a> ,是buildroot编译的吗？</p>
]]></description><link>https://bbs.aw-ol.com/post/7513</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7513</guid><dc:creator><![CDATA[efancier]]></dc:creator><pubDate>Tue, 07 Jun 2022 12:46:26 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Tue, 07 Jun 2022 01:00:27 GMT]]></title><description><![CDATA[<p dir="auto">我又试了试，可以400K I2C频率啊，longan sdk.</p>
]]></description><link>https://bbs.aw-ol.com/post/7495</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7495</guid><dc:creator><![CDATA[suitjune]]></dc:creator><pubDate>Tue, 07 Jun 2022 01:00:27 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Mon, 06 Jun 2022 14:05:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/1081">@duowei1987</a>， 多谢确认这个问题，这个坑也太大了，我试试Tina的 I2c 总线驱动看能不能解决这个问题，现在的方案是用GPIO模拟，速度能到100K左右，暂时对付着驱动GT触摸屏</p>
]]></description><link>https://bbs.aw-ol.com/post/7488</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7488</guid><dc:creator><![CDATA[efancier]]></dc:creator><pubDate>Mon, 06 Jun 2022 14:05:17 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Sat, 04 Jun 2022 14:25:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/1081">@duowei1987</a> longan sdk是不是有问题，我用PD20 PD21都调不出来I2C。。。。</p>
]]></description><link>https://bbs.aw-ol.com/post/7448</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7448</guid><dc:creator><![CDATA[suitjune]]></dc:creator><pubDate>Sat, 04 Jun 2022 14:25:10 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Sat, 04 Jun 2022 13:22:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/866">@efancier</a> 在longan下确实是这种情况，而在tina下i2c就是正常的，我也不清楚原因</p>
]]></description><link>https://bbs.aw-ol.com/post/7444</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7444</guid><dc:creator><![CDATA[duowei1987]]></dc:creator><pubDate>Sat, 04 Jun 2022 13:22:22 GMT</pubDate></item><item><title><![CDATA[Reply to t113 i2c 总线时钟调节不起作用 on Sat, 04 Jun 2022 13:42:46 GMT]]></title><description><![CDATA[<p dir="auto">追踪到驱动程序里面的寄存器读写了，发现这句话<br />
writel(reg_val, i2c-&gt;base_addr + reg_clk);<br />
无论往寄存器里面写什么值，i2c 输出时钟频率都不变，可能是写入的值需要符合一定的组合，或者寄存器地址根本就不对？还是硬件有Bug? 原厂的技术工程师能否帮忙看一下</p>
<pre><code>static void sunxi_i2c_clk_write_reg(struct sunxi_i2c *i2c, unsigned int reg_clk,
		unsigned int sclk_freq,
		unsigned char clk_m, unsigned char clk_n,
		unsigned int mask_clk_m, unsigned int mask_clk_n)
{
	unsigned int reg_val = readl(i2c-&gt;base_addr + reg_clk);

#if IS_ENABLED(CONFIG_ARCH_SUN50IW10)
	unsigned int duty;
#endif
	dev_dbg(i2c-&gt;dev, "reg_clk = 0x%x, clk_m = %u, clk_n = %u,"
		"mask_clk_m = %x, mask_clk_n = %x\n",
		reg_clk, clk_m, clk_n, mask_clk_m, mask_clk_n);
	if (reg_clk == TWI_DRIVER_BUSC) {
		reg_val &amp;= ~(mask_clk_m | mask_clk_n);
		reg_val |= ((clk_m | (clk_n &lt;&lt; 4)) &lt;&lt; 8);
#if IS_ENABLED(CONFIG_ARCH_SUN50IW10)
		duty = TWI_DRV_CLK_DUTY;
		if (sclk_freq &gt; STANDDARD_FREQ)
			reg_val |= duty;
		else
			reg_val &amp;= ~duty;
#endif
		writel(reg_val, i2c-&gt;base_addr + reg_clk);
		dev_dbg(i2c-&gt;dev, "reg: 0x%x value: 0x%x\n",
			reg_clk, readl(i2c-&gt;base_addr + reg_clk));
		printk("\n clk reg val:%d - reg:%d, m -n %d-%d",reg_val,i2c-&gt;base_addr + reg_clk, clk_m, clk_n);
	} else {
		reg_val &amp;= ~(mask_clk_m | mask_clk_n);
		reg_val |= ((clk_m  &lt;&lt; 3) | clk_n);
#if IS_ENABLED(CONFIG_ARCH_SUN50IW10)
		duty = TWI_CLK_DUTY;
		if (sclk_freq &gt; STANDDARD_FREQ)
			reg_val |= duty;
		else
			reg_val &amp;= ~duty;
#endif
		writel(reg_val, i2c-&gt;base_addr + reg_clk);
		
		dev_dbg(i2c-&gt;dev, "reg: 0x%x value: 0x%x\n",
			reg_clk, readl(i2c-&gt;base_addr + reg_clk));
	}
}
</code></pre>
]]></description><link>https://bbs.aw-ol.com/post/7382</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/7382</guid><dc:creator><![CDATA[efancier]]></dc:creator><pubDate>Sat, 04 Jun 2022 13:42:46 GMT</pubDate></item></channel></rss>