HELP: libertas: Can't read bus mode register. libertas_spi: probe of spi1.0 failed with error -5

Brian.Wang linux_turbowing at 163.com
Thu Aug 4 10:52:55 EDT 2011


Hi, all
Now I am going to port libertas driver into my mainboard, I suffered some difficuties.
Mainborad platform is Mini2440 using samsung S3C2440. Wireless unit consists of  marvell 88W8686 connected with S3C2440 by GSPI interface. Linux kernel version is linux-2.6.32.2.
 I use GPG5_6_7 as SPIMISO1, SPIMOSI1,SPICLK1 and GPG3 as nSS1.
The problem is that when I insmod libertas.ko and insmod libertas_spi.ko, print message is following:
libertas_spi: Libertas SPI driver
libertas: Can't read bus mode register.
libertas_spi: probe of spi1.0 failed with error -5


However, I short circuit SPIMISO1 and SPIMOSI1 then execute spi_test. I can read bus mode and receive data correctly.


What I do for driving 88W8686 is following:
/arch/arm/mach-s3c2440/mach-mini2440.c
/* SPI1 Marvell8686 */
static int libertas_spi_setup(struct spi_device *spi)
{
void __iomem *base_addr;
spi->bits_per_word = 16;
base_addr = ioremap(0x560000d0, 0x0c);
if(base_addr == NULL) {
printk(KERN_ERR "map error\n");
return -ENOMEM;
}
iowrite32(ioread32(base_addr)&(~(0x3<<4))|(0x1<<4), base_addr);//config GPJ2 output
iowrite32(ioread32(base_addr+0x4)|(0x1<<2), base_addr+0x4);// GPJ2 HIGH
iowrite32(ioread32(base_addr)&(~(0x3<<20))|(0x1<<20), base_addr);//config GPJ10 output
iowrite32(ioread32(base_addr+0x4)|(0x1<<10), base_addr+0x4);//GPJ10 HIGH
iowrite32(ioread32(base_addr)&(~(0x3<<22))|(0x1<<22), base_addr);//config GPJ11 output
iowrite32(ioread32(base_addr+0x4)&(~(0x1<<11)), base_addr+0x4);// GPJ11 LOW


s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPIO_IRQ);
set_irq_type(IRQ_EINT20, IRQ_TYPE_EDGE_FALLING);
iounmap(base_addr);
return 0;
}


static int libertas_spi_teardown(struct spi_device *spi)
{
void __iomem *base_addr;
base_addr = ioremap(0x560000d0, 0x0c);
if(base_addr == NULL) {
printk(KERN_ERR "map error\n");
return -ENOMEM;
}
iowrite32(ioread32(base_addr)&(~(0x3<<4))|(0x1<<4), base_addr);//config GPJ2 output
iowrite32(ioread32(base_addr+0x4)&(~(0x1<<2)), base_addr+0x4);// GPJ2 LOW
iounmap(base_addr);
return 0;
}
static struct libertas_spi_platform_data libertas_spi_info = {
.use_dummy_writes = 0,
.setup = libertas_spi_setup,
.teardown = libertas_spi_teardown,
};
 
static struct spi_board_info libertas_spi_device[] __initdata = {
[0] = {
.modalias = "libertas_spi",
.platform_data = &libertas_spi_info,
.irq = IRQ_EINT20,
.max_speed_hz = 1*1000*1000,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_0,
},
[1] = {
.modalias = "spidev",
.bus_num = 1,
.chip_select = 1,
.max_speed_hz = 500 * 1000,
},
};


/* init s3c2410_spi_info */
static struct s3c2410_spi_info mini2440_spi1_info = {
.pin_cs = S3C2410_GPG(3),
.num_cs = 2,//0--Marvell 8686    1--spidev
.bus_num = 1,
.gpio_setup = s3c24xx_spi_gpiocfg_bus1_gpg5_6_7,
};


static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_rtc,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&mini2440_device_eth,
&s3c24xx_uda134x,
&s3c_device_nand,
&s3c_device_sdi,
&s3c_device_usbgadget,
//&s3c_device_spi0,
&s3c_device_spi1,
};


static void __init mini2440_map_io(void)
{
s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
}


static void __init mini2440_machine_init(void)
{
#if defined (LCD_WIDTH)
s3c24xx_fb_set_platdata(&mini2440_fb_info);
#endif
s3c_i2c0_set_platdata(NULL);


s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);


s3c_device_nand.dev.platform_data = &friendly_arm_nand_info;
s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
s3c_device_spi1.dev.platform_data = &mini2440_spi1_info;
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
spi_register_board_info(libertas_spi_device, ARRAY_SIZE(libertas_spi_device));
s3c_pm_init();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libertas-dev/attachments/20110804/dc1d9540/attachment.html>


More information about the libertas-dev mailing list