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.

[参考译文] AM625:如何使用 GPMC 连接 SRAM。

Guru**** 2407620 points


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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1476248/am625-how-to-interface-sram-using-gpmc

器件型号:AM625

工具与软件:

gpmc0引脚:-

	gpmc0_pins_default: gpmc0-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x00b8, PIN_OUTPUT, 1) /* (U22) VOUT0_DATA0.GPMC0_A0 */
			AM62X_IOPAD(0x00bc, PIN_OUTPUT, 1) /* (V24) VOUT0_DATA1.GPMC0_A1 */
			AM62X_IOPAD(0x00e0, PIN_OUTPUT, 1) /* (V20) VOUT0_DATA10.GPMC0_A10 */
			AM62X_IOPAD(0x00e4, PIN_OUTPUT, 1) /* (AA23) VOUT0_DATA11.GPMC0_A11 */
			AM62X_IOPAD(0x00c0, PIN_OUTPUT, 1) /* (W25) VOUT0_DATA2.GPMC0_A2 */
			AM62X_IOPAD(0x00c4, PIN_OUTPUT, 1) /* (W24) VOUT0_DATA3.GPMC0_A3 */
			AM62X_IOPAD(0x00c8, PIN_OUTPUT, 1) /* (Y25) VOUT0_DATA4.GPMC0_A4 */
			AM62X_IOPAD(0x00cc, PIN_OUTPUT, 1) /* (Y24) VOUT0_DATA5.GPMC0_A5 */
			AM62X_IOPAD(0x00d0, PIN_OUTPUT, 1) /* (Y23) VOUT0_DATA6.GPMC0_A6 */
			AM62X_IOPAD(0x00d4, PIN_OUTPUT, 1) /* (AA25) VOUT0_DATA7.GPMC0_A7 */
			AM62X_IOPAD(0x00d8, PIN_OUTPUT, 1) /* (V21) VOUT0_DATA8.GPMC0_A8 */
			AM62X_IOPAD(0x00dc, PIN_OUTPUT, 1) /* (W21) VOUT0_DATA9.GPMC0_A9 */
			AM62X_IOPAD(0x003c, PIN_INPUT, 0) /* (M25) GPMC0_AD0 */
			AM62X_IOPAD(0x0040, PIN_INPUT, 0) /* (N23) GPMC0_AD1 */
			AM62X_IOPAD(0x0064, PIN_INPUT, 0) /* (T25) GPMC0_AD10 */
			AM62X_IOPAD(0x0068, PIN_INPUT, 0) /* (R21) GPMC0_AD11 */
			AM62X_IOPAD(0x006c, PIN_INPUT, 0) /* (T22) GPMC0_AD12 */
			AM62X_IOPAD(0x0070, PIN_INPUT, 0) /* (T24) GPMC0_AD13 */
			AM62X_IOPAD(0x0074, PIN_INPUT, 0) /* (U25) GPMC0_AD14 */
			AM62X_IOPAD(0x0078, PIN_INPUT, 0) /* (U24) GPMC0_AD15 */
			AM62X_IOPAD(0x0044, PIN_INPUT, 0) /* (N24) GPMC0_AD2 */
			AM62X_IOPAD(0x0048, PIN_INPUT, 0) /* (N25) GPMC0_AD3 */
			AM62X_IOPAD(0x004c, PIN_INPUT, 0) /* (P24) GPMC0_AD4 */
			AM62X_IOPAD(0x0050, PIN_INPUT, 0) /* (P22) GPMC0_AD5 */
			AM62X_IOPAD(0x0054, PIN_INPUT, 0) /* (P21) GPMC0_AD6 */
			AM62X_IOPAD(0x0058, PIN_INPUT, 0) /* (R23) GPMC0_AD7 */
			AM62X_IOPAD(0x005c, PIN_INPUT, 0) /* (R24) GPMC0_AD8 */
			AM62X_IOPAD(0x0060, PIN_INPUT, 0) /* (R25) GPMC0_AD9 */
			AM62X_IOPAD(0x0098, PIN_INPUT, 0) /* (U23) GPMC0_WAIT0 */
			AM62X_IOPAD(0x00b0, PIN_OUTPUT, 0) /* (K22) GPMC0_CSn2 */
			AM62X_IOPAD(0x0088, PIN_OUTPUT, 0) /* (L24) GPMC0_OEn_REn */
			AM62X_IOPAD(0x008c, PIN_OUTPUT, 0) /* (L25) GPMC0_WEn */
		>;
	};

