我是靠谱客的博主 着急灯泡,最近开发中收集的这篇文章主要介绍zynq,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1、背景介绍

最近在调试集群处理平台,模块上使用了支持IPMI的BMC控制芯片。该芯片与ZYNQ通过I2C总线相连,上面跑IPMB协议。ZYNQ作机箱管理,对所有BMC进行控制,而BMC再控制本模块的负载上下电。

 

2、问题描述

ZYNQ与BMC通过I2C总线进行数据传输,按照VITA46.11规范,要求机箱管理既能做I2C的master,也能做i2c slave(此时BMC做master),于是要求ZYNQ能进行I2C主从模式切换。ZYNQ PS端的I2C控制器作为master很容易,之前也通过I2C控制器配置1848交换芯片,不会的是如何让I2C控制器运行在slave模式。问了一下AVNET代理,发现他们也没搞过。在Xilinx论坛上面发帖,老外给了一个他们ZYNQ作为i2c从的测试例子(见链接),但帮助不大,唯一的帮助就是让我相信I2C控制器肯定支持slave模式。在xilinx wiki(链接)上面可以看到新发布的驱动版本已经支持了I2C slave mode。

 

3、解决思路

对i2c-cadence.c驱动进行了代码分析,发现CONFIG_I2C_SLAVE的宏定义随处可见,其中最重要的莫过于下面这个地方。

Cdns_reg_slave和cdns_unreg_slave这两个函数从字面意义来看明显是对寄存器配置成slave或unslave模式的意思。可惜在linux内核代码中完全没找到调用这两个函数的地方。

由此看来,需要手动添加这两个函数,可以在i2c-dev.c中修改ioctl部分的代码,如下图所示,把原来i2c_slave部分的代码修改为调用reg_slave。

在reg_slave中增加了对i2c控制器进行复位的操作

在set mode函数中,直接往i2c控制器写值,设置control寄存器、设置i2c地址(由于地址固定,这里写死为0x10)、启用收数中断。

当i2c控制器收到数之后,会调用上面函数,根据模式进入不同的中断处理函数。

完成这些操作后,编译得到内核,在应用中可以通过ioctl设置i2c的从模式了。

在i2c驱动的收数函数中增加了部分打印

程序执行打印如下。

4、拓展

实现了i2c从模式后,就可以进行主从模式切换了。切换需要使用unreg_slave,再次修改i2c-dev.c

在unreg_slave函数中设置了i2c的模式为主模式

需要注意的是,从模式切换到主模式时需要判断总线是否被占用,这里用一个函数加以判断

在应用中调用下面函数即可进行切换

5、总结

I2c算是比较简单的驱动,但是调试的过程中遇到一些问题靠软件是查不出来的,需要硬件抓信号,如果硬件有问题,软件再怎么努力也没用。所以以后遇到类似的情况,当软件再也查不出问题时,一定要让硬件查一查,否则必然是白白浪费时间。

6、相关代码

