Skip to contentSkip to conversation

Writing new driver for FM3104 on Cirrus 9301 processor

DISCUSSION Benny Chen 2 participants 2 messages May 19, 2005

lore
Share & tools
lore

Benny Chen

author
#0 lore raw

Hi Guys,
I have gone through much of the doco and really need your help. I am about to embark on writing a driver for the RTC and Watch Dog timer for our system. I have some questions and hopefully you can help.

In our system, the FM3104 chip?s SCL and SDA line are connected to the EECLK and EESDA (like GPIO) line on the processor. Hence, I would need to use some bit bang algo to talk to the chip. But I would want to maximise the use of existing code in the i2c directory but don?t know what I should be writing.

1. For both the RTC and Watch dog drivers, do I need to write both the
adapter driver and Driver driver or just a driver like the ds1307.c?
2. Which existing src would be a good template for me?
3. The DS1307. c code, it do not have an i2c_adapter structure defined,
Hence, how do it knows what algo it would use to talk to the DS1307 chip?

Thank you so much for your help.

Regards,

Benny Chen
R & D Firmware Engineer

RTUnet Pty Ltd
Innovation Centre
90 Sippy Downs Drive
Sippy Downs Qld
4556

Phone +61 7 54594560
Fax +61 7 54594563

Signature · 7 lines
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 12/04/2005
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050413/6fd5f2d7/attachment.html
#1 lore raw
Quoted 10 lines · Benny Chen

Hi Guys,
I have gone through much of the doco and really need your help. I am about to embark on writing a driver for the RTC and Watch Dog timer for our system. I have some questions and hopefully you can help.

In our system, the FM3104 chip?s SCL and SDA line are connected to the EECLK and EESDA (like GPIO) line on the processor. Hence, I would need to use some bit bang algo to talk to the chip. But I would want to maximise the use of existing code in the i2c directory but don?t know what I should be writing.

There is already an existing EP93xx GPIO I2C adapter driver present in linux-cirrus-2.6 (I am unsure about 2.4). I can verify it works on EP9301, EP9312, and EP9315. Yes, it uses the bit-bang algo.

http://members.inode.at/m.burian/ep93xx/index.html

Quoted 2 lines

1. For both the RTC and Watch dog drivers, do I need to write both the
adapter driver and Driver driver or just a driver like the ds1307.c?

Most likely, just the client driver.

Quoted 1 line

2. Which existing src would be a good template for me?

ds1337.c looks to be a fairly good example of implementing an integrated i2c client / character driver.

Quoted 2 lines

3. The DS1307. c code, it do not have an i2c_adapter structure defined,
Hence, how do it knows what algo it would use to talk to the DS1307 chip?

Read and understand "Attaching to an adapter" and "The detect client function" in Documentation/i2c/writing-clients. The algorithm used is a property of the adapter itself.

-Cory

Signature · 11 lines
Cory T. Tusar
Embedded Systems Engineer
Videon Central, Inc.
2171 Sandy Drive
State College, PA 16801
(814) 235-1111 x316
(814) 235-1118 fax

"Debugging is twice as hard as writing the code in the first place.
   Therefore, if you write the code as cleverly as possible, you are,
     by definition, not smart enough to debug it."  --Brian W. Kernighan