249 110 231KB
English Pages 12 Year 2011
LY M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
I2C Customer Document
Version: Release date:
1.0 2011-04-22
© 2008 - 2011 MediaTek Inc. This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
FO
Specifications are subject to change without notice.
LY
MT6573 Chip Name Confidential B
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Document Revision History
Revision
FO
0.1
Date
Author
2011-04-22
Changlei Gao
MediaTek Confidential
Description Initial Draft
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 2 of 12
LY
MT6573 Chip Name Confidential B
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Table of Contents
Document Revision History .................................................................................................................. 2 Table of Contents................................................................................................................................... 3 1
Introduction................................................................................................................................... 4 1.1
1.2 1.3 1.4
2
Design............................................................................................................................................ 5 2.1
3
Software/Hardware Environment.......................................................................................... 4 1.1.1 Software Environment .......................................................................................... 4 1.1.2 Hardware Environment......................................................................................... 4 Functionality.......................................................................................................................... 4 Hardware background .......................................................................................................... 4 Hardware Component used in this driver ............................................................................. 4 Architecture and flow ............................................................................................................ 5
Interface......................................................................................................................................... 6 3.1
3.2
Data structures ..................................................................................................................... 6 3.1.1 i2c_driver .............................................................................................................. 6 3.1.2 i2c_client .............................................................................................................. 7 3.1.3 i2c_msg ................................................................................................................ 7 Functions .............................................................................................................................. 8 3.2.1 i2c_add_driver...................................................................................................... 8 3.2.2 i2c_del_driver ....................................................................................................... 8 3.2.3 i2c_probe.............................................................................................................. 8 3.2.4 i2c_master_send .................................................................................................. 9 3.2.5 i2c_master_recv ................................................................................................... 9 3.2.6 i2c_transfer........................................................................................................... 9
4
Customization............................................................................................................................. 10
5
Build............................................................................................................................................. 12 5.1 5.2
Source Code Structure & File Description.......................................................................... 12 Build Option ........................................................................................................................ 12
Lists of Tables and Figures Error! No table of figures entries found.
FO
錯誤! 找不到圖表目錄。
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 3 of 12
LY
MT6573 Chip Name Confidential B
Introduction
1.1
Software/Hardware Environment
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
1
1.1.1
Software Environment
Driver discussed in this document is designed based on Linux Kernel 2.6.32 and Android 2.3.
1.1.2
Hardware Environment
Driver discussed in this document can run on the devices with MT6573.
1.2 (1) (2) (3) (4)
Functionality
I2C compliant master mode operation Adjustable clock speed for LS/FS mode operation 7/10 bit addressing PIO/DMA transfer mode
1.3
Hardware background
I2C (Inter-IC) is a two wire serial interface. The two signals are SCL and SDA. SCL is a clock signal that is driven by the master. SDA is a bi-directional data signal that can be driven by either the master or the slave.
Figure 1-1 I2C timing diagram
1.4
Hardware Component used in this driver
It’s part of MT6573 chip. Normal transfer timing : set data rate.
4.2
Examples
4.2.1
Filter out error message
client->addr |= I2C_A_FILTER_MSG; i2c_master_send(client, buf, count);
4.2.2
Adjust timing
client->timing = 400; // 400Kbit/s transfer. If you do not use this to adjust timing, the default data rate is 100Kbit/s. i2c_master_send(client, buf, count);
FO
4.2.3
Start DMA mode
client->addr |= I2C_DMA_FLAG; MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 10 of 12
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
i2c_master_send(client, physical buffer address, count);
LY
MT6573 Chip Name Confidential B
4.2.4
Start Write & Read mode
client->addr |= I2C_WR_FLAG; i2c_master_send(client, buf, (1addr |= I2C_ENEXT_FLAG; i2c_master_send(client, buf, count);
4.2.7
Return to normal transfer
FO
client->addr &= I2C_MASK_FLAG; i2c_master_send(client, buf, count);
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 11 of 12
LY
MT6573 Chip Name Confidential B
Build
5.1
Source Code Structure & File Description
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
5
File
Description
alps/kernel/include/linux i2c.h
The header file of I2C APIs and their related data structures
alps/kernel/drive/i2c i2c-core.c
5.2
The implementations of core I2C APIs.
Build Option
FO
N/A
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 12 of 12