On many Raspberry Pi distributions, including Raspbian, the SPI and I2C device drivers are not loaded by default on boot. The file named '/etc/modprobe.d/raspi-blacklist.conf' indicates which kernel modules must not be loaded. Since I2C and SPI, aren't needed by most users, they need to be explicitly removed from that list by placing a '#' mark (comment) in front of the 'blacklist' command.
Edit and save '/etc/modprobe.d/raspi-blacklist.conf' as shown below.
# blacklist spi and i2c by default (many users don't need them)
Then, to gain access to I2C, SPI and 1-Wire devices, their respective device drivers must be loaded, either manually using the 'modprobe' command or on boot.
To load them on boot, edit and save the file named '/etc/modules' as shown below.
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
# sound devices
# SPI devices
# I2C devices
# 1-Wire devices
# 1-Wire thermometer devices
Finally, reboot the Raspberry Pi' with the 'reboot' command to get all the kernel module drivers loaded or use the modprobe command if you don't want to reboot the machine.
Verify that all the kernel module drivers have been loaded as expected with the 'lsmod' command.
Module Size Used by
w1_therm 2705 0
w1_gpio 1283 0
wire 23530 2 w1_gpio,w1_therm
cn 4649 1 wire
i2c_dev 5587 0
snd_bcm2835 12808 0
snd_pcm 74834 1 snd_bcm2835
snd_seq 52536 0
snd_timer 19698 2 snd_seq,snd_pcm
snd_seq_device 6300 1 snd_seq
snd 52489 5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835
snd_page_alloc 4951 1 snd_pcm
spidev 5136 0
i2c_bcm2708 3681 0
spi_bcm2708 4401 0