新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > 基于S3C2440處理器SPI移植全過程

        基于S3C2440處理器SPI移植全過程

        作者: 時間:2016-11-10 來源:網絡 收藏
        環境

        硬件:S3C2440(ARM920T)

        本文引用地址:http://www.104case.com/article/201611/317171.htm

        嵌入式操作系統:Linux2.6.24內核

        文件系統:Yaffs2文件系統

        服務器:SuSe10.0 Linux服務器

        第一步:內核配置

        需要在內核中選擇以上幾個選項:

        很多網友發郵件說Linux2.6.24內核在SPI選項上未發現有Samsung S3C2440 series SPI 或 Samsung S3C24XX series SPI 和User mode SPI device driver support這兩個選項。

        其實在Linux2.6.24內核里已經兼容了對SPI的操作。只是在Linux2.6.24/drivers/spi/Kconfig中未能選中此選項。至于什么原因看下面的說明:打開Linux2.6.24/drivers/spi/Kconfig

        找到以下幾個選項:

        config SPI_BITBANG
        tristate "Bitbanging SPI master"
        depends on SPI_MASTER#&& EXPERIMENTAL
        help
        With a few GPIO pins, your system can bitbang the SPI protocol.
        Select this to get SPI support through I/O pins (GPIO, parallel
        port, etc). Or, some systems SPI master controller drivers use
        this code to manage the per-word or per-transfer accesses to the
        hardware shift registers.

        This is library code, and is automatically selected by drivers that
        need it. You only need to select this explicitly to support driver
        modules that arent part of this kernel tree.

        使用SPI的時候需要把Bitbanging SPI master打開,但是依賴的條件EXPERIMENTAL,這里我們把這個條件去掉,然后再找到:

        config SPI_S3C24XX
        tristate "Samsung S3C24XX series SPI"
        depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL
        select SPI_BITBANG
        help
        SPI driver for Samsung S3C24XX series ARM SoCs

        config SPI_S3C2440
        tristate "Samsung S3C2440 series SPI"
        depends on SPI_MASTER && ARCH_S3C2410
        select SPI_BITBANG
        help
        Add by SmallBox at 2011.02.18 SPI driver for Samsung S3C24XX series ARM SoCs
        以上藍色的字是我添加的。為了區別Linux內核默認的配置!修改到這里保存,退出。然后打開該目錄下面的Makefile文件,需要做以下修改:

        添加:

        obj-$(CONFIG_SPI_S3C2440) += spi_s3c24xx.o

        這里說明一下:如果不想在Kconfig中添加我添加的選項,這里就不需要修改Makefile文件了。因為本身已經有對S3C24XX的支持!

        修改后保存退出!

        下面需要修改的是Linux2.6.24里面的文件:

        1)打開smallbox@linux-server:/home/Linux2.6.24/arch/arm/plat-s3c24xx/devs.c添加一下語句

        這里還需要說明一下,添加后編譯會出現錯誤。還需要增加相應的頭文件:

        #include
        #include
        #include

        如果還有錯誤,可能就是你的頭文件添加的不夠。繼續查找添加,知道Make成功;

        2)打開smallbox@linux-server:/home/Linux2.6.24/arch/arm/mach-s3c2440/mach-hyh2440.c 文件添加

        static struct platform_device *utu2440_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c,
        &s3c_device_iis,
        &s3c_device_usbgadget,
        &s3c_device_ts,
        &s3c_device_dm9000,
        &s3c_device_nand,
        &s3c_device_sound,
        &s3c_device_buttons,
        &s3c_device_rtc,
        &s3c_device_sdi,
        &s3c_device_spi0,

        };
        保存退出!

        最后就可以Make了。下載你的內核,啟動你的硬件,你會在dev下發現spidev0.1這個設備了!



        評論


        技術專區

        關閉
        主站蜘蛛池模板: 呈贡县| 昆明市| 静海县| 太和县| 五大连池市| 临朐县| 秦安县| 铁岭市| 蕲春县| 甘孜县| 潮州市| 简阳市| 永福县| 枣强县| 银川市| 玛多县| 凤翔县| 平塘县| 清新县| 聊城市| 太仓市| 沁水县| 车致| 雷波县| 乐业县| 金溪县| 获嘉县| 邢台县| 茂名市| 嘉义市| 哈尔滨市| 米脂县| 五河县| 教育| 萝北县| 阜平县| 浦城县| 封丘县| 唐海县| 行唐县| 彩票|