Developed the I2C driver for Beaglebone Black BSP
My first part of GSOC project is finish the I2C driver left by GSOC 2016 student Punit Vara. I reference the U-Boot and FreeBSD i2c code for develop. 1. We need register the i2c bus: a) i2c_bus *i2c_bus_alloc_and_init(size_t size) this function is use for alloc and init a new i2c bus. i2c_bus *i2c_bus_alloc_and_init(size_t size) { i2c_bus *bus = NULL; if (size >= sizeof(*bus)) { bus = calloc(1, size); if (bus != NULL) { int rv; rv = i2c_bus_do_init(bus, i2c_bus_destroy_and_free); if (rv != 0) { return NULL; } } } return bus; } b) configure the I2C clock and pinimux there two pin we need to configure: static void am335x_i2c0_pinmux(bbb_i2c_bus *bus) { REG(bus->regs + AM335X_CONF_I2C0_SDA) = (BBB_RXACTIVE | BBB_SLEWCTRL | BBB_PU_EN); ...