I have been able to setup SPI device but I am trying to use the SPI
interface to connect to an external ADC and have it stream to a
file. If anyone has done this or knows how, please help. An example
will be perfect. Here are the changes I made to get to this point:
1. Changes to uboot: (board/omap3/beagle/beagle.h):
MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)) /*MMC1_DAT6*/\
MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)) /*MMC1_DAT7*/\
/*Wireless LAN */\
- MUX_VAL(CP(MMC2_CLK), (IEN | PTU | EN | M4)) /*GPIO_130*/\
- MUX_VAL(CP(MMC2_CMD), (IEN | PTU | EN | M4)) /*GPIO_131*/\
- MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M4)) /*GPIO_132*/\
+ MUX_VAL(CP(MMC2_CLK), (IEN | PTU | DIS | M1)) /*MCSPI3_CLK*/\
+ MUX_VAL(CP(MMC2_CMD), (IEN | PTU | DIS | M1)) /*MCSPI3_SIMO*/\
+ MUX_VAL(CP(MMC2_DAT0), (IEN | PTU | EN | M1)) /*MCSPI3_SOMI*/\
MUX_VAL(CP(MMC2_DAT1), (IEN | PTU | EN | M4)) /*GPIO_133*/\
MUX_VAL(CP(MMC2_DAT2), (IEN | PTU | EN | M4)) /*GPIO_134*/\
- MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M4)) /*GPIO_135*/\
+ MUX_VAL(CP(MMC2_DAT3), (IEN | PTU | EN | M1)) /*MCSPI3_CS0*/\
2. Changes to kernel: (tmp/work/beagleboard-angstrom-linux-gnueabi/
linux-omap-2.6.29*/git/.config):
CONFIG_OMAP_MUX=y
CONFIG_SPI_OMAP24XX=y
CONFIG_SPI_SPIDEV=y
3. Add to arch/arm/mach-omap2/board-omap3beagle.c
#include <linux/spi/spi.h>
// For McSPI3
static struct spi_board_info beagle_spi_board_info[] = {
{
.modalias = "spidev",
.max_speed_hz = 48000000, //48 Mbps
.bus_num = 3,
.chip_select = 0,
.mode = SPI_MODE_1,
},
};
// For McSPI4
static struct spi_board_info beagle_spi_board_info2[] = {
{
.modalias = "spidev",
.max_speed_hz = 48000000, //48 Mbps
.bus_num = 4,
.chip_select = 0,
.mode = SPI_MODE_1,
},
};
Add to function : static void __init omap3_beagle_init(void) {
...
printk("Debug ================> register SLAVE DEVICES using
[spidev] protocol driver >>> start\n");
spi_register_board_info(beagle_spi_board_info, ARRAY_SIZE
(beagle_spi_board_info));
spi_register_board_info(beagle_spi_board_info2, ARRAY_SIZE
(beagle_spi_board_info2));
printk("Debug ================> register SLAVE DEVICES using
[spidev] protocol driver >>> end\n");
4. Rebuild uboot
Rebuild Kernel
I hope it helps.
Thanks,
Saladino.