I2C系統時鐘rx-8025板卡實際應用

來源:互聯網
上載者:User

標籤:more   its   span   src   dev   程式   --   sse   info   

rx-8025是片外I2C系統時鐘,其應用於9260板卡方法如下。總體思想是配置核心添加驅動(I2C驅動,核心已提供的很完備),板級檔案添加裝置,添加裝置檔案以應用程式操作。

1. 配置核心

1)I2C支援(可選擇debug資訊)。

2)I2Chw選擇gpio作為I2C硬體。

3)不選擇片上RTT,選擇晶片RX-8025。

其中rtc0為裝置啟動時鐘。

2. 添加裝置

/arch/arm/mach-at91/board-sam9260ek.c中添加以下語句:
static struct i2c_board_info __initdata ek_i2c_devices[] = {
{
I2C_BOARD_INFO("24c512", 0x50),
.platform_data = &at24c512,
},
/* more devices can be added using expansion connectors */
/* Added for R8025 rtc 20120914 */
{
I2C_BOARD_INFO("rx8025", 0x32),
}
};

----------------------------------------------------------------------------------------------------------

/**
* I2C_BOARD_INFO - macro used to list an i2c device and its address
* @dev_type: identifies the device type
* @dev_addr: the device‘s address on the bus.
*
* This macro initializes essential fields of a struct i2c_board_info,
* declaring what has been provided on a particular board. Optional
* fields (such as associated irq, or device-specific platform_data)
* are provided using conventional syntax.
*/
#define I2C_BOARD_INFO(dev_type, dev_addr) \
.type = dev_type, .addr = (dev_addr)

 

/driver/rtc/rtc-s1370.c

static const struct i2c_device_id ds1307_id[] = {
{ "ds1307", ds_1307 },
{ "ds1337", ds_1337 },
{ "ds1338", ds_1338 },
{ "ds1339", ds_1339 },
{ "ds1340", ds_1340 },
{ "m41t00", m41t00 },
{ "rx8025", rx_8025 },
{ }
};

註:I2C_BOARD_INFO()中,第一項為type,第二項為addr,

      dev_type必須與驅動中i2c_device_id數組中name匹配,其也是I2C裝置與驅動匹配的基礎。

3. 建立裝置檔案

在根檔案系統中,建立裝置檔案

mknod  /dev/rtc0 c 10 135

註:rtc0與核心配置啟動時鐘吻合。

4. 編譯核心,查看啟動資訊。

I2C系統時鐘rx-8025板卡實際應用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.