i2c-cadence.c


  1. /*
  2. * I2C bus driver for the Cadence I2C controller.
  3. *
  4. * Copyright (C) 2009 - 2014 Xilinx, Inc.
  5. *
  6. * This program is free software; you can redistribute it
  7. * and/or modify it under the terms of the GNU General Public
  8. * License as published by the Free Software Foundation;
  9. * either version 2 of the License, or (at your option) any
  10. * later version.
  11. */
  12. #include <linux/clk.h>
  13. #include <linux/delay.h>
  14. #include <linux/i2c.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/io.h>
  17. #include <linux/module.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/of.h>
  20. #include <linux/of_gpio.h>
  21. #include <linux/pm_runtime.h>
  22. #include <linux/pinctrl/consumer.h>
  23. #include <linux/ioctl.h>
  24. #include <linux/kernel.h>
  25. #include <linux/version.h>
  26. #include <linux/fs.h>
  27. #include <linux/cdev.h>
  28. #include <linux/device.h>
  29. #include <linux/errno.h>
  30. #include <asm/uaccess.h>
  31. #include "ring.h"
  32. //#include "query_ioctl.h"
  33. //DECLARE_RING(i2c_recv_ring, 256)
  34. ring_t i2c_recv_ring = { 0, 0, 256};
  35. //query_arg_t q;
  36. /* Register offsets for the I2C device. */
  37. #define CDNS_I2C_CR_OFFSET 0x00 /* Control Register, RW */
  38. #define CDNS_I2C_SR_OFFSET 0x04 /* Status Register, RO */
  39. #define CDNS_I2C_ADDR_OFFSET 0x08 /* I2C Address Register, RW */
  40. #define CDNS_I2C_DATA_OFFSET 0x0C /* I2C Data Register, RW */
  41. #define CDNS_I2C_ISR_OFFSET 0x10 /* IRQ Status Register, RW */
  42. #define CDNS_I2C_XFER_SIZE_OFFSET 0x14 /* Transfer Size Register, RW */
  43. #define CDNS_I2C_SLV_PAUSE_OFFSET 0x18 /* Transfer Size Register, RW */
  44. #define CDNS_I2C_TIME_OUT_OFFSET 0x1C /* Time Out Register, RW */
  45. #define CDNS_I2C_IMR_OFFSET 0x20 /* IRQ Mask Register, RO */
  46. #define CDNS_I2C_IER_OFFSET 0x24 /* IRQ Enable Register, WO */
  47. #define CDNS_I2C_IDR_OFFSET 0x28 /* IRQ Disable Register, WO */
  48. /* Control Register Bit mask definitions */
  49. #define CDNS_I2C_CR_SLVMON BIT(5) /* Slave monitor mode bit */
  50. #define CDNS_I2C_CR_HOLD BIT(4) /* Hold Bus bit */
  51. #define CDNS_I2C_CR_ACK_EN BIT(3)
  52. #define CDNS_I2C_CR_NEA BIT(2)
  53. #define CDNS_I2C_CR_MS BIT(1)
  54. /* Read or Write Master transfer 0 = Transmitter, 1 = Receiver */
  55. #define CDNS_I2C_CR_RW BIT(0)
  56. /* 1 = Auto init FIFO to zeroes */
  57. #define CDNS_I2C_CR_CLR_FIFO BIT(6)
  58. #define CDNS_I2C_CR_DIVA_SHIFT 14
  59. #define CDNS_I2C_CR_DIVA_MASK (3 << CDNS_I2C_CR_DIVA_SHIFT)
  60. #define CDNS_I2C_CR_DIVB_SHIFT 8
  61. #define CDNS_I2C_CR_DIVB_MASK (0x3f << CDNS_I2C_CR_DIVB_SHIFT)
  62. #define CDNS_I2C_CR_SLAVE_EN_MASK (CDNS_I2C_CR_CLR_FIFO |
  63. CDNS_I2C_CR_NEA |
  64. CDNS_I2C_CR_ACK_EN |
  65. CDNS_I2C_CR_MS)
  66. /* Status Register Bit mask definitions */
  67. #define CDNS_I2C_SR_BA BIT(8)
  68. #define CDNS_I2C_SR_TXDV BIT(6)
  69. #define CDNS_I2C_SR_RXDV BIT(5)
  70. #define CDNS_I2C_SR_RXRW BIT(3)
  71. /*
  72. * I2C Address Register Bit mask definitions
  73. * Normal addressing mode uses [6:0] bits. Extended addressing mode uses [9:0]
  74. * bits. A write access to this register always initiates a transfer if the I2C
  75. * is in master mode.
  76. */
  77. #define CDNS_I2C_ADDR_MASK 0x000003FF /* I2C Address Mask */
  78. /*
  79. * I2C Interrupt Registers Bit mask definitions
  80. * All the four interrupt registers (Status/Mask/Enable/Disable) have the same
  81. * bit definitions.
  82. */
  83. #define CDNS_I2C_IXR_ARB_LOST BIT(9)
  84. #define CDNS_I2C_IXR_RX_UNF BIT(7)
  85. #define CDNS_I2C_IXR_TX_OVF BIT(6)
  86. #define CDNS_I2C_IXR_RX_OVF BIT(5)
  87. #define CDNS_I2C_IXR_SLV_RDY BIT(4)
  88. #define CDNS_I2C_IXR_TO BIT(3)
  89. #define CDNS_I2C_IXR_NACK BIT(2)
  90. #define CDNS_I2C_IXR_DATA BIT(1)
  91. #define CDNS_I2C_IXR_COMP BIT(0)
  92. #define CDNS_I2C_IXR_ALL_INTR_MASK (CDNS_I2C_IXR_ARB_LOST |
  93. CDNS_I2C_IXR_RX_UNF |
  94. CDNS_I2C_IXR_TX_OVF |
  95. CDNS_I2C_IXR_RX_OVF |
  96. CDNS_I2C_IXR_SLV_RDY |
  97. CDNS_I2C_IXR_TO |
  98. CDNS_I2C_IXR_NACK |
  99. CDNS_I2C_IXR_DATA |
  100. CDNS_I2C_IXR_COMP)
  101. #define CDNS_I2C_IXR_ERR_INTR_MASK (CDNS_I2C_IXR_ARB_LOST |
  102. CDNS_I2C_IXR_RX_UNF |
  103. CDNS_I2C_IXR_TX_OVF |
  104. CDNS_I2C_IXR_RX_OVF |
  105. CDNS_I2C_IXR_NACK)
  106. #define CDNS_I2C_ENABLED_INTR_MASK (CDNS_I2C_IXR_ARB_LOST |
  107. CDNS_I2C_IXR_RX_UNF |
  108. CDNS_I2C_IXR_TX_OVF |
  109. CDNS_I2C_IXR_RX_OVF |
  110. CDNS_I2C_IXR_NACK |
  111. CDNS_I2C_IXR_DATA |
  112. CDNS_I2C_IXR_COMP)
  113. #define CDNS_I2C_IXR_SLAVE_INTR_MASK (CDNS_I2C_IXR_RX_UNF |
  114. CDNS_I2C_IXR_TX_OVF |
  115. CDNS_I2C_IXR_RX_OVF |
  116. CDNS_I2C_IXR_TO |
  117. CDNS_I2C_IXR_NACK |
  118. CDNS_I2C_IXR_DATA |
  119. CDNS_I2C_IXR_COMP)
  120. #define CDNS_I2C_TIMEOUT msecs_to_jiffies(1000)
  121. /* timeout for pm runtime autosuspend */
  122. #define CNDS_I2C_PM_TIMEOUT 1000 /* ms */
  123. #define CDNS_I2C_FIFO_DEPTH 16
  124. /* FIFO depth at which the DATA interrupt occurs */
  125. #define CDNS_I2C_DATA_INTR_DEPTH (CDNS_I2C_FIFO_DEPTH - 2)
  126. #define CDNS_I2C_MAX_TRANSFER_SIZE 255
  127. /* Transfer size in multiples of data interrupt depth */
  128. #define CDNS_I2C_TRANSFER_SIZE (CDNS_I2C_MAX_TRANSFER_SIZE - 3)
  129. #define DRIVER_NAME "cdns-i2c"
  130. #define CDNS_I2C_SPEED_MAX 400000
  131. #define CDNS_I2C_SPEED_DEFAULT 100000
  132. #define CDNS_I2C_DIVA_MAX 4
  133. #define CDNS_I2C_DIVB_MAX 64
  134. #define CDNS_I2C_TIMEOUT_MAX 0xFF
  135. #define CDNS_I2C_BROKEN_HOLD_BIT BIT(0)
  136. #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset)
  137. #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset)
  138. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  139. /**
  140. * enum cdns_i2c_mode - I2C Controller current operating mode
  141. *
  142. * @CDNS_I2C_MODE_SLAVE: I2C controller operating in slave mode
  143. * @CDNS_I2C_MODE_MASTER: I2C Controller operating in master mode
  144. */
  145. enum cdns_i2c_mode {
  146. CDNS_I2C_MODE_SLAVE,
  147. CDNS_I2C_MODE_MASTER,
  148. };
  149. /**
  150. * enum cdns_i2c_slave_mode - Slave state when I2C is operating in slave mode
  151. *
  152. * @CDNS_I2C_SLAVE_STATE_IDLE: I2C slave idle
  153. * @CDNS_I2C_SLAVE_STATE_SEND: I2C slave sending data to master
  154. * @CDNS_I2C_SLAVE_STATE_RECV: I2C slave receiving data from master
  155. */
  156. enum cdns_i2c_slave_state {
  157. CDNS_I2C_SLAVE_STATE_IDLE,
  158. CDNS_I2C_SLAVE_STATE_SEND,
  159. CDNS_I2C_SLAVE_STATE_RECV,
  160. };
  161. #endif
  162. /**
  163. * struct cdns_i2c - I2C device private data structure
  164. *
  165. * @dev: Pointer to device structure
  166. * @membase: Base address of the I2C device
  167. * @adap: I2C adapter instance
  168. * @p_msg: Message pointer
  169. * @err_status: Error status in Interrupt Status Register
  170. * @xfer_done: Transfer complete status
  171. * @p_send_buf: Pointer to transmit buffer
  172. * @p_recv_buf: Pointer to receive buffer
  173. * @send_count: Number of bytes still expected to send
  174. * @recv_count: Number of bytes still expected to receive
  175. * @curr_recv_count: Number of bytes to be received in current transfer
  176. * @irq: IRQ number
  177. * @input_clk: Input clock to I2C controller
  178. * @i2c_clk: Maximum I2C clock speed
  179. * @bus_hold_flag: Flag used in repeated start for clearing HOLD bit
  180. * @clk: Pointer to struct clk
  181. * @clk_rate_change_nb: Notifier block for clock rate changes
  182. * @quirks: flag for broken hold bit usage in r1p10
  183. * @ctrl_reg: Cached value of the control register.
  184. * @rinfo: Structure holding recovery information.
  185. * @pinctrl: Pin control state holder.
  186. * @pinctrl_pins_default: Default pin control state.
  187. * @pinctrl_pins_gpio: GPIO pin control state.
  188. * @slave: Registered slave instance.
  189. * @dev_mode: I2C operating role(master/slave).
  190. * @slave_state: I2C Slave state(idle/read/write).
  191. */
  192. struct cdns_i2c {
  193. struct device *dev;
  194. void __iomem *membase;
  195. struct i2c_adapter adap;
  196. struct i2c_msg *p_msg;
  197. int err_status;
  198. struct completion xfer_done;
  199. unsigned char *p_send_buf;
  200. unsigned char *p_recv_buf;
  201. unsigned int send_count;
  202. unsigned int recv_count;
  203. unsigned int curr_recv_count;
  204. int irq;
  205. unsigned long input_clk;
  206. unsigned int i2c_clk;
  207. unsigned int bus_hold_flag;
  208. struct clk *clk;
  209. struct notifier_block clk_rate_change_nb;
  210. u32 quirks;
  211. u32 ctrl_reg;
  212. struct i2c_bus_recovery_info rinfo;
  213. struct pinctrl *pinctrl;
  214. struct pinctrl_state *pinctrl_pins_default;
  215. struct pinctrl_state *pinctrl_pins_gpio;
  216. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  217. struct i2c_client *slave;
  218. enum cdns_i2c_mode dev_mode;
  219. enum cdns_i2c_slave_state slave_state;
  220. #endif
  221. };
  222. struct cdns_platform_data {
  223. u32 quirks;
  224. };
  225. static unsigned short i2c_rx_len= 1;
  226. #define to_cdns_i2c(_nb) container_of(_nb, struct cdns_i2c,
  227. clk_rate_change_nb)
  228. /**
  229. * cdns_i2c_clear_bus_hold - Clear bus hold bit
  230. * @id: Pointer to driver data struct
  231. *
  232. * Helper to clear the controller's bus hold bit.
  233. */
  234. static void cdns_i2c_clear_bus_hold(struct cdns_i2c *id)
  235. {
  236. u32 reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  237. if (reg & CDNS_I2C_CR_HOLD)
  238. cdns_i2c_writereg(reg & ~CDNS_I2C_CR_HOLD, CDNS_I2C_CR_OFFSET);
  239. }
  240. static inline bool cdns_is_holdquirk(struct cdns_i2c *id, bool hold_wrkaround)
  241. {
  242. return (hold_wrkaround &&
  243. (id->curr_recv_count == CDNS_I2C_FIFO_DEPTH + 1));
  244. }
  245. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  246. static void cdns_i2c_set_mode(enum cdns_i2c_mode mode, struct cdns_i2c *id)
  247. {
  248. u32 reg;
  249. /* Disable all interrupts */
  250. cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, CDNS_I2C_IDR_OFFSET);
  251. /* Clear FIFO and transfer size */
  252. cdns_i2c_writereg(CDNS_I2C_CR_CLR_FIFO, CDNS_I2C_CR_OFFSET);
  253. /* Update device mode and state */
  254. id->dev_mode = mode;
  255. id->slave_state = CDNS_I2C_SLAVE_STATE_IDLE;
  256. switch (mode) {
  257. case CDNS_I2C_MODE_MASTER:
  258. /* Enable i2c master */
  259. cdns_i2c_writereg(id->ctrl_reg, CDNS_I2C_CR_OFFSET);
  260. break;
  261. case CDNS_I2C_MODE_SLAVE:
  262. /* Enable i2c slave */
  263. reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  264. reg &= ~CDNS_I2C_CR_SLAVE_EN_MASK;
  265. //cdns_i2c_writereg(reg, CDNS_I2C_CR_OFFSET);
  266. cdns_i2c_writereg( 0x4c, CDNS_I2C_CR_OFFSET);
  267. /* Setting slave address */
  268. cdns_i2c_writereg( 0x10,CDNS_I2C_ADDR_OFFSET);
  269. /* Enable slave send/receive interrupts */
  270. cdns_i2c_writereg( 0x1| 0x2| 0x4| 0x8| 0x20| 0x80,CDNS_I2C_IER_OFFSET);
  271. break;
  272. }
  273. }
  274. static void cdns_i2c_slave_rcv_data(struct cdns_i2c *id)
  275. {
  276. u8 bytes;
  277. unsigned char data;
  278. static int num= 0;
  279. /* Prepare backend for data reception */
  280. if (id->slave_state == CDNS_I2C_SLAVE_STATE_IDLE) {
  281. id->slave_state = CDNS_I2C_SLAVE_STATE_RECV;
  282. //i2c_slave_event(id->slave, I2C_SLAVE_WRITE_REQUESTED, NULL);
  283. }
  284. /* Fetch number of bytes to receive */
  285. bytes = cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET);
  286. //printk("###zz debug###revc bytes is 0x%xn",bytes);
  287. /* Read data and send to backend */
  288. while (bytes--) {
  289. data = cdns_i2c_readreg(CDNS_I2C_DATA_OFFSET);
  290. if(num< 10)
  291. {
  292. printk( "0x%x ",data);
  293. }
  294. num++;
  295. if (( i2c_rx_len != 0) && ( i2c_rx_len < ring_free_size(&i2c_recv_ring)))
  296. ring_put_at_free_space(&i2c_recv_ring, data, i2c_rx_len++);
  297. //i2c_slave_event(id->slave, I2C_SLAVE_WRITE_RECEIVED, &data);
  298. }
  299. //printk("n");
  300. }
  301. static void cdns_i2c_slave_send_data(struct cdns_i2c *id)
  302. {
  303. u8 data;
  304. /* Prepare backend for data transmission */
  305. if (id->slave_state == CDNS_I2C_SLAVE_STATE_IDLE) {
  306. id->slave_state = CDNS_I2C_SLAVE_STATE_SEND;
  307. i2c_slave_event(id->slave, I2C_SLAVE_READ_REQUESTED, &data);
  308. } else {
  309. i2c_slave_event(id->slave, I2C_SLAVE_READ_PROCESSED, &data);
  310. }
  311. /* Send data over bus */
  312. cdns_i2c_writereg(data, CDNS_I2C_DATA_OFFSET);
  313. }
  314. /**
  315. * cdns_i2c_slave_isr - Interrupt handler for the I2C device in slave role
  316. * @ptr: Pointer to I2C device private data
  317. *
  318. * This function handles the data interrupt and transfer complete interrupt of
  319. * the I2C device in slave role.
  320. *
  321. * Return: IRQ_HANDLED always
  322. */
  323. static irqreturn_t cdns_i2c_slave_isr(void *ptr)
  324. {
  325. struct cdns_i2c *id = ptr;
  326. u8 byte0;
  327. unsigned int isr_status, i2c_status;
  328. /* Fetch the interrupt status */
  329. isr_status = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  330. cdns_i2c_writereg(isr_status, CDNS_I2C_ISR_OFFSET);
  331. /* Ignore masked interrupts */
  332. isr_status &= ~cdns_i2c_readreg(CDNS_I2C_IMR_OFFSET);
  333. /* Fetch transfer mode (send/receive) */
  334. i2c_status = cdns_i2c_readreg(CDNS_I2C_SR_OFFSET);
  335. /* Handle data send/receive */
  336. if (i2c_status & CDNS_I2C_SR_RXRW) {
  337. /* Send data to master */
  338. if (isr_status & CDNS_I2C_IXR_DATA)
  339. cdns_i2c_slave_send_data(id);
  340. if (isr_status & CDNS_I2C_IXR_COMP) {
  341. id->slave_state = CDNS_I2C_SLAVE_STATE_IDLE;
  342. //i2c_slave_event(id->slave, I2C_SLAVE_STOP, NULL);
  343. }
  344. } else {
  345. /* Receive data from master */
  346. if (isr_status & CDNS_I2C_IXR_DATA)
  347. cdns_i2c_slave_rcv_data(id);
  348. if (isr_status & CDNS_I2C_IXR_COMP) {
  349. cdns_i2c_slave_rcv_data(id);
  350. if ((i2c_rx_len < ring_free_size(&i2c_recv_ring)) && (i2c_rx_len != 0))
  351. {
  352. /* Store the len byte (byte 0) */
  353. byte0 = i2c_rx_len - 1;
  354. ring_put_at_free_space(&i2c_recv_ring, byte0, 0);
  355. ring_set_free_space_ptr(&i2c_recv_ring,ring_get_free_space_ptr(&i2c_recv_ring, i2c_rx_len));
  356. }
  357. i2c_rx_len = 1;
  358. id->slave_state = CDNS_I2C_SLAVE_STATE_IDLE;
  359. //i2c_slave_event(id->slave, I2C_SLAVE_STOP, NULL);
  360. }
  361. }
  362. /* Master indicated xfer stop or fifo underflow/overflow */
  363. if (isr_status & (CDNS_I2C_IXR_NACK | CDNS_I2C_IXR_RX_OVF |
  364. CDNS_I2C_IXR_RX_UNF | CDNS_I2C_IXR_TX_OVF)) {
  365. id->slave_state = CDNS_I2C_SLAVE_STATE_IDLE;
  366. //i2c_slave_event(id->slave, I2C_SLAVE_STOP, NULL);
  367. cdns_i2c_writereg(CDNS_I2C_CR_CLR_FIFO, CDNS_I2C_CR_OFFSET);
  368. }
  369. return IRQ_HANDLED;
  370. }
  371. #endif
  372. /**
  373. * cdns_i2c_master_isr - Interrupt handler for the I2C device in master role
  374. * @ptr: Pointer to I2C device private data
  375. *
  376. * This function handles the data interrupt, transfer complete interrupt and
  377. * the error interrupts of the I2C device in master role.
  378. *
  379. * Return: IRQ_HANDLED always
  380. */
  381. static irqreturn_t cdns_i2c_master_isr(void *ptr)
  382. {
  383. unsigned int isr_status, avail_bytes, updatetx;
  384. unsigned int bytes_to_send;
  385. bool hold_quirk;
  386. struct cdns_i2c *id = ptr;
  387. /* Signal completion only after everything is updated */
  388. int done_flag = 0;
  389. irqreturn_t status = IRQ_NONE;
  390. isr_status = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  391. cdns_i2c_writereg(isr_status, CDNS_I2C_ISR_OFFSET);
  392. /* Handling nack and arbitration lost interrupt */
  393. if (isr_status & (CDNS_I2C_IXR_NACK | CDNS_I2C_IXR_ARB_LOST)) {
  394. done_flag = 1;
  395. status = IRQ_HANDLED;
  396. }
  397. /*
  398. * Check if transfer size register needs to be updated again for a
  399. * large data receive operation.
  400. */
  401. updatetx = 0;
  402. if (id->recv_count > id->curr_recv_count)
  403. updatetx = 1;
  404. hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx;
  405. /* When receiving, handle data interrupt and completion interrupt */
  406. if (id->p_recv_buf &&
  407. ((isr_status & CDNS_I2C_IXR_COMP) ||
  408. (isr_status & CDNS_I2C_IXR_DATA))) {
  409. /* Read data if receive data valid is set */
  410. while (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) &
  411. CDNS_I2C_SR_RXDV) {
  412. /*
  413. * Clear hold bit that was set for FIFO control if
  414. * RX data left is less than FIFO depth, unless
  415. * repeated start is selected.
  416. */
  417. if ((id->recv_count < CDNS_I2C_FIFO_DEPTH) &&
  418. !id->bus_hold_flag)
  419. cdns_i2c_clear_bus_hold(id);
  420. *(id->p_recv_buf)++ =
  421. cdns_i2c_readreg(CDNS_I2C_DATA_OFFSET);
  422. id->recv_count--;
  423. id->curr_recv_count--;
  424. if (cdns_is_holdquirk(id, hold_quirk))
  425. break;
  426. }
  427. /*
  428. * The controller sends NACK to the slave when transfer size
  429. * register reaches zero without considering the HOLD bit.
  430. * This workaround is implemented for large data transfers to
  431. * maintain transfer size non-zero while performing a large
  432. * receive operation.
  433. */
  434. if (cdns_is_holdquirk(id, hold_quirk)) {
  435. /* wait while fifo is full */
  436. while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) !=
  437. (id->curr_recv_count - CDNS_I2C_FIFO_DEPTH))
  438. ;
  439. /*
  440. * Check number of bytes to be received against maximum
  441. * transfer size and update register accordingly.
  442. */
  443. if ((( int)(id->recv_count) - CDNS_I2C_FIFO_DEPTH) >
  444. CDNS_I2C_TRANSFER_SIZE) {
  445. cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE,
  446. CDNS_I2C_XFER_SIZE_OFFSET);
  447. id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE +
  448. CDNS_I2C_FIFO_DEPTH;
  449. } else {
  450. cdns_i2c_writereg(id->recv_count -
  451. CDNS_I2C_FIFO_DEPTH,
  452. CDNS_I2C_XFER_SIZE_OFFSET);
  453. id->curr_recv_count = id->recv_count;
  454. }
  455. } else if (id->recv_count && !hold_quirk &&
  456. !id->curr_recv_count) {
  457. /* Set the slave address in address register*/
  458. cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
  459. CDNS_I2C_ADDR_OFFSET);
  460. if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) {
  461. cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE,
  462. CDNS_I2C_XFER_SIZE_OFFSET);
  463. id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE;
  464. } else {
  465. cdns_i2c_writereg(id->recv_count,
  466. CDNS_I2C_XFER_SIZE_OFFSET);
  467. id->curr_recv_count = id->recv_count;
  468. }
  469. }
  470. /* Clear hold (if not repeated start) and signal completion */
  471. if ((isr_status & CDNS_I2C_IXR_COMP) && !id->recv_count) {
  472. if (!id->bus_hold_flag)
  473. cdns_i2c_clear_bus_hold(id);
  474. done_flag = 1;
  475. }
  476. status = IRQ_HANDLED;
  477. }
  478. /* When sending, handle transfer complete interrupt */
  479. if ((isr_status & CDNS_I2C_IXR_COMP) && !id->p_recv_buf) {
  480. /*
  481. * If there is more data to be sent, calculate the
  482. * space available in FIFO and fill with that many bytes.
  483. */
  484. if (id->send_count) {
  485. avail_bytes = CDNS_I2C_FIFO_DEPTH -
  486. cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET);
  487. if (id->send_count > avail_bytes)
  488. bytes_to_send = avail_bytes;
  489. else
  490. bytes_to_send = id->send_count;
  491. while (bytes_to_send--) {
  492. cdns_i2c_writereg(
  493. (*(id->p_send_buf)++),
  494. CDNS_I2C_DATA_OFFSET);
  495. id->send_count--;
  496. }
  497. } else {
  498. /*
  499. * Signal the completion of transaction and
  500. * clear the hold bus bit if there are no
  501. * further messages to be processed.
  502. */
  503. done_flag = 1;
  504. }
  505. if (!id->send_count && !id->bus_hold_flag)
  506. cdns_i2c_clear_bus_hold(id);
  507. status = IRQ_HANDLED;
  508. }
  509. /* Handling Slave monitor mode interrupt */
  510. if (isr_status & CDNS_I2C_IXR_SLV_RDY) {
  511. unsigned int ctrl_reg;
  512. /* Read control register */
  513. ctrl_reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  514. /* Disable slave monitor mode */
  515. ctrl_reg &= ~CDNS_I2C_CR_SLVMON;
  516. cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
  517. /* Clear interrupt flag for slvmon mode */
  518. cdns_i2c_writereg(CDNS_I2C_IXR_SLV_RDY, CDNS_I2C_IDR_OFFSET);
  519. done_flag = 1;
  520. status = IRQ_HANDLED;
  521. }
  522. /* Update the status for errors */
  523. id->err_status = isr_status & CDNS_I2C_IXR_ERR_INTR_MASK;
  524. if (id->err_status)
  525. status = IRQ_HANDLED;
  526. if (done_flag)
  527. complete(&id->xfer_done);
  528. return status;
  529. }
  530. /**
  531. * cdns_i2c_isr - Interrupt handler for the I2C device
  532. * @irq: irq number for the I2C device
  533. * @ptr: void pointer to cdns_i2c structure
  534. *
  535. * This function passes the control to slave/master based on current role of
  536. * i2c controller.
  537. *
  538. * Return: IRQ_HANDLED always
  539. */
  540. static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
  541. {
  542. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  543. struct cdns_i2c *id = ptr;
  544. switch (id->dev_mode) {
  545. case CDNS_I2C_MODE_SLAVE:
  546. //printk("###i2c slave interruptn");
  547. dev_dbg(&id->adap.dev, "slave interruptn");
  548. cdns_i2c_slave_isr(ptr);
  549. break;
  550. case CDNS_I2C_MODE_MASTER:
  551. dev_dbg(&id->adap.dev, "master interruptn");
  552. cdns_i2c_master_isr(ptr);
  553. break;
  554. default:
  555. dev_dbg(&id->adap.dev, "undefined interruptn");
  556. break;
  557. }
  558. #else
  559. cdns_i2c_master_isr(ptr);
  560. #endif
  561. //cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, CDNS_I2C_IDR_OFFSET);
  562. return IRQ_HANDLED;
  563. }
  564. /**
  565. * cdns_i2c_mrecv - Prepare and start a master receive operation
  566. * @id: pointer to the i2c device structure
  567. */
  568. static void cdns_i2c_mrecv(struct cdns_i2c *id)
  569. {
  570. unsigned int ctrl_reg;
  571. unsigned int isr_status;
  572. id->p_recv_buf = id->p_msg->buf;
  573. id->recv_count = id->p_msg->len;
  574. /* Put the controller in master receive mode and clear the FIFO */
  575. ctrl_reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  576. ctrl_reg |= CDNS_I2C_CR_RW | CDNS_I2C_CR_CLR_FIFO;
  577. if (id->p_msg->flags & I2C_M_RECV_LEN)
  578. id->recv_count = I2C_SMBUS_BLOCK_MAX + 1;
  579. id->curr_recv_count = id->recv_count;
  580. /*
  581. * Check for the message size against FIFO depth and set the
  582. * 'hold bus' bit if it is greater than FIFO depth.
  583. */
  584. if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
  585. ctrl_reg |= CDNS_I2C_CR_HOLD;
  586. cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
  587. /* Clear the interrupts in interrupt status register */
  588. isr_status = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  589. cdns_i2c_writereg(isr_status, CDNS_I2C_ISR_OFFSET);
  590. /*
  591. * The no. of bytes to receive is checked against the limit of
  592. * max transfer size. Set transfer size register with no of bytes
  593. * receive if it is less than transfer size and transfer size if
  594. * it is more. Enable the interrupts.
  595. */
  596. if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) {
  597. cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE,
  598. CDNS_I2C_XFER_SIZE_OFFSET);
  599. id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE;
  600. } else {
  601. cdns_i2c_writereg(id->recv_count, CDNS_I2C_XFER_SIZE_OFFSET);
  602. }
  603. /* Set the slave address in address register - triggers operation */
  604. cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
  605. cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
  606. CDNS_I2C_ADDR_OFFSET);
  607. /* Clear the bus hold flag if bytes to receive is less than FIFO size */
  608. if (!id->bus_hold_flag &&
  609. ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
  610. (id->recv_count <= CDNS_I2C_FIFO_DEPTH))
  611. cdns_i2c_clear_bus_hold(id);
  612. }
  613. /**
  614. * cdns_i2c_msend - Prepare and start a master send operation
  615. * @id: pointer to the i2c device
  616. */
  617. static void cdns_i2c_msend(struct cdns_i2c *id)
  618. {
  619. unsigned int avail_bytes;
  620. unsigned int bytes_to_send;
  621. unsigned int ctrl_reg;
  622. unsigned int isr_status;
  623. id->p_recv_buf = NULL;
  624. id->p_send_buf = id->p_msg->buf;
  625. id->send_count = id->p_msg->len;
  626. /* Set the controller in Master transmit mode and clear the FIFO. */
  627. ctrl_reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  628. ctrl_reg &= ~CDNS_I2C_CR_RW;
  629. ctrl_reg |= CDNS_I2C_CR_CLR_FIFO;
  630. /*
  631. * Check for the message size against FIFO depth and set the
  632. * 'hold bus' bit if it is greater than FIFO depth.
  633. */
  634. if (id->send_count > CDNS_I2C_FIFO_DEPTH)
  635. ctrl_reg |= CDNS_I2C_CR_HOLD;
  636. cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
  637. /* Clear the interrupts in interrupt status register. */
  638. isr_status = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  639. cdns_i2c_writereg(isr_status, CDNS_I2C_ISR_OFFSET);
  640. /*
  641. * Calculate the space available in FIFO. Check the message length
  642. * against the space available, and fill the FIFO accordingly.
  643. * Enable the interrupts.
  644. */
  645. avail_bytes = CDNS_I2C_FIFO_DEPTH -
  646. cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET);
  647. if (id->send_count > avail_bytes)
  648. bytes_to_send = avail_bytes;
  649. else
  650. bytes_to_send = id->send_count;
  651. while (bytes_to_send--) {
  652. cdns_i2c_writereg((*(id->p_send_buf)++), CDNS_I2C_DATA_OFFSET);
  653. id->send_count--;
  654. }
  655. /*
  656. * Clear the bus hold flag if there is no more data
  657. * and if it is the last message.
  658. */
  659. if (!id->bus_hold_flag && !id->send_count)
  660. cdns_i2c_clear_bus_hold(id);
  661. /* Set the slave address in address register - triggers operation. */
  662. cdns_i2c_writereg(CDNS_I2C_ENABLED_INTR_MASK, CDNS_I2C_IER_OFFSET);
  663. cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
  664. CDNS_I2C_ADDR_OFFSET);
  665. }
  666. /**
  667. * cdns_i2c_slvmon - Handling Slav monitor mode feature
  668. * @id: pointer to the i2c device
  669. */
  670. static void cdns_i2c_slvmon(struct cdns_i2c *id)
  671. {
  672. unsigned int ctrl_reg;
  673. unsigned int isr_status;
  674. id->p_recv_buf = NULL;
  675. id->p_send_buf = id->p_msg->buf;
  676. id->send_count = id->p_msg->len;
  677. /* Clear the interrupts in interrupt status register. */
  678. isr_status = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  679. cdns_i2c_writereg(isr_status, CDNS_I2C_ISR_OFFSET);
  680. /* Enable slvmon control reg */
  681. ctrl_reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  682. ctrl_reg |= CDNS_I2C_CR_MS | CDNS_I2C_CR_NEA | CDNS_I2C_CR_SLVMON
  683. | CDNS_I2C_CR_CLR_FIFO;
  684. ctrl_reg &= ~(CDNS_I2C_CR_RW);
  685. cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
  686. /* Initialize slvmon reg */
  687. cdns_i2c_writereg( 0xF, CDNS_I2C_SLV_PAUSE_OFFSET);
  688. /* Set the slave address to start the slave address transmission */
  689. cdns_i2c_writereg(id->p_msg->addr, CDNS_I2C_ADDR_OFFSET);
  690. /* Setup slvmon interrupt flag */
  691. cdns_i2c_writereg(CDNS_I2C_IXR_SLV_RDY, CDNS_I2C_IER_OFFSET);
  692. }
  693. /**
  694. * cdns_i2c_master_reset - Reset the interface
  695. * @adap: pointer to the i2c adapter driver instance
  696. *
  697. * This function cleanup the fifos, clear the hold bit and status
  698. * and disable the interrupts.
  699. */
  700. static void cdns_i2c_master_reset(struct i2c_adapter *adap)
  701. {
  702. struct cdns_i2c *id = adap->algo_data;
  703. u32 regval;
  704. /* Disable the interrupts */
  705. cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, CDNS_I2C_IDR_OFFSET);
  706. /* Clear the hold bit and fifos */
  707. regval = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  708. regval &= ~(CDNS_I2C_CR_HOLD | CDNS_I2C_CR_SLVMON);
  709. regval |= CDNS_I2C_CR_CLR_FIFO;
  710. cdns_i2c_writereg(regval, CDNS_I2C_CR_OFFSET);
  711. /* Update the transfercount register to zero */
  712. cdns_i2c_writereg( 0, CDNS_I2C_XFER_SIZE_OFFSET);
  713. /* Clear the interrupt status register */
  714. regval = cdns_i2c_readreg(CDNS_I2C_ISR_OFFSET);
  715. cdns_i2c_writereg(regval, CDNS_I2C_ISR_OFFSET);
  716. /* Clear the status register */
  717. regval = cdns_i2c_readreg(CDNS_I2C_SR_OFFSET);
  718. cdns_i2c_writereg(regval, CDNS_I2C_SR_OFFSET);
  719. }
  720. static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
  721. struct i2c_adapter *adap)
  722. {
  723. unsigned long time_left;
  724. u32 reg;
  725. id->p_msg = msg;
  726. id->err_status = 0;
  727. reinit_completion(&id->xfer_done);
  728. /* Check for the TEN Bit mode on each msg */
  729. reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  730. if (msg->flags & I2C_M_TEN) {
  731. if (reg & CDNS_I2C_CR_NEA)
  732. cdns_i2c_writereg(reg & ~CDNS_I2C_CR_NEA,
  733. CDNS_I2C_CR_OFFSET);
  734. } else {
  735. if (!(reg & CDNS_I2C_CR_NEA))
  736. cdns_i2c_writereg(reg | CDNS_I2C_CR_NEA,
  737. CDNS_I2C_CR_OFFSET);
  738. }
  739. /* Check for zero length - Slave monitor mode */
  740. if (msg->len == 0)
  741. cdns_i2c_slvmon(id);
  742. /* Check for the R/W flag on each msg */
  743. else if (msg->flags & I2C_M_RD)
  744. cdns_i2c_mrecv(id);
  745. else
  746. cdns_i2c_msend(id);
  747. /* Wait for the signal of completion */
  748. time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout);
  749. if (time_left == 0) {
  750. i2c_recover_bus(adap);
  751. cdns_i2c_master_reset(adap);
  752. dev_err(id->adap.dev.parent,
  753. "timeout waiting on completionn");
  754. return -ETIMEDOUT;
  755. }
  756. cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK,
  757. CDNS_I2C_IDR_OFFSET);
  758. /* If it is bus arbitration error, try again */
  759. if (id->err_status & CDNS_I2C_IXR_ARB_LOST)
  760. return -EAGAIN;
  761. return 0;
  762. }
  763. /**
  764. * cdns_i2c_master_xfer - The main i2c transfer function
  765. * @adap: pointer to the i2c adapter driver instance
  766. * @msgs: pointer to the i2c message structure
  767. * @num: the number of messages to transfer
  768. *
  769. * Initiates the send/recv activity based on the transfer message received.
  770. *
  771. * Return: number of msgs processed on success, negative error otherwise
  772. */
  773. static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
  774. int num)
  775. {
  776. int ret, count;
  777. u32 reg;
  778. struct cdns_i2c *id = adap->algo_data;
  779. bool hold_quirk;
  780. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  781. bool change_role = false;
  782. #endif
  783. ret = pm_runtime_get_sync(id->dev);
  784. if (ret < 0)
  785. return ret;
  786. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  787. /* Check i2c operating mode and switch if possible */
  788. if (id->dev_mode == CDNS_I2C_MODE_SLAVE) {
  789. if (id->slave_state != CDNS_I2C_SLAVE_STATE_IDLE)
  790. return -EAGAIN;
  791. /* Set mode to master */
  792. cdns_i2c_set_mode(CDNS_I2C_MODE_MASTER, id);
  793. /* Mark flag to change role once xfer is completed */
  794. change_role = true;
  795. }
  796. #endif
  797. /* Check if the bus is free */
  798. if (msgs->len)
  799. if (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) & CDNS_I2C_SR_BA) {
  800. ret = -EAGAIN;
  801. goto out;
  802. }
  803. hold_quirk = !!(id->quirks & CDNS_I2C_BROKEN_HOLD_BIT);
  804. /*
  805. * Set the flag to one when multiple messages are to be
  806. * processed with a repeated start.
  807. */
  808. if (num > 1) {
  809. /*
  810. * This controller does not give completion interrupt after a
  811. * master receive message if HOLD bit is set (repeated start),
  812. * resulting in SW timeout. Hence, if a receive message is
  813. * followed by any other message, an error is returned
  814. * indicating that this sequence is not supported.
  815. */
  816. for (count = 0; (count < num - 1 && hold_quirk); count++) {
  817. if (msgs[count].flags & I2C_M_RD) {
  818. dev_warn(adap->dev.parent,
  819. "Can't do repeated start after a receive messagen");
  820. ret = -EOPNOTSUPP;
  821. goto out;
  822. }
  823. }
  824. id->bus_hold_flag = 1;
  825. reg = cdns_i2c_readreg(CDNS_I2C_CR_OFFSET);
  826. reg |= CDNS_I2C_CR_HOLD;
  827. cdns_i2c_writereg(reg, CDNS_I2C_CR_OFFSET);
  828. } else {
  829. id->bus_hold_flag = 0;
  830. }
  831. /* Process the msg one by one */
  832. for (count = 0; count < num; count++, msgs++) {
  833. if (count == (num - 1))
  834. id->bus_hold_flag = 0;
  835. ret = cdns_i2c_process_msg(id, msgs, adap);
  836. if (ret)
  837. goto out;
  838. /* Report the other error interrupts to application */
  839. if (id->err_status) {
  840. cdns_i2c_master_reset(adap);
  841. if (id->err_status & CDNS_I2C_IXR_NACK) {
  842. ret = -ENXIO;
  843. goto out;
  844. }
  845. ret = -EIO;
  846. goto out;
  847. }
  848. }
  849. ret = num;
  850. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  851. /* Switch i2c mode to slave */
  852. if (change_role)
  853. cdns_i2c_set_mode(CDNS_I2C_MODE_SLAVE, id);
  854. #endif
  855. out:
  856. pm_runtime_mark_last_busy(id->dev);
  857. pm_runtime_put_autosuspend(id->dev);
  858. return ret;
  859. }
  860. /**
  861. * cdns_i2c_func - Returns the supported features of the I2C driver
  862. * @adap: pointer to the i2c adapter structure
  863. *
  864. * Return: 32 bit value, each bit corresponding to a feature
  865. */
  866. static u32 cdns_i2c_func(struct i2c_adapter *adap)
  867. {
  868. u32 func = I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR |
  869. (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) |
  870. I2C_FUNC_SMBUS_BLOCK_DATA;
  871. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  872. func |= I2C_FUNC_SLAVE;
  873. #endif
  874. return func;
  875. }
  876. static int cdns_i2c_bus_busy(struct cdns_i2c *id)
  877. {
  878. u32 StatusReg;
  879. int Status;
  880. StatusReg = cdns_i2c_readreg(CDNS_I2C_SR_OFFSET);
  881. if ((StatusReg & CDNS_I2C_SR_BA) != 0x0U)
  882. {
  883. Status = 0;
  884. }
  885. else
  886. {
  887. Status = -1;
  888. }
  889. return Status;
  890. }
  891. #if IS_ENABLED(CONFIG_I2C_SLAVE)
  892. static int cdns_reg_slave(struct i2c_client *slave)
  893. {
  894. int ret;
  895. struct cdns_i2c *id = container_of(slave->adapter, struct cdns_i2c,adap);
  896. if (id->slave)

最后

以上就是着急灯泡为你收集整理的zynq的全部内容,希望文章能够帮你解决zynq所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部