xref: /linux/Documentation/driver-api/memory-devices/ti-gpmc.rst (revision 652a49bc68ce3cf0355bde357b3998bd63e73915)
1*652a49bcSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2*652a49bcSMauro Carvalho Chehab
3*652a49bcSMauro Carvalho Chehab========================================
4*652a49bcSMauro Carvalho ChehabGPMC (General Purpose Memory Controller)
5*652a49bcSMauro Carvalho Chehab========================================
6*652a49bcSMauro Carvalho Chehab
7*652a49bcSMauro Carvalho ChehabGPMC is an unified memory controller dedicated to interfacing external
8*652a49bcSMauro Carvalho Chehabmemory devices like
9*652a49bcSMauro Carvalho Chehab
10*652a49bcSMauro Carvalho Chehab * Asynchronous SRAM like memories and application specific integrated
11*652a49bcSMauro Carvalho Chehab   circuit devices.
12*652a49bcSMauro Carvalho Chehab * Asynchronous, synchronous, and page mode burst NOR flash devices
13*652a49bcSMauro Carvalho Chehab   NAND flash
14*652a49bcSMauro Carvalho Chehab * Pseudo-SRAM devices
15*652a49bcSMauro Carvalho Chehab
16*652a49bcSMauro Carvalho ChehabGPMC is found on Texas Instruments SoC's (OMAP based)
17*652a49bcSMauro Carvalho ChehabIP details: http://www.ti.com/lit/pdf/spruh73 section 7.1
18*652a49bcSMauro Carvalho Chehab
19*652a49bcSMauro Carvalho Chehab
20*652a49bcSMauro Carvalho ChehabGPMC generic timing calculation:
21*652a49bcSMauro Carvalho Chehab================================
22*652a49bcSMauro Carvalho Chehab
23*652a49bcSMauro Carvalho ChehabGPMC has certain timings that has to be programmed for proper
24*652a49bcSMauro Carvalho Chehabfunctioning of the peripheral, while peripheral has another set of
25*652a49bcSMauro Carvalho Chehabtimings. To have peripheral work with gpmc, peripheral timings has to
26*652a49bcSMauro Carvalho Chehabbe translated to the form gpmc can understand. The way it has to be
27*652a49bcSMauro Carvalho Chehabtranslated depends on the connected peripheral. Also there is a
28*652a49bcSMauro Carvalho Chehabdependency for certain gpmc timings on gpmc clock frequency. Hence a
29*652a49bcSMauro Carvalho Chehabgeneric timing routine was developed to achieve above requirements.
30*652a49bcSMauro Carvalho Chehab
31*652a49bcSMauro Carvalho ChehabGeneric routine provides a generic method to calculate gpmc timings
32*652a49bcSMauro Carvalho Chehabfrom gpmc peripheral timings. struct gpmc_device_timings fields has to
33*652a49bcSMauro Carvalho Chehabbe updated with timings from the datasheet of the peripheral that is
34*652a49bcSMauro Carvalho Chehabconnected to gpmc. A few of the peripheral timings can be fed either
35*652a49bcSMauro Carvalho Chehabin time or in cycles, provision to handle this scenario has been
36*652a49bcSMauro Carvalho Chehabprovided (refer struct gpmc_device_timings definition). It may so
37*652a49bcSMauro Carvalho Chehabhappen that timing as specified by peripheral datasheet is not present
38*652a49bcSMauro Carvalho Chehabin timing structure, in this scenario, try to correlate peripheral
39*652a49bcSMauro Carvalho Chehabtiming to the one available. If that doesn't work, try to add a new
40*652a49bcSMauro Carvalho Chehabfield as required by peripheral, educate generic timing routine to
41*652a49bcSMauro Carvalho Chehabhandle it, make sure that it does not break any of the existing.
42*652a49bcSMauro Carvalho ChehabThen there may be cases where peripheral datasheet doesn't mention
43*652a49bcSMauro Carvalho Chehabcertain fields of struct gpmc_device_timings, zero those entries.
44*652a49bcSMauro Carvalho Chehab
45*652a49bcSMauro Carvalho ChehabGeneric timing routine has been verified to work properly on
46*652a49bcSMauro Carvalho Chehabmultiple onenand's and tusb6010 peripherals.
47*652a49bcSMauro Carvalho Chehab
48*652a49bcSMauro Carvalho ChehabA word of caution: generic timing routine has been developed based
49*652a49bcSMauro Carvalho Chehabon understanding of gpmc timings, peripheral timings, available
50*652a49bcSMauro Carvalho Chehabcustom timing routines, a kind of reverse engineering without
51*652a49bcSMauro Carvalho Chehabmost of the datasheets & hardware (to be exact none of those supported
52*652a49bcSMauro Carvalho Chehabin mainline having custom timing routine) and by simulation.
53*652a49bcSMauro Carvalho Chehab
54*652a49bcSMauro Carvalho Chehabgpmc timing dependency on peripheral timings:
55*652a49bcSMauro Carvalho Chehab
56*652a49bcSMauro Carvalho Chehab[<gpmc_timing>: <peripheral timing1>, <peripheral timing2> ...]
57*652a49bcSMauro Carvalho Chehab
58*652a49bcSMauro Carvalho Chehab1. common
59*652a49bcSMauro Carvalho Chehab
60*652a49bcSMauro Carvalho Chehabcs_on:
61*652a49bcSMauro Carvalho Chehab	t_ceasu
62*652a49bcSMauro Carvalho Chehabadv_on:
63*652a49bcSMauro Carvalho Chehab	t_avdasu, t_ceavd
64*652a49bcSMauro Carvalho Chehab
65*652a49bcSMauro Carvalho Chehab2. sync common
66*652a49bcSMauro Carvalho Chehab
67*652a49bcSMauro Carvalho Chehabsync_clk:
68*652a49bcSMauro Carvalho Chehab	clk
69*652a49bcSMauro Carvalho Chehabpage_burst_access:
70*652a49bcSMauro Carvalho Chehab	t_bacc
71*652a49bcSMauro Carvalho Chehabclk_activation:
72*652a49bcSMauro Carvalho Chehab	t_ces, t_avds
73*652a49bcSMauro Carvalho Chehab
74*652a49bcSMauro Carvalho Chehab3. read async muxed
75*652a49bcSMauro Carvalho Chehab
76*652a49bcSMauro Carvalho Chehabadv_rd_off:
77*652a49bcSMauro Carvalho Chehab	t_avdp_r
78*652a49bcSMauro Carvalho Chehaboe_on:
79*652a49bcSMauro Carvalho Chehab	t_oeasu, t_aavdh
80*652a49bcSMauro Carvalho Chehabaccess:
81*652a49bcSMauro Carvalho Chehab	t_iaa, t_oe, t_ce, t_aa
82*652a49bcSMauro Carvalho Chehabrd_cycle:
83*652a49bcSMauro Carvalho Chehab	t_rd_cycle, t_cez_r, t_oez
84*652a49bcSMauro Carvalho Chehab
85*652a49bcSMauro Carvalho Chehab4. read async non-muxed
86*652a49bcSMauro Carvalho Chehab
87*652a49bcSMauro Carvalho Chehabadv_rd_off:
88*652a49bcSMauro Carvalho Chehab	t_avdp_r
89*652a49bcSMauro Carvalho Chehaboe_on:
90*652a49bcSMauro Carvalho Chehab	t_oeasu
91*652a49bcSMauro Carvalho Chehabaccess:
92*652a49bcSMauro Carvalho Chehab	t_iaa, t_oe, t_ce, t_aa
93*652a49bcSMauro Carvalho Chehabrd_cycle:
94*652a49bcSMauro Carvalho Chehab	t_rd_cycle, t_cez_r, t_oez
95*652a49bcSMauro Carvalho Chehab
96*652a49bcSMauro Carvalho Chehab5. read sync muxed
97*652a49bcSMauro Carvalho Chehab
98*652a49bcSMauro Carvalho Chehabadv_rd_off:
99*652a49bcSMauro Carvalho Chehab	t_avdp_r, t_avdh
100*652a49bcSMauro Carvalho Chehaboe_on:
101*652a49bcSMauro Carvalho Chehab	t_oeasu, t_ach, cyc_aavdh_oe
102*652a49bcSMauro Carvalho Chehabaccess:
103*652a49bcSMauro Carvalho Chehab	t_iaa, cyc_iaa, cyc_oe
104*652a49bcSMauro Carvalho Chehabrd_cycle:
105*652a49bcSMauro Carvalho Chehab	t_cez_r, t_oez, t_ce_rdyz
106*652a49bcSMauro Carvalho Chehab
107*652a49bcSMauro Carvalho Chehab6. read sync non-muxed
108*652a49bcSMauro Carvalho Chehab
109*652a49bcSMauro Carvalho Chehabadv_rd_off:
110*652a49bcSMauro Carvalho Chehab	t_avdp_r
111*652a49bcSMauro Carvalho Chehaboe_on:
112*652a49bcSMauro Carvalho Chehab	t_oeasu
113*652a49bcSMauro Carvalho Chehabaccess:
114*652a49bcSMauro Carvalho Chehab	t_iaa, cyc_iaa, cyc_oe
115*652a49bcSMauro Carvalho Chehabrd_cycle:
116*652a49bcSMauro Carvalho Chehab	t_cez_r, t_oez, t_ce_rdyz
117*652a49bcSMauro Carvalho Chehab
118*652a49bcSMauro Carvalho Chehab7. write async muxed
119*652a49bcSMauro Carvalho Chehab
120*652a49bcSMauro Carvalho Chehabadv_wr_off:
121*652a49bcSMauro Carvalho Chehab	t_avdp_w
122*652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus:
123*652a49bcSMauro Carvalho Chehab	t_weasu, t_aavdh, cyc_aavhd_we
124*652a49bcSMauro Carvalho Chehabwe_off:
125*652a49bcSMauro Carvalho Chehab	t_wpl
126*652a49bcSMauro Carvalho Chehabcs_wr_off:
127*652a49bcSMauro Carvalho Chehab	t_wph
128*652a49bcSMauro Carvalho Chehabwr_cycle:
129*652a49bcSMauro Carvalho Chehab	t_cez_w, t_wr_cycle
130*652a49bcSMauro Carvalho Chehab
131*652a49bcSMauro Carvalho Chehab8. write async non-muxed
132*652a49bcSMauro Carvalho Chehab
133*652a49bcSMauro Carvalho Chehabadv_wr_off:
134*652a49bcSMauro Carvalho Chehab	t_avdp_w
135*652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus:
136*652a49bcSMauro Carvalho Chehab	t_weasu
137*652a49bcSMauro Carvalho Chehabwe_off:
138*652a49bcSMauro Carvalho Chehab	t_wpl
139*652a49bcSMauro Carvalho Chehabcs_wr_off:
140*652a49bcSMauro Carvalho Chehab	t_wph
141*652a49bcSMauro Carvalho Chehabwr_cycle:
142*652a49bcSMauro Carvalho Chehab	t_cez_w, t_wr_cycle
143*652a49bcSMauro Carvalho Chehab
144*652a49bcSMauro Carvalho Chehab9. write sync muxed
145*652a49bcSMauro Carvalho Chehab
146*652a49bcSMauro Carvalho Chehabadv_wr_off:
147*652a49bcSMauro Carvalho Chehab	t_avdp_w, t_avdh
148*652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus:
149*652a49bcSMauro Carvalho Chehab	t_weasu, t_rdyo, t_aavdh, cyc_aavhd_we
150*652a49bcSMauro Carvalho Chehabwe_off:
151*652a49bcSMauro Carvalho Chehab	t_wpl, cyc_wpl
152*652a49bcSMauro Carvalho Chehabcs_wr_off:
153*652a49bcSMauro Carvalho Chehab	t_wph
154*652a49bcSMauro Carvalho Chehabwr_cycle:
155*652a49bcSMauro Carvalho Chehab	t_cez_w, t_ce_rdyz
156*652a49bcSMauro Carvalho Chehab
157*652a49bcSMauro Carvalho Chehab10. write sync non-muxed
158*652a49bcSMauro Carvalho Chehab
159*652a49bcSMauro Carvalho Chehabadv_wr_off:
160*652a49bcSMauro Carvalho Chehab	t_avdp_w
161*652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus:
162*652a49bcSMauro Carvalho Chehab	t_weasu, t_rdyo
163*652a49bcSMauro Carvalho Chehabwe_off:
164*652a49bcSMauro Carvalho Chehab	t_wpl, cyc_wpl
165*652a49bcSMauro Carvalho Chehabcs_wr_off:
166*652a49bcSMauro Carvalho Chehab	t_wph
167*652a49bcSMauro Carvalho Chehabwr_cycle:
168*652a49bcSMauro Carvalho Chehab	t_cez_w, t_ce_rdyz
169*652a49bcSMauro Carvalho Chehab
170*652a49bcSMauro Carvalho Chehab
171*652a49bcSMauro Carvalho ChehabNote:
172*652a49bcSMauro Carvalho Chehab  Many of gpmc timings are dependent on other gpmc timings (a few
173*652a49bcSMauro Carvalho Chehab  gpmc timings purely dependent on other gpmc timings, a reason that
174*652a49bcSMauro Carvalho Chehab  some of the gpmc timings are missing above), and it will result in
175*652a49bcSMauro Carvalho Chehab  indirect dependency of peripheral timings to gpmc timings other than
176*652a49bcSMauro Carvalho Chehab  mentioned above, refer timing routine for more details. To know what
177*652a49bcSMauro Carvalho Chehab  these peripheral timings correspond to, please see explanations in
178*652a49bcSMauro Carvalho Chehab  struct gpmc_device_timings definition. And for gpmc timings refer
179*652a49bcSMauro Carvalho Chehab  IP details (link above).
180