Documentation-spiep93xx-spi.txt

Chinese translated version of Documentation-spiep93xx-spi.txt

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Chinese maintainer: majg <1519014266@qq.com>
---------------------------------------------------------------------
Documentation-spiep93xx-spi.txt 的中文翻译

如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。

中文版维护者: 马建刚  majg <1519014266@qq.com>
中文版翻译者: 马建刚  majg <1519014266@qq.com>
中文版校译者: 马建刚  majg <1519014266@qq.com>

 

 

以下为正文
---------------------------------------------------------------------
1 Cirrus EP93xx SPI controller driver HOWTO
-Cirrus EP93XX SPI控制器驱动HOWTO
  2 =========================================
  3
  4 ep93xx_spi driver brings SPI master support for EP93xx SPI controller.  Chip
  5 selects are implemented with GPIO lines.
-EP93XX的spi驱动带来支持SPI主为EP93XX SPI控制器。芯片选择实施GPIO线。
  6
  7 NOTE: If possible, don't use SFRMOUT (SFRM1) signal as a chip select. It will
  8 not work correctly (it cannot be controlled by software). Use GPIO lines
  9 instead.
-注:如果可能的话,不要使用SFRMOUT(Form1)中作为片选信号。
这将无法正常工作(它不能由软件控制)。用GPIO线代替。
 10
 11 Sample configuration
-示例配置
 12 ====================
 13
 14 Typically driver configuration is done in platform board files (the files under
 15 arch/arm/mach-ep93xx/*.c). In this example we configure MMC over SPI through
 16 this driver on TS-7260 board. You can adapt the code to suit your needs.
-驱动程序配置通常是在平台板文件(文件根据arch/arm/mach-ep93xx/*.C)。
在这个例子中,我们通过该驱动程序通过SPI配置MMC TS-7260板。您可以修改
代码,以满足您的需求。
 17
 18 This example uses EGPIO9 as SD/MMC card chip select (this is wired in DIO1
 19 header on the board).
-这个例子使用EGPIO9 SD / MMC卡芯片选择(这是有线DIO1 header在板上)。
 20
 21 You need to select CONFIG_MMC_SPI to use mmc_spi driver.
-您需要选择CONFIG MMC_SPI使用mmc_spi驱动。
 22
 23 arch/arm/mach-ep93xx/ts72xx.c:
 24
 25 ...
 26 #include <linux/gpio.h>
 27 #include <linux/spi/spi.h>
 28
 29 #include <linux/platform_data/spi-ep93xx.h>
 30
 31 /* this is our GPIO line used for chip select */
 32 #define MMC_CHIP_SELECT_GPIO EP93XX_GPIO_LINE_EGPIO9
 33
 34 static int ts72xx_mmc_spi_setup(struct spi_device *spi)
 35 {
 36         int err;
 37
 38         err = gpio_request(MMC_CHIP_SELECT_GPIO, spi->modalias);
 39         if (err)
 40                 return err;
 41
 42         gpio_direction_output(MMC_CHIP_SELECT_GPIO, 1);
 43
 44         return 0;
 45 }
 46
 47 static void ts72xx_mmc_spi_cleanup(struct spi_device *spi)
 48 {
 49         gpio_set_value(MMC_CHIP_SELECT_GPIO, 1);
 50         gpio_direction_input(MMC_CHIP_SELECT_GPIO);
 51         gpio_free(MMC_CHIP_SELECT_GPIO);
 52 }
 53
 54 static void ts72xx_mmc_spi_cs_control(struct spi_device *spi, int value)
 55 {
 56         gpio_set_value(MMC_CHIP_SELECT_GPIO, value);
 57 }
 58
 59 static struct ep93xx_spi_chip_ops ts72xx_mmc_spi_ops = {
 60         .setup          = ts72xx_mmc_spi_setup,
 61         .cleanup        = ts72xx_mmc_spi_cleanup,
 62         .cs_control     = ts72xx_mmc_spi_cs_control,
 63 };
 64
 65 static struct spi_board_info ts72xx_spi_devices[] __initdata = {
 66         {
 67                 .modalias               = "mmc_spi",
 68                 .controller_data        = &ts72xx_mmc_spi_ops,
 69                 /*
 70                  * We use 10 MHz even though the maximum is 7.4 MHz. The driver
 71                  * will limit it automatically to max. frequency.
 72                  */
 73                 .max_speed_hz           = 10 * 1000 * 1000,
 74                 .bus_num                = 0,
 75                 .chip_select            = 0,
 76                 .mode                   = SPI_MODE_0,
 77         },
 78 };
 79
 80 static struct ep93xx_spi_info ts72xx_spi_info = {
 81         .num_chipselect = ARRAY_SIZE(ts72xx_spi_devices),
 82 };
 83
 84 static void __init ts72xx_init_machine(void)
 85 {
 86         ...
 87         ep93xx_register_spi(&ts72xx_spi_info, ts72xx_spi_devices,
 88                             ARRAY_SIZE(ts72xx_spi_devices));
 89 }
 90
 91 The driver can use DMA for the transfers also. In this case ts72xx_spi_info
 92 becomes:
-驱动程序可以使用DMA转让也。在这种情况下ts72xx_spi_info变成:
 93
 94 static struct ep93xx_spi_info ts72xx_spi_info = {
 95         .num_chipselect = ARRAY_SIZE(ts72xx_spi_devices),
 96         .use_dma        = true;
 97 };
 98
 99 Note that CONFIG_EP93XX_DMA should be enabled as well.
-需要注意的是也应该启用CONFIG_EP93XX_DMA。
100
101 Thanks to
102 =========
103 Martin Guy, H. Hartley Sweeten and others who helped me during development of
104 the driver. Simplemachines.it donated me a Sim.One board which I used testing
105 the driver on EP9307.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值