diff options
-rw-r--r-- | arch/mips/configs/nlm_xlr_defconfig | 4 | ||||
-rw-r--r-- | arch/mips/netlogic/xlr/platform.c | 51 |
2 files changed, 55 insertions, 0 deletions
diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig index d0b857d98c91..138f698d7c00 100644 --- a/arch/mips/configs/nlm_xlr_defconfig +++ b/arch/mips/configs/nlm_xlr_defconfig | |||
@@ -367,6 +367,10 @@ CONFIG_SERIAL_8250_RSA=y | |||
367 | CONFIG_HW_RANDOM=y | 367 | CONFIG_HW_RANDOM=y |
368 | CONFIG_HW_RANDOM_TIMERIOMEM=m | 368 | CONFIG_HW_RANDOM_TIMERIOMEM=m |
369 | CONFIG_RAW_DRIVER=m | 369 | CONFIG_RAW_DRIVER=m |
370 | CONFIG_I2C=y | ||
371 | CONFIG_I2C_XLR=y | ||
372 | CONFIG_RTC_CLASS=y | ||
373 | CONFIG_RTC_DRV_DS1374=y | ||
370 | # CONFIG_HWMON is not set | 374 | # CONFIG_HWMON is not set |
371 | # CONFIG_VGA_CONSOLE is not set | 375 | # CONFIG_VGA_CONSOLE is not set |
372 | # CONFIG_HID_SUPPORT is not set | 376 | # CONFIG_HID_SUPPORT is not set |
diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index cb0ab63089db..71b44d82621d 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/resource.h> | 14 | #include <linux/resource.h> |
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
17 | #include <linux/i2c.h> | ||
17 | 18 | ||
18 | #include <asm/netlogic/haldefs.h> | 19 | #include <asm/netlogic/haldefs.h> |
19 | #include <asm/netlogic/xlr/iomap.h> | 20 | #include <asm/netlogic/xlr/iomap.h> |
@@ -186,3 +187,53 @@ int xls_platform_usb_init(void) | |||
186 | 187 | ||
187 | arch_initcall(xls_platform_usb_init); | 188 | arch_initcall(xls_platform_usb_init); |
188 | #endif | 189 | #endif |
190 | |||
191 | #ifdef CONFIG_I2C | ||
192 | static struct i2c_board_info nlm_i2c_board_info1[] __initdata = { | ||
193 | /* All XLR boards have this RTC and Max6657 Temp Chip */ | ||
194 | [0] = { | ||
195 | .type = "ds1374", | ||
196 | .addr = 0x68 | ||
197 | }, | ||
198 | [1] = { | ||
199 | .type = "lm90", | ||
200 | .addr = 0x4c | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct resource i2c_resources[] = { | ||
205 | [0] = { | ||
206 | .start = 0, /* filled at init */ | ||
207 | .end = 0, | ||
208 | .flags = IORESOURCE_MEM, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static struct platform_device nlm_xlr_i2c_1 = { | ||
213 | .name = "xlr-i2cbus", | ||
214 | .id = 1, | ||
215 | .num_resources = 1, | ||
216 | .resource = i2c_resources, | ||
217 | }; | ||
218 | |||
219 | static int __init nlm_i2c_init(void) | ||
220 | { | ||
221 | int err = 0; | ||
222 | unsigned int offset; | ||
223 | |||
224 | /* I2C bus 0 does not have any useful devices, configure only bus 1 */ | ||
225 | offset = NETLOGIC_IO_I2C_1_OFFSET; | ||
226 | nlm_xlr_i2c_1.resource[0].start = CPHYSADDR(nlm_mmio_base(offset)); | ||
227 | nlm_xlr_i2c_1.resource[0].end = nlm_xlr_i2c_1.resource[0].start + 0xfff; | ||
228 | |||
229 | platform_device_register(&nlm_xlr_i2c_1); | ||
230 | |||
231 | err = i2c_register_board_info(1, nlm_i2c_board_info1, | ||
232 | ARRAY_SIZE(nlm_i2c_board_info1)); | ||
233 | if (err < 0) | ||
234 | pr_err("nlm-i2c: cannot register board I2C devices\n"); | ||
235 | return err; | ||
236 | } | ||
237 | |||
238 | arch_initcall(nlm_i2c_init); | ||
239 | #endif | ||