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.

AM335X: GPMC connection to sync SRAM fails

Other Parts Discussed in Thread: AM3358

Hi,

    I have the GPMC configuration on a am3358 device:

-nandflash connect to CS0 of GPMC with async read/write, 8 bit device width.

-SRAM connect to CS1 of GPMC with non-multiplexed address/data bus, and sync read/write, 16 bit device width.

-use ti sdk 8.0, and kernel running from nandflash success.

    When I access SRAM, low pulse can be detect at CS1 pin, but no signal can be detect at gpmc_clk pin and can't

get right data.

    the following is my configuration in dts file:

&gpmc {
status = "okay";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&nandflash_pins_default>;
pinctrl-1 = <&nandflash_pins_sleep>;
ranges = <0 0 0x08000000 0x10000000 /* CS0: NAND */
1 0 0x13000000 0x1000000 /* CS1: dual_business 16M*/
>;
nand@0,0 {
reg = <0 0 0>; /* CS0, offset 0 */
ti,nand-ecc-opt = "bch8";
ti,elm-id = <&elm>;
nand-bus-width = <8>;
gpmc,device-width = <1>;
gpmc,sync-clk-ps = <0>;
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <44>;
gpmc,cs-wr-off-ns = <44>;
gpmc,adv-on-ns = <6>;
gpmc,adv-rd-off-ns = <34>;
gpmc,adv-wr-off-ns = <44>;
gpmc,we-on-ns = <0>;
gpmc,we-off-ns = <40>;
gpmc,oe-on-ns = <0>;
gpmc,oe-off-ns = <54>;
gpmc,access-ns = <64>;
gpmc,rd-cycle-ns = <82>;
gpmc,wr-cycle-ns = <82>;
gpmc,wait-on-read = "true";
gpmc,wait-on-write = "true";
gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>;
gpmc,clk-activation-ns = <0>;
gpmc,wait-monitoring-ns = <0>;
gpmc,wr-access-ns = <40>;
gpmc,wr-data-mux-bus-ns = <0>;
/* MTD partition table */
/* All SPL-* partitions are sized to minimal length
* which can be independently programmable. For
* NAND flash this is equal to size of erase-block */
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "NAND.SPL";
reg = <0x00000000 0x000020000>;
};
partition@1 {
label = "NAND.SPL.backup1";
reg = <0x00020000 0x00020000>;
};
partition@2 {
label = "NAND.SPL.backup2";
reg = <0x00040000 0x00020000>;
};
partition@3 {
label = "NAND.SPL.backup3";
reg = <0x00060000 0x00020000>;
};
partition@4 {
label = "NAND.u-boot-spl-os";
reg = <0x00080000 0x00040000>;
};
partition@5 {
label = "NAND.u-boot";
reg = <0x000C0000 0x00100000>;
};
partition@6 {
label = "NAND.u-boot-env";
reg = <0x001C0000 0x00020000>;
};
partition@7 {
label = "NAND.u-boot-env.backup1";
reg = <0x001E0000 0x00020000>;
};
partition@8 {
label = "NAND.kernel";
reg = <0x00200000 0x00800000>;
};
partition@9 {
label = "NAND.rootfs";
reg = <0x00700000 0x0F900000>;
};
};

nor@1,0 {
compatible = "cfi-flash";
linux,mtd-name= "intel,pf48f6000m0y1be";
#address-cells = <1>;
#size-cells = <1>;
reg = <1 0 0x1000000>; /* CS1, offset 0 */
bank-width = <2>;

gpmc,sync-read;
gpmc,sync-write;
gpmc,wait-pin = <0>;
gpmc,wait-on-read;
gpmc,wait-on-write;
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <186>;
gpmc,cs-wr-off-ns = <186>;
gpmc,adv-on-ns = <12>;
gpmc,adv-rd-off-ns = <48>;
gpmc,adv-wr-off-ns = <48>;
gpmc,oe-on-ns = <54>;
gpmc,oe-off-ns = <168>;
gpmc,we-on-ns = <54>;
gpmc,we-off-ns = <168>;
gpmc,rd-cycle-ns = <186>;
gpmc,wr-cycle-ns = <186>;
gpmc,access-ns = <114>;
gpmc,page-burst-access-ns = <6>;
gpmc,bus-turnaround-ns = <12>;
gpmc,cycle2cycle-delay-ns = <18>;
gpmc,wr-data-mux-bus-ns = <90>;
gpmc,wr-access-ns = <186>;
gpmc,cycle2cycle-samecsen;
gpmc,cycle2cycle-diffcsen;

partition@0 {
label = "dual-nor";
reg = <0 0x1000000>;
};
};

