Hi all,

i found an error in my resources struct, and i finally have the driver set 
loaded,

Still seems i cannot get valid bytes from RTC ds1338. I probably have some HW 
issue.

i2c i2c-0: master_xfer[0] W, addr=0x68, len=1
i2c i2c-0: master_xfer[1] R, addr=0x68, len=7
rtc-ds1307 0-0068: read: 00 00 00 00 00 00 00
rtc-ds1307 0-0068: read secs=0, mins=0, hours=0, mday=0, mon=-1, year=100, 
wday=-1
rtc-ds1307 0-0068: hctosys: unable to read the hardware clock

many thanks to Steven for the driver, and many thanks to all for the help until 
now,

regards,
angelo



On 25/08/2011 18:37, Viet Nguyen wrote:
> On Wed, Aug 24, 2011 at 11:24 PM, angelo <angel...@gmail.com
> <mailto:angel...@gmail.com>> wrote:
> 
> 
>     1- The device rtc0 must be created from genromfs ? I see some boards
>     that have CONFIG_RTC_HCTOSYS_DEVICE="rtc0" but create a "rtc"
>     instade, with any number.
> 
>     2 - Do i hae to add some static structure in my board.c to enable
>     rtc ds1307 driver ? Do you have a sample ?
> 
> 
> 1. rtc0 device node should be created in order to use hwclock, you don't
> need to create i2c device note by the way.
> 2. You must register your platform devices:
> 
> static struct platform_device rtc_dev_ = {
>     .name = "rtc-ds1307",
>     .id  = -1,
> };
> 
> static struct resource i2c_res_[] = {
>     {
>         .start      = MCFI2C_IOBASE,
>         .end        = MCFI2C_IOBASE + MCFI2C_IOSIZE - 1,
>         .flags      = IORESOURCE_MEM,
>     },
>     {
>         .start      = MCFINT_VECBASE + MCFINT_I2C,
>         .end        = MCFINT_VECBASE + MCFINT_I2C,
>         .flags      = IORESOURCE_IRQ,
>     },
> };
> 
> static struct platform_device i2c_dev_ = {
>    .name  = "mcfi2c",
>    .id = 0,
>    .num_resources = ARRAY_SIZE(i2c_res_),
>    .resource = i2c_res_,
> };
> 
> static struct i2c_board_info __initdata i2c_info_[] = {
>     {
>         I2C_BOARD_INFO("ds1338", 0x68),
>     },
> };
> 
> static struct platform_device *devices_[] __initdata = {
>     &rtc_dev_,
>     &i2c_dev_,
> };
> 
> ...
> in your arch_init:
>   i2c_register_board_info(0, i2c_info_, ARRAY_SIZE(i2c_info_));
>   platform_add_devices(devices_, ARRAY_SIZE(devices_));
> 
> PS: I used i2c driver of Steven King
> 
> Regrads,
> -- 
> Nguyen Quoc Viet

_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to