Analytics

2009年11月18日 星期三

DMA2443(s3c2443) SPI介面,user space AP實做紀錄 5

第五回合

除了紀錄4里的那個討論串又找到了以下四篇可能用的到的資料:
http://blog.chinaunix.net/u3/96265/showart_1925533.html
http://blog.csdn.net/lanmanck/archive/2009/08/18/4459699.aspx
http://blog.chinaunix.net/u2/66039/showart_1686204.html
http://marc.info/?l=linux-arm&m=115936681827755&w=2
還有這個討論到一半的 =="
http://www.unixresources.net/linux/clf/embedded/archive/00/00/68/65/686594.html#article687090


成功的把compiler說的devs.c中的error一個一個修正過了
方法是去把他沒定義到的檔案include進來
(因為大部分的error好像都是說這個,那個不認識之類的)

linux2.6.24/arch/arm/plat-s3c24xx/devs.c
include部份添加:
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h> /*add by JJ*/

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/fb.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>

#include <asm/plat-s3c/regs-serial.h>
#include <asm/plat-s3c24xx/udc.h>

#include <asm/plat-s3c24xx/devs.h>
#include <asm/plat-s3c24xx/common-smdk.h>
#include <asm/plat-s3c24xx/cpu.h>
#include <asm/plat-s3c24xx/regs-spi.h>

#include <asm-arm/arch-s3c2410/regs-gpio.h>/*add by JJ*/
#include <asm-arm/arch-s3c2410/spi.h> /*add by JJ*/
#include <linux/dm9000.h>
#include <asm/arch/map.h>

然後再到spi(0)...
/* SPI (0) */
#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2450) || defined(CONFIG_CPU_S3C2416)

static struct resource s3c_spi0_resource[] = {
        [0] = {
                .start = S3C_PA_SPI_0,
                .end   = S3C_PA_SPI_0 + S3C_SZ_SPI_0,
                .flags = IORESOURCE_MEM,
        },
        [1] = {
                .start = IRQ_SPI0,
                .end   = IRQ_SPI0,
                .flags = IORESOURCE_IRQ,
        }

};
/*---------------------------------------------------*/

/* add by JJ */

static struct spi_board_info s3c2410_spi_board[] = {
[0] = {
 .modalias = "s3c2410_spi",/*參考drivers/spi/spi_s3c24xx.c裡面第430行*/
 .platform_data =NULL,
 .chip_select = 0, /*我猜使用spi0就是填0*/
 .max_speed_hz = 1000*1000,/*看AS3991的8051code,他spi速率好像是設1MHz*/
 }
};


struct s3c2410_spi_info s3c2410_spi_platdata = {
 .pin_cs = S3C2410_GPG5,/*我猜是指spi裡面nSS這隻pin*/
 .board_info = s3c2410_spi_board,
 .board_size = ARRAY_SIZE(s3c2410_spi_board)
};

/* end add */
/*---------------------------------------------------*/
static u64 s3c_device_spi0_dmamask = 0xffffffffUL;

struct platform_device s3c_device_spi0 = {
        .name             = "s3c2410-spi",
        .id               = 0,
        .num_resources    = ARRAY_SIZE(s3c_spi0_resource),
        .resource         = s3c_spi0_resource,
        .dev              = {
                .dma_mask = &s3c_device_spi0_dmamask,
                .coherent_dma_mask = 0xffffffffUL,
                .platform_data=&s3c2410_spi_platdata  /*add by JJ*/
         }
};


大概是改以上幾個地方,然後kernel就成功build起來了
只不過spi應該還是沒有正常on起來...
因為在板子上下dmesg|grep spi 指令得到的訊息

[root@(none) /]# dmesg|grep spi
s3c2410-spi s3c2410-spi.0: bitbang at c6954318                                
s3c2410-spi s3c2410-spi.0: Failed to register SPI master                      
s3c2410-spi: probe of s3c2410-spi.0 failed with error -22 


繼續努力!

1 則留言:

  1. 板子的/proc/devices

    Character devices:
    1 mem
    2 pty
    3 ttyp
    4 /dev/vc/0
    4 tty
    4 ttys
    5/dev/tty
    5/dev/console
    5/dev/ptmx
    6lp
    7vcs
    10misc
    13input
    14sound
    21sg
    29fb
    81video4linux
    89i2c
    90mtd
    99ppdev
    108ppp
    128ptm
    136pts
    153spi <-
    180usb
    188ttyUSB
    189usb_device
    204s3c2410_serial
    253usb_endpoint
    254 rtc


    有spi
    這代表甚麼嗎?

    回覆刪除