SK-AM62A-LP: GPMC 没有按配置输出时序信号

Part Number: SK-AM62A-LP

Ti工程师,你好!

我在SK-AM62A-LP 官方开发板上利用GPMC接口驱动OLED屏,采用以下接法:NOR FLASH,8位,地址数据不复用的方式。但测试时序时发现两个问题:

1、时序没有按照寄存器配置的值输出信号。

2、在写操作时,会触发到OE即读使能信号。

我的测试方法如下:

在板子跑起来后,在串口终端输出如下命令:

写操作命令:devmem2 0x503FFFF8 b 0xda
读操作命令:devmem2 0x50400000 b

请帮忙分析一下原因。

详细看下面的抓图。

图1:写命令触发到OE信号,然后才是WE信号。

图2:CS值异常,没有按配置的输出。我配置的CS值是480ns,但输出的信号CS值只有70ns。同样WE值也不对。

图3:串口写操作,读操作命令

我的LOG, GPMC打印如下:

[ 1.044275] omap-gpmc 3b000000.memory-controller: gpmc_probe 17:57,cjk1216
[ 1.051336] omap-gpmc 3b000000.memory-controller: gpmc_probe 2b,cjk1216
[ 1.058115] omap-gpmc 3b000000.memory-controller: gpmc_probe 2c,cjk1216
[ 1.064882] omap-gpmc 3b000000.memory-controller: gpmc_probe 2d,cjk1216
[ 1.071647] omap-gpmc 3b000000.memory-controller: gpmc_probe 3,cjk1216
[ 1.078379] omap-gpmc 3b000000.memory-controller: gpmc_probe 4,cjk1216
[ 1.085142] omap-gpmc 3b000000.memory-controller: gpmc_probe 5 after clk_prepare_enable,cjk1216
[ 1.094054] omap-gpmc 3b000000.memory-controller: gpmc_probe 6,cjk1216, GPMC fck clk_rate=25000000.
[ 1.103314] omap-gpmc 3b000000.memory-controller: gpmc_probe 7,cjk1216
[ 1.109991] omap-gpmc 3b000000.memory-controller: gpmc_probe 8,cjk1216
[ 1.116671] omap-gpmc 3b000000.memory-controller: gpmc_probe 9,cjk1216
[ 1.123347] omap-gpmc 3b000000.memory-controller: GPMC revision 6.0
[ 1.129760] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[ 1.136244] omap-gpmc 3b000000.memory-controller: gpmc_probe 10,cjk1216
[ 1.143070] omap-gpmc 3b000000.memory-controller: gpmc_probe 11,cjk1216
[ 1.149878] gpmc_probe_generic_child(2214):gpmc_cs_request, base=0x50000000, cjk1216
[ 1.149894] gpmc_read_timings_dt(2097): node name: oled, full-name:oled@1,0, cjk1216
[ 1.157824] gpmc_read_timings_dt(2108): cs-rd-off-ns:900, cs-wr-off-ns:480, cjk1216
[ 1.165782] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2245): node name=oled, cs=1, res.start=0x0000000050000000, res.end=0x0000000057ffffff,cjk1216
[ 1.188997] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2263)2222: node name=oled, cs=1, res.start=0x0000000050000000, res.end=0x0000000057ffffff,cjk1216
[ 1.204744] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2287): find child node: oled, cjk1216
[ 1.215155] gpmc cs1 =====================before gpmc_cs_program_settings=====================
[ 1.215155] :
[ 1.225562] cs1 GPMC_CS_CONFIG1: 0x00001000
[ 1.229839] cs1 GPMC_CS_CONFIG2: 0x00101001
[ 1.234115] cs1 GPMC_CS_CONFIG3: 0x22060514
[ 1.238392] cs1 GPMC_CS_CONFIG4: 0x10057016
[ 1.242669] cs1 GPMC_CS_CONFIG5: 0x010f1111
[ 1.246946] cs1 GPMC_CS_CONFIG6: 0x8f070000
[ 1.251227] gpmc cs1 access configuration:
[ 1.255418] gpmc,mux-add-data = <0>;
[ 1.259073] gpmc,device-width = <2>;
[ 1.262727] gpmc,wait-pin = <0>;
[ 1.266020] gpmc,burst-length = <4>;
[ 1.269678] gpmc cs1 timings configuration:
[ 1.273955] gpmc,cs-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.279837] gpmc,cs-rd-off-ns = <640>; /* 601 ns - 640 ns; 16 ticks */
[ 1.286515] gpmc,cs-wr-off-ns = <640>; /* 601 ns - 640 ns; 16 ticks */
[ 1.293192] gpmc,adv-on-ns = <160>; /* 121 ns - 160 ns; 4 ticks */
[ 1.299515] gpmc,adv-rd-off-ns = <200>; /* 161 ns - 200 ns; 5 ticks */
[ 1.306193] gpmc,adv-wr-off-ns = <240>; /* 201 ns - 240 ns; 6 ticks */
[ 1.312872] gpmc,adv-aad-mux-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.319550] gpmc,adv-aad-mux-rd-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.326671] gpmc,adv-aad-mux-wr-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.333792] gpmc,oe-on-ns = <240>; /* 201 ns - 240 ns; 6 ticks */
[ 1.340025] gpmc,oe-off-ns = <640>; /* 601 ns - 640 ns; 16 ticks */
[ 1.346436] gpmc,oe-aad-mux-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.353024] gpmc,oe-aad-mux-off-ns = <120>; /* 81 ns - 120 ns; 3 ticks */
[ 1.359968] gpmc,we-on-ns = <200>; /* 161 ns - 200 ns; 5 ticks */
[ 1.366200] gpmc,we-off-ns = <640>; /* 601 ns - 640 ns; 16 ticks */
[ 1.372610] gpmc,rd-cycle-ns = <680>; /* 641 ns - 680 ns; 17 ticks */
[ 1.379199] gpmc,wr-cycle-ns = <680>; /* 641 ns - 680 ns; 17 ticks */
[ 1.385788] gpmc,access-ns = <600>; /* 561 ns - 600 ns; 15 ticks */
[ 1.392198] gpmc,page-burst-access-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.399142] gpmc,bus-turnaround-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.405646] gpmc,cycle2cycle-delay-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.412412] gpmc,wait-monitoring-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.419004] gpmc,clk-activation-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.425503] gpmc,wr-data-mux-bus-ns = <280>; /* 241 ns - 280 ns; 7 ticks */
[ 1.432625] gpmc,wr-access-ns = <600>; /* 561 ns - 600 ns; 15 ticks */
[ 1.439303] gpmc_cs_program_settings(1955): cs=1, GPMC_CS_CONFIG1=0x00000000,cjk1216
[ 1.447224] GPMC CS1: cs_on : 1 ticks, 40 ns (was 1 ticks) 30 ns
[ 1.454881] GPMC CS1: cs_rd_off : 23 ticks, 920 ns (was 16 ticks) 900 ns
[ 1.462537] GPMC CS1: cs_wr_off : 12 ticks, 480 ns (was 16 ticks) 480 ns
[ 1.470192] GPMC CS1: adv_on : 1 ticks, 40 ns (was 4 ticks) 30 ns
[ 1.477847] GPMC CS1: adv_rd_off : 2 ticks, 80 ns (was 5 ticks) 45 ns
[ 1.485501] GPMC CS1: adv_wr_off : 2 ticks, 80 ns (was 6 ticks) 45 ns
[ 1.493156] GPMC CS1: adv_aad_mux_on : 0 ticks, 0 ns (was 1 ticks) 0 ns
[ 1.500811] GPMC CS1: adv_aad_mux_rd_off: 0 ticks, 0 ns (was 2 ticks) 0 ns
[ 1.508554] GPMC CS1: adv_aad_mux_wr_off: 0 ticks, 0 ns (was 2 ticks) 0 ns
[ 1.516297] GPMC CS1: oe_on : 2 ticks, 80 ns (was 6 ticks) 55 ns
[ 1.523955] GPMC CS1: oe_off : 13 ticks, 520 ns (was 16 ticks) 495 ns
[ 1.531614] GPMC CS1: oe_aad_mux_on : 0 ticks, 0 ns (was 1 ticks) 0 ns
[ 1.539269] GPMC CS1: oe_aad_mux_off : 0 ticks, 0 ns (was 3 ticks) 0 ns
[ 1.546924] GPMC CS1: we_on : 2 ticks, 80 ns (was 5 ticks) 45 ns
[ 1.554578] GPMC CS1: we_off : 12 ticks, 480 ns (was 16 ticks) 450 ns
[ 1.562233] GPMC CS1: rd_cycle : 24 ticks, 960 ns (was 17 ticks) 930 ns
[ 1.569888] GPMC CS1: wr_cycle : 13 ticks, 520 ns (was 17 ticks) 510 ns
[ 1.577543] GPMC CS1: access : 13 ticks, 520 ns (was 15 ticks) 505 ns
[ 1.585198] GPMC CS1: page_burst_access: 0 ticks, 0 ns (was 1 ticks) 0 ns
[ 1.592852] GPMC CS1: bus_turnaround : 0 ticks, 0 ns (was 0 ticks) 0 ns
[ 1.600506] GPMC CS1: cycle2cycle_delay: 1 ticks, 40 ns (was 0 ticks) 30 ns
[ 1.608161] GPMC CS1: wr_data_mux_bus : 0 ticks, 0 ns (was 7 ticks) 0 ns
[ 1.615815] GPMC CS1: wr_access : 0 ticks, 0 ns (was 15 ticks) 0 ns
[ 1.623471] GPMC CS1: wait_monitoring : 0 ticks, 0 ns (was 0 ticks) 0 ns
[ 1.631128] GPMC CS1: clk_activation : 0 ticks, 0 ns (was 0 ticks) 0 ns
[ 1.638783] GPMC CS1 CLK period is 40 ns (div 1)
[ 1.643506] gpmc cs1 after gpmc_cs_set_timings:
[ 1.648138] cs1 GPMC_CS_CONFIG1: 0x00000000
[ 1.652414] cs1 GPMC_CS_CONFIG2: 0x000c1701
[ 1.656694] cs1 GPMC_CS_CONFIG3: 0x00020201
[ 1.660971] cs1 GPMC_CS_CONFIG4: 0x0c020d02
[ 1.665247] cs1 GPMC_CS_CONFIG5: 0x000d0d18
[ 1.669523] cs1 GPMC_CS_CONFIG6: 0x80000100
[ 1.673800] gpmc cs1 access configuration:
[ 1.677986] gpmc,mux-add-data = <0>;
[ 1.681640] gpmc,device-width = <1>;
[ 1.685293] gpmc,wait-pin = <0>;
[ 1.688592] gpmc,burst-length = <4>;
[ 1.692249] gpmc cs1 timings configuration:
[ 1.696524] gpmc,cs-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.702401] gpmc,cs-rd-off-ns = <920>; /* 881 ns - 920 ns; 23 ticks */
[ 1.709078] gpmc,cs-wr-off-ns = <480>; /* 441 ns - 480 ns; 12 ticks */
[ 1.715755] gpmc,adv-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.721721] gpmc,adv-rd-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.728131] gpmc,adv-wr-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.734544] gpmc,adv-aad-mux-on-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.741042] gpmc,adv-aad-mux-rd-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.747896] gpmc,adv-aad-mux-wr-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.754751] gpmc,oe-on-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.760717] gpmc,oe-off-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 1.767127] gpmc,oe-aad-mux-on-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.773537] gpmc,oe-aad-mux-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.780040] gpmc,we-on-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.786006] gpmc,we-off-ns = <480>; /* 441 ns - 480 ns; 12 ticks */
[ 1.792417] gpmc,rd-cycle-ns = <960>; /* 921 ns - 960 ns; 24 ticks */
[ 1.799005] gpmc,wr-cycle-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 1.805593] gpmc,access-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 1.812003] gpmc,page-burst-access-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.818769] gpmc,bus-turnaround-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.825268] gpmc,cycle2cycle-delay-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.832211] gpmc,wait-monitoring-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.838801] gpmc,clk-activation-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.845300] gpmc,wr-data-mux-bus-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.851888] gpmc,wr-access-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.857942] gpmc cs1 ******************after gpmc_cs_set_timings***********************
[ 1.857942] :
[ 1.867727] cs1 GPMC_CS_CONFIG1: 0x00000000
[ 1.872004] cs1 GPMC_CS_CONFIG2: 0x000c1701
[ 1.876280] cs1 GPMC_CS_CONFIG3: 0x00020201
[ 1.880556] cs1 GPMC_CS_CONFIG4: 0x0c020d02
[ 1.884832] cs1 GPMC_CS_CONFIG5: 0x000d0d18
[ 1.889108] cs1 GPMC_CS_CONFIG6: 0x80000100
[ 1.893384] gpmc cs1 access configuration:
[ 1.897570] gpmc,mux-add-data = <0>;
[ 1.901224] gpmc,device-width = <1>;
[ 1.904882] gpmc,wait-pin = <0>;
[ 1.908182] gpmc,burst-length = <4>;
[ 1.911839] gpmc cs1 timings configuration:
[ 1.916115] gpmc,cs-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.921992] gpmc,cs-rd-off-ns = <920>; /* 881 ns - 920 ns; 23 ticks */
[ 1.928669] gpmc,cs-wr-off-ns = <480>; /* 441 ns - 480 ns; 12 ticks */
[ 1.935346] gpmc,adv-on-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 1.941312] gpmc,adv-rd-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.947725] gpmc,adv-wr-off-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.954136] gpmc,adv-aad-mux-on-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.960643] gpmc,adv-aad-mux-rd-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.967499] gpmc,adv-aad-mux-wr-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.974354] gpmc,oe-on-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 1.980320] gpmc,oe-off-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 1.986729] gpmc,oe-aad-mux-on-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.993139] gpmc,oe-aad-mux-off-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 1.999639] gpmc,we-on-ns = <80>; /* 41 ns - 80 ns; 2 ticks */
[ 2.005605] gpmc,we-off-ns = <480>; /* 441 ns - 480 ns; 12 ticks */
[ 2.012015] gpmc,rd-cycle-ns = <960>; /* 921 ns - 960 ns; 24 ticks */
[ 2.018603] gpmc,wr-cycle-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 2.025217] gpmc,access-ns = <520>; /* 481 ns - 520 ns; 13 ticks */
[ 2.031634] gpmc,page-burst-access-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.038401] gpmc,bus-turnaround-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.044901] gpmc,cycle2cycle-delay-ns = <40>; /* 1 ns - 40 ns; 1 ticks */
[ 2.051847] gpmc,wait-monitoring-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.058435] gpmc,clk-activation-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.064934] gpmc,wr-data-mux-bus-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.071521] gpmc,wr-access-ns = <0>; /* 0 ns - 0 ns; 0 ticks */
[ 2.078058] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2372): GPMC_CS_CONFIG1=0x00000000,cjk1216
[ 2.088834] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2375): GPMC_CS_CONFIG7=0x00000850,cjk1216
[ 2.099600] omap-gpmc 3b000000.memory-controller: gpmc_probe_generic_child(2377): end ok,cjk1216
[ 2.108590] omap-gpmc 3b000000.memory-controller: gpmc_probe end ok,cjk1216