What's wrong with my configuration?

Best Regards!

  • Hi,

    Have you checked your GPMC_CLK pinmux? Can you post it?
  • Hi,

    The gpmc_clk pinmux configuration:
    0x8c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_clk.gpmc_clk */

    Best Regards!
    Jiqingkai
  • The software team will check the device tree settings and respond here.
  • Hi Biser,
    Thanks!

    All gpmc pinmux should be useful, I post following:
    nandflash_pins_default: nandflash_pins_default {
    pinctrl-single,pins = <
    0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
    0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
    0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
    0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
    0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
    0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
    0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
    0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */

    0x20 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad8.gpmc_ad8 */
    0x24 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad9.gpmc_ad9 */
    0x28 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad10.gpmc_ad10 */
    0x2c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad11.gpmc_ad11 */
    0x30 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad12.gpmc_ad12 */
    0x34 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad13.gpmc_ad13 */
    0x38 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad14.gpmc_ad14 */
    0x3c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad15.gpmc_ad15 */
    0xa4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data1.gpmc_a1 */
    0xa8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data2.gpmc_a2 */
    0xac (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data3.gpmc_a3 */
    0xb0 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data4.gpmc_a4 */
    0xb4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data5.gpmc_a5 */
    0xb8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data6.gpmc_a6 */
    0xbc (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data7.gpmc_a7 */
    0xe0 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_vsync.gpmc_a8 */
    0xe4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_hsync.gpmc_a9 */
    0xe8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_pclk.gpmc_a10 */
    0xec (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_ac_bias_en.gpmc_a11 */
    0xc0 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data8.gpmc_a12 */
    0xc4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data9.gpmc_a13 */
    0xc8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data10.gpmc_a14 */
    0xcc (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data11.gpmc_a15 */
    0xd0 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data12.gpmc_a16 */
    0xd4 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data13.gpmc_a17 */
    0xd8 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data14.gpmc_a18 */
    0xdc (PIN_OUTPUT_PULLUP | MUX_MODE1) /* lcd_data15.gpmc_a19 */

    0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
    0x74 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_30 */
    0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
    0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
    0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
    0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
    0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */

    /* 0x74 0x12 * (PIN_OUTPUT | MUX_MODE2 | PULLUP) * gpmc_wpn.gpmc_csn5 */
    /* 0x78 0x12 * (PIN_OUTPUT | MUX_MODE2 | PULLUP) * gpmc_be1n.gpmc_csn6 */

    0x80 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* gpmc_csn1.gpmc_csn1 */
    0x84 (PIN_OUTPUT_PULLUP | MUX_MODE1) /* gpmc_cs2.gpmc_be1n */
    /* 0x88 0x10 * (PIN_OUTPUT | MUX_MODE0) * gpmc_cs3.gpmc_cs3 */
    0x8c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_clk.gpmc_clk */
    >;
    };

    nandflash_pins_sleep: nandflash_pins_sleep {
    pinctrl-single,pins = <
    0x0 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x4 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x8 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0xc (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x10 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x14 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x18 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x1c (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x74 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x7c (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x98 (PIN_INPUT_PULLDOWN | MUX_MODE7)
    0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7)
    >;
    };

    Best Regards!
    Jiqingkai
  • Hi,

    See this thread:
    e2e.ti.com/.../1860926

    It contains dts examples of interfacing GPMC with NAND and SRAM. It should be relevant to all your questions.

    Best Regards,
    Yordan
  • Hi Yordan,

    Thank you for your anwer!
    In the post you give, SRAM connect to gpmc is async SRAM, not sync SRAM. Did you have an example of gpmc connect with async nand & sync SRAM?
    Now, I can detect output at gpmc_clk pin, but I meet the trouble:
    1. It seems I can't get right data;
    2. Access the SRAM space(configued as 0x13000000), may be affect nand, output message like:

    root@am335x-evm:~# rmmod dualram_dev.ko
    [ 693.100338] UBI warning: ubi_io_read: error -74 (ECC error) while reading 176 bytes from PEB 45:55712, read only 176 bytes, retry
    [ 693.113791] UBI warning: ubi_io_read: error -74 (ECC error) while reading 176 bytes from PEB 45:55712, read only 176 bytes, retry
    [ 693.126891] UBI warning: ubi_io_read: error -74 (ECC error) while reading 176 bytes from PEB 45:55712, read only 176 bytes, retry
    [ 693.139917] UBI error: ubi_io_read: error -74 (ECC error) while reading 176 bytes from PEB 45:55712, read 176 bytes
    [ 693.150868] CPU: 0 PID: 1208 Comm: sh Tainted: G O 3.14.26-g07d13c6-dirty #7
    [ 693.159164] Backtrace:
    [ 693.161759] [<c0011268>] (dump_backtrace) from [<c0011404>] (show_stack+0x18/0x1c)
    [ 693.169690] r6:dda9b000 r5:000000b0 r4:ffffffb6 r3:00000000
    [ 693.175638] [<c00113ec>] (show_stack) from [<c04ba7f0>] (dump_stack+0x20/0x28)

    Best Regards!
    Jiqingkai
  • Hi Yordan,

    About the dts file, I have some questions:
    1, For nand configuration(cs0) as below:
    &gpmc {
    status = "okay";
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&nandflash_pins_default>;
    pinctrl-1 = <&nandflash_pins_sleep>;
    ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
    nand@0,0 {
    reg = <0 0 0>; /* CS0, offset 0 */
    why the "reg=<0 0 0 >" , but "reg = <0 0 0x10000000>"?

    2, The same configuration before, when linux running, I read the gpmc register of 0x78(gpmc_config7_0), the result is 0x00000F41, but 0x00000048. why?

    root@am335x-evm:~# devmem2 0x50000078
    /dev/mem opened.
    Memory mapped at address 0xb6f7c000.
    Read at address 0x50000078 (0xb6f7c078): 0x00000F41
    root@am335x-evm:~#

    Best Regards!
    Jiqingkai
  • More information:
    dts configuration:
    &gpmc {
    status = "okay";
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&nandflash_pins_default>;
    pinctrl-1 = <&nandflash_pins_sleep>;
    ranges = <0 0 0x08000000 0x10000000 /* CS0: NAND */
    1 0 0x18000000 0x1000000 /* CS1: dual_business 16M*/
    >;
    nand@0,0 {
    reg = <0 0 0>; /* CS0, offset 0 */

    Read gpmc_config7_0 & gpmc_config7_1:

    root@am335x-evm:~# devmem2 0x50000078
    /dev/mem opened.
    Memory mapped at address 0xb6f4b000.
    Read at address 0x50000078 (0xb6f4b078): 0x00000F41
    root@am335x-evm:~# devmem2 0x500000a8
    /dev/mem opened.
    Memory mapped at address 0xb6f20000.
    Read at address 0x500000A8 (0xb6f200a8): 0x00000F58
    root@am335x-evm:~#

    Best Regards!
    Jiqingkai
  • Hi Yordan, Biser,

       Thank you for your help!

       I can work normally with the gpmc connect to async-nand and sync-SRAM. But, I have some questions please:

    Q1:  About Ti sdk8.0, whether the address space of nand which defined in dts( as "ranges = <0 0 0x08000000 0x10000000 /* CS0: NAND */ ) can be modified ?

    Q2:  In u-boot, I set m4 of dpll_core_opp100 to 20, then gpmc_fclk is 50M Hz. So, can access nand normally after accessing SRAM. However I don't hnow the reason.

    Q3: Why has about 380 ns delay between two read cycle? (cache, MMU or other ?)

    Best Regards!

    Jiqingkai