请问spi的spi0_d0,spi0_d1这两个引脚是否可以配置其方向?
在uboot和内核中怎么配置了?我只找到了配置引脚模式,但是没有看到有配置方向的
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
请问spi的spi0_d0,spi0_d1这两个引脚是否可以配置其方向?
在uboot和内核中怎么配置了?我只找到了配置引脚模式,但是没有看到有配置方向的
可以,
打开文件 Spi-omap2-mcspi.c (c:\sitara\sitara\linux\drivers\spi) 定位到函数:
static int omap2_mcspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t){
。。。。
l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
l |= OMAP2_MCSPI_CHCONF_DPE0;
。。。
}
修改为
static int omap2_mcspi_setup_transfer(struct spi_device *spi, struct spi_transfer *t){
。。。。
l &=~( OMAP2_MCSPI_CHCONF_DPE0);
l |= (OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
。。。
}
无非就是寄存器操作,参看数据手册改,更快
大神,求助;我在内核中调了spi的管脚,但是还是没有识别出正确的spi flash id,不知道什么情况?不知道是哪里出问题、
linux-3.2.0-psp04.06.00.08.sdk的版本
board-am335xevm.c中管脚配置如下:
static struct pinmux_config spi0_pin_mux[] = {
{"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL | AM33XX_PULL_UP
| AM33XX_PIN_OUTPUT},
{"spi0_d0.spi0_d0", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL
|AM33XX_INPUT_EN},
{"spi0_d1.spi0_d1", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL
| AM33XX_PIN_OUTPUT},
{"spi0_cs0.spi0_cs0", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL | AM33XX_PULL_UP
| AM33XX_PIN_OUTPUT},
{NULL, 0},
};
最后定位出不是方向的问题,是硬件上sdo sdi这两个引脚接反了。有没有什么办法从软件上解决呢?好像不是配置寄存器这么简单