-----------------------------------------

我的dtsi配置如下:

1)k3-am62a-main.dtsi添加了以下语句:


gpmc0: memory-controller@3b000000 {
compatible = "ti,am64-gpmc";
power-domains = <&k3_pds 80 TI_SCI_PD_EXCLUSIVE>;
/*clocks = <&k3_clks 80 0>; 1mclk=7.5ns, 133MHz*/
clocks = <&k3_clks 161 3>; /*1mclk= 40ns, 25HMz*/
/*clocks = <&k3_clks 191 0>; 1mclk= 10ns*/

clock-names = "fck";
reg = <0x00 0x03b000000 0x00 0x400>,
<0x00 0x050000000 0x00 0x8000000>;
reg-names = "cfg", "data";
interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
gpmc,num-cs = <3>;
gpmc,num-waitpins = <2>;
#address-cells = <2>;
#size-cells = <1>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-controller;
#gpio-cells = <2>;
status = "disabled";
};

2)在k3-am62a7-sk.dts 最后一行添加了

#include "k3-am62a-oled.dtsi"

3) k3-am62a-oled.dtsi文件的内容如下:

&main_pmx0 {
gpmc0_pins_default: gpmc0-pins-default {
pinctrl-single,pins = <
AM62AX_IOPAD(0x03c, PIN_INPUT, 0) /* (N21) GPMC0_AD0 */
AM62AX_IOPAD(0x040, PIN_INPUT, 0) /* (N20) GPMC0_AD1 */
AM62AX_IOPAD(0x044, PIN_INPUT, 0) /* (N19) GPMC0_AD2 */
AM62AX_IOPAD(0x048, PIN_INPUT, 0) /* (N18) GPMC0_AD3 */
AM62AX_IOPAD(0x04c, PIN_INPUT, 0) /* (N17) GPMC0_AD4 */
AM62AX_IOPAD(0x050, PIN_INPUT, 0) /* (P18) GPMC0_AD5 */
AM62AX_IOPAD(0x054, PIN_INPUT, 0) /* (P19) GPMC0_AD6 */
AM62AX_IOPAD(0x058, PIN_INPUT, 0) /* (P21) GPMC0_AD7 */
AM62AX_IOPAD(0x0ac, PIN_OUTPUT, 0) /* (M21) GPMC0_CSn1 gpio0_42*/
AM62AX_IOPAD(0x038, PIN_OUTPUT, 7) /* (G20) OSPI0_CSn3.GPIO0_14 LCD_BL_EN*/
AM62AX_IOPAD(0x094, PIN_OUTPUT, 7) /* (M18) GPMC0_BE1n.GPIO0_36 LCD_TE*/
AM62AX_IOPAD(0x09c, PIN_OUTPUT, 7) /* (R17) GPMC0_WAIT1.GPIO0_38 LCD_RESET*/
AM62AX_IOPAD(0x0a0, PIN_OUTPUT, 2) /* (K17) GPMC0_WPn.GPMC0_A22 LCD_RS gpio0_39*/
AM62AX_IOPAD(0x08C, PIN_OUTPUT, 0) /* (K19) GPMC0_WEn.GPIO0_34 LCD_WE gpio0_34 0xF40x08C*/
AM62AX_IOPAD(0x088, PIN_OUTPUT, 0) /* (L17) GPMC0_OEn_REn.GPIO0_33 LCD_RD*/

/* AM62X_IOPAD(0x00a8, PIN_OUTPUT, 0) (M19) GPMC0_CSn0 */


>;
};
};

