Hacking platform drivers into Intel Edison

Jakub Kramarz
VirtusLab
Published in
2 min readOct 9, 2015

Unlike most of the development boards, Intel Edison uses binary, proprietary blob for delivering tables of devices connected to I2C and SPI buses. They’re loaded via Simple Firmware Interface (SFI) during kernel startup in Intel MID SFI initialization code (located in intel_mid_sfi.c) and compared to board data structure (board.c).

“To summarise, in the need of add new devices the SFI Tables is not an option because there isn’t any available tool so far to edit or modify such tables and seems like IFWI source is not going to be available to user. So the best option is to do all the hacks in kernel and add the devices there and remove possible conflicting devices from board.c file.” , quoting icpda, user of an official Intel support forum.

So, we need to hack a kernel? It’s much easier than hacking ourselves back in time, so let’s do it! I’ll add TSC2007, a 4-wire resistive touch panel driver connected over I2C, based on jbayalas post in the same thread.

Adding platform data into device libs

To begin with, we’ll create appropriate entries in linux/arch/x86/platform/intel-mid/device_libs.

The platform_tsc2007.c will be included in the patch at the bottom of this post.

OK, now we’ll need to add it into struct devs_id device_ids[] in board.c:

Loading our very own SFI entries

Let’s take a look at static int sfi_parse_devs(struct sfi_table_header *table) in intel_mid_sfi.c:

We can’t use sfi_parse_devs without generating own SFI OEMB table, so let’s just “handle” our entry separately by calling sfi_handle_i2c_dev directly in int intel_mid_platform_init(void):

Final touches

Now add newly created files to Makefiles, add missing includes (see provided patch) and create a patch to include into Yocto build.

Final patch for TSC2007, adding required modifications in driver itself

To enable these changes, add CONFIG_TOUCHSCREEN_TSC2007=y at the bottom of defconfig.

--

--