GPMC0节点:-

&gpmc0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&gpmc0_pins_default>;
        ranges = <2 0 0x0 0x51000000 0x00800000>; /* 8MB */

	#address-cells = <2>;
	#size-cells = <1>;


	
 sram@08000000 {
        compatible = "cypress,cy7c02av";
        reg = <2 0 64>;
        #address-cells = <1>;
        #size-cells = <1>;

        gpmc,cs = <2>;
        gpmc,device-width = <2>; /* 16-bit DPRAM */
        gpmc,mux-add-data = <0>; /* No address/data mux */
        gpmc,wait-pin = <0>; /* No wait pin required */

        /* Corrected Timing Parameters for 25 ns cycle */
        gpmc,cs-on-ns      = <10>;
        gpmc,cs-rd-off-ns  = <30>;
        gpmc,cs-wr-off-ns  = <30>;

        gpmc,adv-on-ns     = <0>;
        gpmc,adv-rd-off-ns = <30>;
        gpmc,adv-wr-off-ns = <30>;

        gpmc,we-on-ns      = <10>;
        gpmc,we-off-ns     = <30>;
        gpmc,oe-on-ns      = <10>;
        gpmc,oe-off-ns     = <30>;

        gpmc,rd-cycle-ns   = <25>;
        gpmc,wr-cycle-ns   = <25>;
        gpmc,access-ns     = <20>;
        gpmc,wr-access-ns  = <20>;

        gpmc,cycle2cycle-delay-ns = <10>;
        gpmc,wr-data-mux-bus-ns   = <10>;
        gpmc,bus-turnaround-ns    = <10>;

        /* Removed unsupported burst settings */
    };

};

问题:内存未映射/proc/iomem

root@phyboard-lyra-am62xx-3:~# cat /proc/iomem
000f4000-000f42ab : pinctrl-single
00600000-006000ff : 600000.gpio gpio@600000
00601000-006010ff : 601000.gpio gpio@601000
00b00000-00b003ff : b00000.temperature-sensor temperature-sensor@b00000
00b01000-00b013ff : b00000.temperature-sensor temperature-sensor@b00000
01800000-0180ffff : GICD
01880000-0193ffff : GICR
02400000-024003ff : 2400000.timer timer@2400000
02410000-024103ff : 2410000.timer timer@2410000
02420000-024203ff : 2420000.timer timer@2420000
02430000-024303ff : 2430000.timer timer@2430000
02440000-024403ff : 2440000.timer timer@2440000
02450000-024503ff : 2450000.timer timer@2450000
02460000-024603ff : 2460000.timer timer@2460000
02470000-024703ff : 2470000.timer timer@2470000
02800000-0280001f : serial
02810000-0281001f : serial
04084000-04084087 : pinctrl-single
05000000-0502ffff : 5000000.m4fss
05040000-0504ffff : 5000000.m4fss
08000000-081fffff : 8000000.ethernet cpsw_nuss
0e000000-0e0000ff : e000000.watchdog watchdog@e000000
0e010000-0e0100ff : e010000.watchdog watchdog@e010000
0f900000-0f9007ff : f900000.dwc3-usb dwc3-usb@f900000
0f908000-0f9083ff : f900000.dwc3-usb dwc3-usb@f900000
0f910000-0f9107ff : f910000.dwc3-usb dwc3-usb@f910000
0f918000-0f9183ff : f910000.dwc3-usb dwc3-usb@f910000
0fa00000-0fa00fff : fa00000.mmc mmc@fa00000
0fa08000-0fa083ff : fa00000.mmc mmc@fa00000
0fa10000-0fa10fff : fa10000.mmc mmc@fa10000
0fa18000-0fa183ff : fa10000.mmc mmc@fa10000
0fc40000-0fc400ff : fc40000.spi spi@fc40000
20000000-200000ff : 20000000.i2c i2c@20000000
20010000-200100ff : 20010000.i2c i2c@20010000
29000000-290001ff : 29000000.mailbox mailbox@29000000
2a000000-2a000fff : 2a000000.spinlock spinlock@2a000000
2b1f0000-2b1f00ff : 2b1f0000.rtc rtc@2b1f0000
30060000-30061fff : 30060000.interrupt-controller interrupt-controller@20000
30062000-300620ff : 30074000.pru control
30062400-300624ff : 30074000.pru debug
30064000-300640ff : 30078000.pru control
30064400-300644ff : 30078000.pru debug
30074000-30076fff : 30074000.pru iram
30078000-3007afff : 30078000.pru iram
30300000-30300fff : 30300000.mcrc mcrc@30300000
31100000-31107fff : usb@31100000
  31100000-31107fff : xhci-hcd.4.auto usb@31100000
