From f3d94b8bb902e37222475163e6f9dbb0f34e19d9 Mon Sep 17 00:00:00 2001 From: luowei Date: Tue, 25 Mar 2014 11:34:53 +0800 Subject: [PATCH] add spi dts demo code for rk3288 --- arch/arm/boot/dts/rk3188-tb.dts | 14 +++---- arch/arm/boot/dts/rk3288-tb.dts | 61 +++++++++++++++++++++++++++++ arch/arm/configs/rockchip_defconfig | 2 + drivers/spi/spi-rockchip-test.c | 6 ++- drivers/spi/spi-rockchip.c | 2 +- 5 files changed, 75 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/rk3188-tb.dts b/arch/arm/boot/dts/rk3188-tb.dts index 1f3b93a14ad8..6d83a86e4708 100755 --- a/arch/arm/boot/dts/rk3188-tb.dts +++ b/arch/arm/boot/dts/rk3188-tb.dts @@ -207,12 +207,12 @@ &spi0 { status = "okay"; - max-freq = <24000000>; + max-freq = <48000000>; /* spi_test@00 { compatible = "rockchip,spi_test_bus0_cs0"; reg = <0>; - spi-max-frequency = <12000000>; + spi-max-frequency = <24000000>; poll_mode = <0>; type = <0>; enable_dma = <0>; @@ -222,22 +222,22 @@ spi_test@01 { compatible = "rockchip,spi_test_bus0_cs1"; reg = <1>; - spi-max-frequency = <12000000>; + spi-max-frequency = <24000000>; poll_mode = <0>; type = <0>; - enable_dma = <0>; + enable_dma = <0>; }; */ }; &spi1 { status = "okay"; - max-freq = <24000000>; + max-freq = <48000000>; /* spi_test@10 { compatible = "rockchip,spi_test_bus1_cs0"; reg = <0>; - spi-max-frequency = <12000000>; + spi-max-frequency = <24000000>; poll_mode = <0>; type = <0>; enable_dma = <0>; @@ -246,7 +246,7 @@ spi_test@11 { compatible = "rockchip,spi_test_bus1_cs1"; reg = <1>; - spi-max-frequency = <12000000>; + spi-max-frequency = <24000000>; poll_mode = <0>; type = <0>; enable_dma = <0>; diff --git a/arch/arm/boot/dts/rk3288-tb.dts b/arch/arm/boot/dts/rk3288-tb.dts index 2f3450076a57..71dccf0373ea 100755 --- a/arch/arm/boot/dts/rk3288-tb.dts +++ b/arch/arm/boot/dts/rk3288-tb.dts @@ -201,14 +201,75 @@ &spi0 { status = "okay"; + max-freq = <48000000>; + /* + spi_test@00 { + compatible = "rockchip,spi_test_bus0_cs0"; + reg = <0>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + + }; + + spi_test@01 { + compatible = "rockchip,spi_test_bus0_cs1"; + reg = <1>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + }; + */ }; &spi1 { status = "okay"; + max-freq = <48000000>; + /* + spi_test@10 { + compatible = "rockchip,spi_test_bus1_cs0"; + reg = <0>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + }; + + spi_test@11 { + compatible = "rockchip,spi_test_bus1_cs1"; + reg = <1>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + }; + */ }; &spi2 { status = "okay"; + max-freq = <48000000>; + /* + spi_test@20 { + compatible = "rockchip,spi_test_bus2_cs0"; + reg = <0>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + }; + + spi_test@21 { + compatible = "rockchip,spi_test_bus2_cs1"; + reg = <1>; + spi-max-frequency = <24000000>; + poll_mode = <0>; + type = <0>; + enable_dma = <0>; + }; + */ }; &i2c0 { diff --git a/arch/arm/configs/rockchip_defconfig b/arch/arm/configs/rockchip_defconfig index 5a16bd5f25d0..60d0f8eb4bb9 100644 --- a/arch/arm/configs/rockchip_defconfig +++ b/arch/arm/configs/rockchip_defconfig @@ -315,6 +315,8 @@ CONFIG_I2C_ROCKCHIP_COMPAT=y CONFIG_SPI=y CONFIG_SPI_ROCKCHIP_CORE=y CONFIG_SPI_ROCKCHIP=y +CONFIG_SPI_ROCKCHIP_DMA=y +CONFIG_SPI_ROCKCHIP_TEST=y CONFIG_DEBUG_GPIO=y CONFIG_GPIO_SYSFS=y CONFIG_BATTERY_BQ24296=y diff --git a/drivers/spi/spi-rockchip-test.c b/drivers/spi/spi-rockchip-test.c index b4c5321ec5ee..562b86dc8583 100755 --- a/drivers/spi/spi-rockchip-test.c +++ b/drivers/spi/spi-rockchip-test.c @@ -54,7 +54,7 @@ static ssize_t spi_test_write(struct file *file, struct spi_device *spi = NULL; char txbuf[256],rxbuf[256]; - printk("%s:0:bus=0,cs=0; 1:bus=0,cs=1; 2:bus=1,cs=0; 3:bus=1,cs=1\n",__func__); + printk("%s:0:bus=0,cs=0; 1:bus=0,cs=1; 2:bus=1,cs=0; 3:bus=1,cs=1; 4:bus=2,cs=0; 5:bus=2,cs=1\n",__func__); if(count > 5) return -EFAULT; @@ -67,7 +67,7 @@ static ssize_t spi_test_write(struct file *file, if(nr >= 6 || nr < 0) { printk("%s:cmd is error\n",__func__); - return -EFAULT; + return -EFAULT; } for(i=0; i<256; i++) @@ -223,6 +223,8 @@ static const struct of_device_id rockchip_spi_test_dt_match[] = { { .compatible = "rockchip,spi_test_bus0_cs1", }, { .compatible = "rockchip,spi_test_bus1_cs0", }, { .compatible = "rockchip,spi_test_bus1_cs1", }, + { .compatible = "rockchip,spi_test_bus2_cs0", }, + { .compatible = "rockchip,spi_test_bus2_cs1", }, {}, }; MODULE_DEVICE_TABLE(of, rockchip_spi_test_dt_match); diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 38aa5d2fe5db..cb3b51ba5c99 100755 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -221,7 +221,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) #ifdef CONFIG_SPI_ROCKCHIP_DMA ret = dw_spi_dma_init(dws); if (ret) - goto err_release_mem; + printk("%s:fail to init dma\n",__func__); #endif ret = dw_spi_add_host(dws); -- 2.34.1