Beaglebone panics after adding spi1_init to beaglebone_dev_dfg in RobertCNelson kernel

Hi all,

I need to assign the spi1 bus of my beaglebone to the driver of some custom-made device (not a cape). So I added

{spi1_init, DEV_ON_BASEBOARD, PROFILE_NONE},

to the beaglebone_dev_cfg struct in board-am335xevm.c. The spi1_init function simply reads as

static void spi1_init(int evm_id, int profile)
{
setup_pin_mux(spi1_pin_mux);
spi_register_board_info(bone_spi1_info,
ARRAY_SIZE(bone_spi1_info));
return;
}

where bone_spi1_info is:

static struct spi_board_info bone_spi1_info[] = {
{
.modalias = “ad193x”,
.max_speed_hz = 312500,
.bus_num = 2,
.chip_select = 0,
.mode = SPI_MODE_0,
},
};

I have the whole thing running on the TI-SDK kernel but now I wanted my kernel to be based on RobertCNelson’s linux-dev repo (branch v3.2-psp25).
The problem is, that after these changes my beaglebone won’t boot anymore. Error messages on the serial are like:

(initramfs) Gave up waiting for root device. Common probems:

  • Boot args (cat /proc/cmdline)
  • Check rootdelay= (did the system wait long enought?)
  • Check root= (did the system wait for the right device?)
  • Missing modules (cat /proc/modules; ls /dev)
    ALERT! /dev/mmcblk0p2 does not exist. Dropping to a shell!
    FATAL: Could no load /lib/modules/3.2.32-psp25/modules.dep: No such file or directory

When I remove spi_register_board_info in spi1_init beaglebone boots again.

Does anyone know what I’m missing here?

Thanks,
Chris

Problem solved. However, I feel that this is not a neat solution, so it would be great if someone could suggest a nicer way:

Actually the problem was, that mmc0 obviously was not inititialized properly after my changes. The log of the working kernel looks like

[ 2.388977] omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:42 UTC (946684842)
[ 2.399047] Freeing init memory: 248K
Loading, please wait…
[ 2.502471] mmc0: host does not support reading read-only switch. assuming write-enable.
[ 2.521545] mmc0: new high speed SDHC card at address b368
[ 2.533264] mmcblk0: mmc0:b368 USD 7.46 GiB
[ 2.546325] mmcblk0: p1 p2
[ 2.594787] udevd[67]: starting version 173

After I added spi1_init to the beaglebone_dev_cfg struct the same portion looked like:

[ 2.389251] omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:24 UTC (946684824)
[ 2.399322] Freeing init memory: 248K
Loading, please wait…
[ 2.569366] udevd[66]: starting version 173

and the bone wouldn’t boot anymore. To fix this I removed spi1_init from the bealgebone_dev_config struct again and did my pinmuxing and spi-registering in beaglebone_cape_setup (branch out2:), deleting spidev registering:

static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context)

{

out2:
if (capecount > 3) {

if(beaglebone_spi1_free == 1) {
beaglebone_spi1_free = 0;
pr_info(“BeagleBone cape: exporting SPI pins for AD193x and THAT5173\n”);
setup_pin_mux(spi1_pin_mux);
spi_register_board_info(bone_spi1_info,
ARRAY_SIZE(bone_spi1_info));
spi_register_board_info(bone_spi1_cs1_info,
ARRAY_SIZE(bone_spi1_cs1_info));
}

}


}

Now the bone boots just fine, but I think that this solution is a bit odd. Does anyone know how I would set up my SPI port in decent way?

Thanks,
Chris