Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Netlogic: Platform changes for XLR/XLS I2C

Add platform code for XLR/XLS I2C controller and devices. Add
devices on the I2C bus on the XLR/XLS developement boards.

Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3757/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Jayachandran C and committed by
Ralf Baechle
77c8da01 3a2f9b99

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