3110c100-3114ffff : 31100000.usb usb@31100000
3b000000-3b0003ff : 3b000000.memory-controller cfg
40900000-409011ff : 40900000.crypto crypto@40900000
44043000-44043fdf : 44043000.system-controller debug_messages
48000000-480fffff : 48000000.interrupt-controller interrupt-controller@48000000
485c0000-485c00ff : 485c0000.dma-controller gcfg
485c0100-485c01ff : 485c0100.dma-controller gcfg
4a400000-4a47ffff : 4d000000.mailbox scfg
4a600000-4a67ffff : 4d000000.mailbox rt
4a800000-4a81ffff : 485c0000.dma-controller rchanrt
4a820000-4a83ffff : 485c0100.dma-controller rchanrt
4aa00000-4aa3ffff : 485c0000.dma-controller tchanrt
4aa40000-4aa5ffff : 485c0100.dma-controller tchanrt
4b800000-4bbfffff : 485c0000.dma-controller ringrt
4bc00000-4bcfffff : 485c0100.dma-controller ringrt
4c000000-4c01ffff : 485c0100.dma-controller bchanrt
4d000000-4d07ffff : 4d000000.mailbox target_data
70000000-7000ffff : 70000000.sram sram@70000000
80000000-9c7fffff : System RAM
  82010000-8311ffff : Kernel code
  83120000-8334ffff : reserved
  83350000-8351ffff : Kernel data
  87fff000-87ffffff : reserved
  8ffed000-8fffbfff : reserved
  9c700000-9c7fffff : reserved
9c800000-9e6fffff : reserved
9e700000-9e77ffff : System RAM
9e780000-9fffffff : reserved
a0000000-bfffffff : System RAM
  b6c00000-b7bfffff : reserved
  b7c14000-b7d94fff : reserved
  b7d95000-b7dbafff : reserved
  b7dbd000-b7dbffff : reserved
  b7dc0000-b7dd0fff : reserved
  b7dd1000-bfffffff : reserved
