Hello,
Beginner question; I have a working ds1307 that I can talk to with
echo ds3232 0x68 >/sys/bus/i2c/devices/i2c-3/new_device
from there I can do wonderful things such as
hwclock -f /dev/rtc1 -s
As a beginner I’m tempted to quit while I’m ahead and script these at start up. However, I’d like to try and register these with the kernel ‘properly’.
I believe I need to add the device to arch/arm/mach-omap2/board-omap3beagle.c - is this correct?
and, if so according to http://www.mjmwired.net/kernel/Documentation/i2c/instantiating-devices then I guess I need to write in something like this, that was already in there?
(presumably I can’t just add my ds1307 into this structure - because it’s probably on another bus??)
static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { { I2C_BOARD_INFO("eeprom", 0x50), }, };
and I should add something in somewhere in static void __init omap3_beagle_init(void) ?
Although, in here I see omap3_beagle_i2c_init();
so should I add something in static int __init omap3_beagle_i2c_init(void) instead?
What I type is the next question… my first guess for adding some i2c_board_info would be;
`
static struct i2c_board_info __initdata rtc_i2c_device[] = {
{ /* DS1307 RTC on i2c2 */
I2C_BOARD_INFO(“ds1307”, 0x68),
.type = “ds1339”,
}
`
(i just copied https://github.com/bootc/linux/blob/rpi-3.2.21/arch/arm/mach-at91/board-cpu9krea.c#L276 there)
I’m not confident about the call to i2c_register_board_info…
do i just add
i2c_register_board_info(2, rtc_i2c_device, ARRAY_SIZE(rtc_i2c_device));
to omap3_beagle_i2c_init()
As you can probably tell, I’ve not done this before. I’ve tried to help myself as much as I can, but i’m getting diminishing returns from the worlds favorite search engine now. Am I very far off the mark?
Regards,
Michael