void-packages/srcpkgs/kernel-rpi/patches/0002-pcf8523-i2c-register-d...

43 lines
1.2 KiB
Diff

diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 7fe7283..a8e31e7 100644
--- arch/arm/mach-bcm2708/bcm2708.c
+++ arch/arm/mach-bcm2708/bcm2708.c
@@ -689,6 +689,21 @@ static void bcm2708_power_off(void)
bcm2708_restart(0, "");
}
+#ifdef CONFIG_RTC_DRV_PCF8523
+static struct i2c_board_info offboard_i2c_devices[] = {
+ {
+ /* Raspy Juice real-time clock chip */
+ I2C_BOARD_INFO("pcf8523", 0x68),
+ },
+};
+
+#if defined(CONFIG_RTC_HCTOSYS) && \
+ (!defined(CONFIG_I2C_CHARDEV) || \
+ !defined(CONFIG_I2C_BCM2708))
+#error "RTC_DRV_PCF8523 defined as kernel built-in, but I2C_CHARDEV and I2C_BMC2708 isn't: RTC_HCTOSYS will not work."
+#endif
+#endif
+
void __init bcm2708_init(void)
{
int i;
@@ -752,6 +767,15 @@ void __init bcm2708_init(void)
spi_register_board_info(bcm2708_spi_devices,
ARRAY_SIZE(bcm2708_spi_devices));
#endif
+
+#ifdef CONFIG_RTC_DRV_PCF8523
+ i = 0;
+ /* test of Raspberry Pi Rev.2, where GPIO-header I2C busnum=1 */
+ if (system_rev >= 15)
+ i = 1;
+ i2c_register_board_info(i, offboard_i2c_devices,
+ ARRAY_SIZE(offboard_i2c_devices));
+#endif
}
#define TIMER_PERIOD DIV_ROUND_CLOSEST(STC_FREQ_HZ, HZ)