你要注意一下,这儿的 spi 速度值并不是可以随便设置的! 因為 cpu 除频后会配不上! 会跳到默认的 10Mhz 的速度。
建议你可以在 .... spi 中,加打印,看看你那值是否可以通过!
/driver/spi/spi-sunxi.c 中
/* set spi clock */
static void spi_set_clk(u32 spi_clk, u32 ahb_clk, struct sunxi_spi *sspi)
{
u32 spi_test = 100000000;
u32 get_spi;
dprintk(DEBUG_INFO, "set spi clock %d, mclk %d\n", spi_clk, ahb_clk);
for(spi_test = 50000000; spi_test >= 20000000; spi_test -= 1000000)
{
clk_set_rate(sspi->mclk, spi_test);
get_spi = clk_get_rate(sspi->mclk);
printk("spi_test %d == get %d \n", spi_test, get_spi);
}
像我以 100Mhz 到 80Mhz , 每 1Mhz 做变化!
[ 1.079831] spi_test 100000000 == get 100000000 ␍␊
[ 1.093426] spi_test 99000000 == get 96000000 ␍␊
[ 1.098527] spi_test 98000000 == get 96000000 ␍␊
[ 1.103587] spi_test 97000000 == get 96000000 ␍␊
[ 1.108714] spi_test 96000000 == get 96000000 ␍␊
[ 1.113807] spi_test 95000000 == get 92307692 ␍␊
[ 1.118905] spi_test 94000000 == get 92307692 ␍␊
[ 1.123996] spi_test 93000000 == get 92307692 ␍␊
[ 1.129127] spi_test 92000000 == get 87771428 ␍␊
[ 1.134193] spi_test 91000000 == get 87771428 ␍␊
[ 1.139293] spi_test 90000000 == get 87771428 ␍␊
[ 1.144406] spi_test 89000000 == get 87771428 ␍␊
[ 1.149506] spi_test 88000000 == get 87771428 ␍␊
[ 1.154601] spi_test 87000000 == get 85714285 ␍␊
[ 1.159739] spi_test 86000000 == get 85714285 ␍␊
[ 1.164835] spi_test 85000000 == get 80000000 ␍␊
[ 1.169939] spi_test 84000000 == get 80000000 ␍␊
[ 1.175074] spi_test 83000000 == get 80000000 ␍␊
[ 1.180142] spi_test 82000000 == get 80000000 ␍␊
[ 1.185243] spi_test 81000000 == get 80000000 ␍␊
[ 1.190346] spi_test 80000000 == get 80000000 ␍␊
就可以知道,有一些值设置是不行的! 要特定值才行!