500000000-5ffffffff : fc40000.spi spi@fc40000

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

    您好!

    请附加内核引导日志。

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

    请查看随附的内核启动日志 file.e2e.ti.com/.../7230.boot_5F00_log.txt

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

    尊敬的 Shrihant:

    我使用 k3-am62-LP-sk-nand.dtbo devicetree 运行了 SDK9.2预编译 SD 卡 WIC 映像以启用 GPMC NAND、并且也没有在/proc/iomem 中看到地址0x51000000已映射。 因此、我认为不会映射它。

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

    感谢您的检查。 我知道0x51000000未/proc/iomem与 SDK9.2预编译映像和k3-am62-lp-sk-nand.dtbo进行映射。 然而,我能够读取有效的数据使用devmem2 0x51000000 w,这表明内存是可访问的,但它不是 SRAM 是我正在尝试实现。

    您能解释一下为什么会发生这种行为吗? 是否有其他方法可以验证映射、还是应该检查特定的 GPMC 配置以确认设置正确?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    但是我尝试实施的不是 SRAM。

    您能解释一下您是如何检查它不是 SRAM 的吗?

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

    感谢您的答复。

    DPRAM 按如下方式在 AM62 SOM 和 TMS320F28355 DSP 之间连接:

    • DPRAM 具有两个端口:一个通过 GPMC 接口连接到 AM62 SOM、另一个连接到 DSP。
    • DSP 可以成功地在预期地址读取数据并将数据写入 DPRAM。
    • 但是、当尝试从 SOM 侧读取相同的存储器位置时、我看不到 DSP 写入的预期数据。  

    这表明 AM62 SOM 上的 GPMC 接口未正确配置以确保 SRAM (DPRAM)正常运行。 您能否建议使用任何特定的寄存器或调试方法来验证 GPMC 是否正确处理 DPRAM 事务?

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

    如果使用 devmem2命令将字写入地址0x51000000、您是否读回相同的值?

    # devmem2 0x51000000 w 0x12345678
    # devmem2 0x51000000 w

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

    root@phyboard-lyra-am62xx-3:~# devmem2 0x51000000 w 0x12345678
    /dev/mem opened.
    Memory mapped at address 0xffffa3410000.
    Read at address  0x51000000 (0xffffa3410000): 0x374B374B
    Write at address 0x51000000 (0xffffa3410000): 0x12345678, readback 0x12345678
    
    
    
    root@phyboard-lyra-am62xx-3:~# devmem2 0x51000000
    /dev/mem opened.
    Memory mapped at address 0xffff823d7000.
    Read at address  0x51000000 (0xffff823d7000): 0x12341234
    
    
    
    root@phyboard-lyra-am62xx-3:~# devmem2 0x51000000 h 0x1234
    /dev/mem opened.
    Memory mapped at address 0xffff8da38000.
    Read at address  0x51000000 (0xffff8da38000): 0x1234
    Write at address 0x51000000 (0xffff8da38000): 0x1234, readback 0x1234
    

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

    尊敬的 Shrikant:

    似乎您只能访问该字的一半。

    您是否已使用 SRAM 器件数据表验证 GPMC 总线波形以查看 DTS 中的 GPMC 配置参数是否符合数据表?

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

    我会与我们的 GPMC 硬件专家一起简要运行 DTS 配置、时序配置似乎太快、但您需要将总线波形与 SRAM 器件数据表进行比较。

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

    符合  CY7C024AV DPRAM 数据表  

    • 读取周期参数

      • 总读取周期

        • TRC (读取周期时间)= 25ns
        • gpmc,rd-cycle-ns = <25>;
      • 片选时序

        • tACE (CE 低电平至数据有效)= 25ns
        • tHZCE (CE 高电平至高阻抗)= 15ns
        • gpmc,cs-on-ns = <10>;
        • gpmc,cs-rd-off-ns = <30>;
      • 地址到数据有效

        • TAA (地址到数据有效)= 25ns
        • gpmc,access-ns = <20>;
      • 输出使能时序

        • tDOE (OE 低电平至数据有效)= 13ns
        • tHZOE (OE 高阻抗至高阻抗)= 15ns
        • gpmc,oe-on-ns = <10>;
        • gpmc,oe-off-ns = <30>;
    • 写入周期参数

      • 总写入周期

        • tWC (写入周期时间)= 25ns
        • gpmc,wr-cycle-ns = <25>;
      • 片选时序

        • tSCE (CE 低电平至写入结束)= 20ns
        • gpmc,cs-wr-off-ns = <30>;
      • 写入使能时序

        • tPWE (写入脉冲宽度)= 20ns
        • TSD (数据设置至写入结束)= 15ns
        • gpmc,we-on-ns = <10>;
        • gpmc,we-off-ns = <30>;
        • gpmc,wr-access-ns = <20>;
      • 地址设置和保持

        • TSA (写入开始的地址设置)= 0ns
        • Tha (写入结束时的地址保持)= 0ns
        • gpmc,adv-on-ns = <0>;
    • 周期到周期延迟

      • tWDD (将脉冲写入数据延迟)= 50ns
      • tBDD (繁忙高电平至数据有效)= 25ns
      • gpmc,cycle2cycle-delay-ns = <10>;
      • gpmc,bus-turnaround-ns = <10>;
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    一个示例:

    片选时序

    • tACE (CE 低电平至数据有效)= 25ns
    • tHZCE (CE 高电平至高阻抗)= 15ns
    • gpmc,cs-on-ns = <10>;
    [报价]

    10ns 设置不符合数据表要求- 25ns。 请使用器件数据表验证所有 GPMC 配置。

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

    但在一些 AM335x e2e 讨论中,我可以看到在 /proc/iomem 中映射了 GPMC。

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

    这周,他的表现很好。 敬请期待下周的答复。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    但在一些 AM335x e2e 讨论中、我可以看到 GPMC 映射到 /proc/iomem 中。

    请提供这些 E2E 主题的链接。

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

    1.  我可以在 cat /proc/iomem 中看到 GPMC   

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1164995/am5749-am5749-gpmc-setting-for-connect-fpga-is-not-correct-on-am5749-custom-board/4382028#4382028

    root@am57xx-evm:~# cat /proc/iomem
    40300000-4037ffff : 40300000.ocmcram ocmcram@40300000
    40d01000-40d010ff : 40d01000.mmu mmu@0
    40d02000-40d020ff : 40d02000.mmu mmu@0
    41501000-415010ff : 41501000.mmu mmu@0
    41502000-415020ff : 41502000.mmu mmu@0
    43300000-433fffff : 43300000.dma edma3_cc
    44000000-44ffffff : 44000000.ocp ocp
    45000000-45000fff : 44000000.ocp ocp
    48020000-4802001f : serial
    48034000-4803407f : 48034000.timer timer@0
    48036000-4803607f : 48036000.timer timer@0
    4803e000-4803e07f : 4803e000.timer timer@0
    48051000-480511ff : 48051000.gpio gpio@0
    48053000-480531ff : 48053000.gpio gpio@0
    48055000-480551ff : 48055000.gpio gpio@0
    48057000-480571ff : 48057000.gpio gpio@0
    48059000-480591ff : 48059000.gpio gpio@0
    4805b000-4805b1ff : 4805b000.gpio gpio@0
    4805d000-4805d1ff : 4805d000.gpio gpio@0
    48070000-480700ff : 48070000.i2c i2c@0
    48086000-4808607f : 48086000.timer timer@0
    
    ...
    
    4ae07e34-4ae07e37 : 4ae07e34.regulator-abb-ivahd setup-address
    4ae0c154-4ae0c157 : 4ae07de4.regulator-abb-gpu ldo-address
    4ae0c158-4ae0c15b : 4ae07ddc.regulator-abb-mpu ldo-address
    4ae10000-4ae101ff : 4ae10000.gpio gpio@0
    4ae20000-4ae2007f : 4ae20000.timer timer@0
    50000000-5000037b : 50000000.gpmc gpmc@50000000
    55082000-550820ff : 55082000.mmu mmu@0
    58000000-5800007f : 58000000.dss dss
    58001000-58001fff : 58001000.dispc dispc@0
    58004054-58004057 : 58000000.dss pll1_clkctrl
    58004300-5800431f : 58000000.dss pll1
    58009054-58009057 : 58000000.dss pll2_clkctrl
    58009300-5800931f : 58000000.dss pll2
    58882000-588820ff : 58882000.mmu mmu@0
    80000000-afcfffff : System RAM
    80008000-80ffffff : Kernel code
    81200000-812fc00f : Kernel data
    b0000000-ffffffff : System RAM
    root@am57xx-evm:~#
                                                            

    2.访问时 CS2不会切换devmem2 0x51000000 w 0x12345678、但当设置为 GPIO (多路复用模式7)时、它会正确切换。 我相信、即使 GPMC 时序不正确、它也应该切换。  

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

    让我在 AM64x EVM 上查看这一点、马上给您答复。