On Wed, Aug 24, 2011 at 11:24 PM, angelo <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