&gpmc0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&gpmc0_pins_default>;
#address-cells = <2>;
#size-cells = <1>;

ranges = <1 0 0x00 0x50000000 0x08000000>; /* CS1 space. size = 128MiB*/

oled@1,0 {
compatible = "atmel,unication-oled-module";
#address-cells = <1>;
#size-cells = <1>;
reg = <1 0 0x08000000>;
reg-names = "data";

oled_rs = <22>; /* pin index for LCD_RS */

madctl = <0x00>;
rotate_degree = <270>; //clockwide, vaild for 0,90,180,270
atmel,oled-has-dma;
atmel,oled-bank-width = <8>; /* 8bit */
dmas = <&main_pktdma 0xf501 0>;
dma-names = "tx";

oled_reset-gpios = <&main_gpio0 38 GPIO_ACTIVE_HIGH>;
oled_panel_pw_ctl-gpios = <&main_gpio0 14 GPIO_ACTIVE_HIGH>;
interrupt-parent = <&main_gpio0>;
interrupts = <36 GPIO_ACTIVE_HIGH>; //Tearing Effect(TE) singal
/*clocks = <&k3_clks 190 0>;*/
/*clocks = <&k3_clks 161 3>; 1mclk= 40ns, 25HMz*/
/*clock-names = "fck";*/

/* CONFIG1*/
gpmc,device-width = <1>;
bank-width = <1>;
/*gpmc,sync-read;*/
/*gpmc,sync-write;*/
/*gpmc,clk-activation-ns = <0>;*/
gpmc,mux-add-data = <0>;

/* CONFIG2*/
/*gpmc,sync-clk-ps = <23000>;div=4, 22501*/
gpmc,cs-on-ns = <30>;
gpmc,cs-rd-off-ns = <900>;
gpmc,cs-wr-off-ns = <480>;/*228*/

/* CONFIG3*/
gpmc,adv-on-ns = <30>;
gpmc,adv-rd-off-ns = <45>;
gpmc,adv-wr-off-ns = <45>;

/* CONFIG4*/
gpmc,we-on-ns = <45>;
gpmc,we-off-ns = <450>;/*129*/
gpmc,oe-on-ns = <55>;
gpmc,oe-off-ns = <495>;

/* CONFIG5*/
/*gpmc,page-burst-access-ns = <22>;*/
gpmc,access-ns = <505>;
gpmc,rd-cycle-ns = <930>;
gpmc,wr-cycle-ns = <510>;/*227*/
gpmc,cycle2cycle-delay-ns = <30>;
/*gpmc,wr-access-ns = <480>;129*/

};
};

  • 以上两个问题已解决。

    现在遇到新的问题:

    1、我用GPMC_A22引脚连接到OLED的C/D 引脚(这个引脚低电平表示cmd,高电平表示data)。GPMC基地址是0x50000000。因此由基地址向左偏移22位即,0x50000000+(1<<22)=0x50400000,向这个地址写入值就能拉高GPMC_A22,表示这个值是data。然后向0x50400000-0x2=0x503ffffe地址写入值就拉低GPMC_A22,表示这个值是cmd。但现在的问题是:我将0x503ffffe ~ 0x50400001的地址范围用devm_ioremap_resource函数映射后,将映射后的cmd地址写值,再读映射后的data地址,得到的值等于cmd值,例如我写cmd=0xda,读data正确应该是0x01但却读到0xda。而且读全部的映射地址,值都是0xda,这是什么原因,哪里不对呢?

    2、GPMC CONFIG2~CONFIG6 寄存器每个时序参数最大只支持5bit即31个clk,可配置时序范围小,我的OLED屏的读写时序要求,最大值是NRD_CYCLE=800ns,最小是NCS_WR_SETUP=8ns。以最大800ns计算,800/31=25.8ns,即1个clk的最小精度只能是25ns,这个精度比最小的值NCS_WR_SETUP还要大。如何解决好?

    我的dtsi配置如下:

    // SPDX-License-Identifier: GPL-2.0
    /*
     * Device Tree Source for AM62A SoC Family Main Domain peripherals
     *
     * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
     */
    
    
    &main_pmx0 {
    	gpmc0_pins_default: gpmc0-pins-default {
    		pinctrl-single,pins = <
    			AM62AX_IOPAD(0x03c, PIN_INPUT, 0) /* (N21) GPMC0_AD0 */
    			AM62AX_IOPAD(0x040, PIN_INPUT, 0) /* (N20) GPMC0_AD1 */
    			AM62AX_IOPAD(0x044, PIN_INPUT, 0) /* (N19) GPMC0_AD2 */
    			AM62AX_IOPAD(0x048, PIN_INPUT, 0) /* (N18) GPMC0_AD3 */
    			AM62AX_IOPAD(0x04c, PIN_INPUT, 0) /* (N17) GPMC0_AD4 */
    			AM62AX_IOPAD(0x050, PIN_INPUT, 0) /* (P18) GPMC0_AD5 */
    			AM62AX_IOPAD(0x054, PIN_INPUT, 0) /* (P19) GPMC0_AD6 */
    			AM62AX_IOPAD(0x058, PIN_INPUT, 0) /* (P21) GPMC0_AD7 */
    			AM62AX_IOPAD(0x0ac, PIN_OUTPUT, 0) /* (M21) GPMC0_CSn1 gpio0_42*/
    			AM62AX_IOPAD(0x038, PIN_OUTPUT, 7) /* (G20) OSPI0_CSn3.GPIO0_14 LCD_BL_EN*/
    			AM62AX_IOPAD(0x094, PIN_OUTPUT, 7) /* (M18) GPMC0_BE1n.GPIO0_36 LCD_TE*/
    			AM62AX_IOPAD(0x09c, PIN_OUTPUT, 7) /* (R17) GPMC0_WAIT1.GPIO0_38 LCD_RESET*/
    			AM62AX_IOPAD(0x0a0, PIN_OUTPUT, 2) /* (K17) GPMC0_WPn.GPMC0_A22 LCD_RS gpio0_39*/
    			AM62AX_IOPAD(0x08C, PIN_OUTPUT, 0) /* (K19) GPMC0_WEn.GPIO0_34 LCD_WE gpio0_34 0xF40x08C*/
    			AM62AX_IOPAD(0x088, PIN_OUTPUT, 0) /* (L17) GPMC0_OEn_REn.GPIO0_33 LCD_RD*/
    		>;
    	};
    };
    
    &gpmc0 {
    	status = "okay";
    	pinctrl-names = "default";
    	pinctrl-0 = <&gpmc0_pins_default>;
    	/*#address-cells = <2>;*/
    	/*#size-cells = <1>;*/
    
    	ranges = <1 0 0x00 0x50000000 0x01000000>; /* CS1 space. size = 128MiB*/
    
    	oled@1,0 {
    		compatible = "atmel,unication-oled-module";
    		/*#address-cells = <1>;*/
    		/*#size-cells = <1>;*/
    		reg = <1 0 0x00000004>;
    		//reg = <1 0 0x08000000>;0
    		reg-names = "data";
    
    		oled_rs = <22>;  /* pin index for LCD_RS */
    		madctl = <0x00>;
    		rotate_degree = <270>;  //clockwide, vaild for 0,90,180,270
    		atmel,oled-has-dma;
    		atmel,oled-bank-width = <8>; /* 8bit */
    		dmas = <&main_pktdma 0xf501 0>;
    		dma-names = "tx";
    
    		oled_reset-gpios = <&main_gpio0 38 GPIO_ACTIVE_HIGH>;
    		oled_panel_pw_ctl-gpios = <&main_gpio0 14 GPIO_ACTIVE_HIGH>;
    		interrupt-parent = <&main_gpio0>;
    		interrupts = <36 GPIO_ACTIVE_HIGH>; //Tearing Effect(TE) singal
    
    		/* CONFIG1*/
    		gpmc,device-width = <1>;
    		bank-width = <1>;
    		/*gpmc,sync-read;*/
    		/*gpmc,sync-write;*/
    		/*gpmc,clk-activation-ns = <0>;*/
    		/*gpmc,mux-add-data = <0>;*/
    
    		/* CONFIG2*/
    		gpmc,cs-on-ns = <0>;
    		gpmc,cs-rd-off-ns = <750>;
    		gpmc,cs-wr-off-ns = <175>;
    
    		/* CONFIG3*/
    		gpmc,adv-on-ns = <0>;
    		gpmc,adv-rd-off-ns = <25>;
    		gpmc,adv-wr-off-ns = <25>;
    		
    		/* CONFIG4*/
    		gpmc,we-on-ns = <25>;
    		gpmc,we-off-ns = <125>;
    		gpmc,oe-on-ns = <25>;
    		gpmc,oe-off-ns = <450>;
    		
    		/* CONFIG5*/
    		gpmc,access-ns = <250>;
    		gpmc,rd-cycle-ns = <775>;
    		gpmc,wr-cycle-ns = <200>;
    		/*gpmc,cycle2cycle-delay-ns = <10>;*/
    		/*gpmc,wr-access-ns = <480>;129*/
    	
    	};
    	
    };
    
    
    

    	gpmc0: memory-controller@3b000000 {
    		compatible = "ti,am64-gpmc";
    		power-domains = <&k3_pds 80 TI_SCI_PD_EXCLUSIVE>;
    		clocks = <&k3_clks 80 0>; 
            assigned-clocks = <&k3_clks 80 0>;
            assigned-clock-parents = <&k3_clks 80 2>;/*	1mclk=10ns*/
            /*assigned-clock-parents = <&k3_clks 80 1>;	1mclk=7.5ns, 133MHz*/
    		assigned-clock-rates = <40000000>;/* 10000000 =10Mhz ,100ns*/
    
    		clock-names = "fck";
    		reg = <0x00 0x03b000000 0x00 0x400>,
    		      <0x00 0x050000000 0x00 0x8000000>;
    		reg-names = "cfg", "data";
    		interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
    		gpmc,num-cs = <3>;
    		gpmc,num-waitpins = <2>;
    		#address-cells = <2>;
    		#size-cells = <1>;
    		interrupt-controller;
    		#interrupt-cells = <2>;
    		gpio-controller;
    		#gpio-cells = <2>;
    		status = "disabled";
    	};