This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/TMDSCSK8127:Atmel spl 闪存支持 SPI 闪存写入器实用程序和 u-boot

Guru**** 2905430 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/662134/linux-tmdscsk8127-atmel-spl-flash-support-for-spi-flash-writer-utility-and-u-boot

器件型号:TMDSCSK8127

工具/软件:Linux

拥有围绕8127设计的定制硬件、并使用 Atmel SPI 闪存部件进行 u-boot。

希望在 SPI-flash-writer 实用程序和 u-boot 中添加 Atmel SPI 闪存支持。

我已经附上了 SPI_FLASH_c 中的代码片段、其中为8127评估板定义了 Atmel 支持#defined。  

此代码是否可用、以便我可以在实用程序中添加对 Atmel 部件的支持?

此外、是否有源代码和相关的构建和生成文件可用于配置 Atmel SPI 的 u-boot?

Steve

struct spi_flash * spi_flash_probe (unsigned int bus、unsigned int cs、
      unsigned int max_Hz、unsigned int SPI_MODE)

   struct spi_slave *spi;
   struct spi_flash *闪存;
   内转台;
   uint8 idcode[3];

   SPI =(struct spi_slave *) spi_setup_slave (bus、cs、max_Hz、spi_mode);
   如果(!SPI){
      printf ("SF:设置从属设备失败\n");
      返回空;
   }

   RET = SPI_REACK_BUS (SPI);
   如果(RET){
      printf ("SF:无法请求 SPI 总线:%d\n"、ret);
      转至 ERR_REACK_BUS;
   }

   /*读取 ID 代码*/
   RET = SPI_FLASH_cmd (SPI、CMD_READ_ID、&idcode、sizeof (idcode));
   IF (RET)
      转至 ERR_READ_ID;

   printf ("SF:获取 idcode %02x %02x %02x\n"、idcode[0]、
         idcode[1]、idcode[2]);

   switch (idcode[0]){
#ifdef CONFIG_SPI_FLASH_Spansion
   情况0x01:
      闪存= SPI_FLASH_PROBLE_Spansion (SPI、idcode);
      中断;
#endif
#ifdef CONFIG_SPI_FLASH_Atmel
   情况0x1F:
      FLASH = SPI_FLASH_PROBLE_Atmel (SPI、idcode);
      中断;
#endif
#ifdef CONFIG_SPI_FLASH_Winbond
   情况0xef:
      闪存= SPI_FLASH_PROBLE_Winbond (SPI、idcode);
      中断;
#endif
#ifdef CONFIG_SPI_FLASH_STMICRO
   情况0x20:
      闪存= SPI_FLASH_PROBLE_STMICRO (SPI、idcode);
      中断;
#endif
   默认值:
      printf ("SF:不支持的制造商%02x\n"、idcode[0]);
      闪存=空;
      中断;
   }

   如果(!FLASH)
      转至 ERR_Manufacturer_probe;

   SPI_RELEASE_BUS (SPI);

   返回闪存;

ERR_Manufacturer_probe:
ERR_READ_ID:
   SPI_RELEASE_BUS (SPI);
ERR_REACK_BUS:
   SPI_FREE_SLAVE (SPI);
   返回空;