1652a49bcSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0 2652a49bcSMauro Carvalho Chehab 3652a49bcSMauro Carvalho Chehab======================================== 4652a49bcSMauro Carvalho ChehabGPMC (General Purpose Memory Controller) 5652a49bcSMauro Carvalho Chehab======================================== 6652a49bcSMauro Carvalho Chehab 7652a49bcSMauro Carvalho ChehabGPMC is an unified memory controller dedicated to interfacing external 8652a49bcSMauro Carvalho Chehabmemory devices like 9652a49bcSMauro Carvalho Chehab 10652a49bcSMauro Carvalho Chehab * Asynchronous SRAM like memories and application specific integrated 11652a49bcSMauro Carvalho Chehab circuit devices. 12652a49bcSMauro Carvalho Chehab * Asynchronous, synchronous, and page mode burst NOR flash devices 13652a49bcSMauro Carvalho Chehab NAND flash 14652a49bcSMauro Carvalho Chehab * Pseudo-SRAM devices 15652a49bcSMauro Carvalho Chehab 16652a49bcSMauro Carvalho ChehabGPMC is found on Texas Instruments SoC's (OMAP based) 17*d3603f4cSAlexander A. KlimovIP details: https://www.ti.com/lit/pdf/spruh73 section 7.1 18652a49bcSMauro Carvalho Chehab 19652a49bcSMauro Carvalho Chehab 20652a49bcSMauro Carvalho ChehabGPMC generic timing calculation: 21652a49bcSMauro Carvalho Chehab================================ 22652a49bcSMauro Carvalho Chehab 23652a49bcSMauro Carvalho ChehabGPMC has certain timings that has to be programmed for proper 24652a49bcSMauro Carvalho Chehabfunctioning of the peripheral, while peripheral has another set of 25652a49bcSMauro Carvalho Chehabtimings. To have peripheral work with gpmc, peripheral timings has to 26652a49bcSMauro Carvalho Chehabbe translated to the form gpmc can understand. The way it has to be 27652a49bcSMauro Carvalho Chehabtranslated depends on the connected peripheral. Also there is a 28652a49bcSMauro Carvalho Chehabdependency for certain gpmc timings on gpmc clock frequency. Hence a 29652a49bcSMauro Carvalho Chehabgeneric timing routine was developed to achieve above requirements. 30652a49bcSMauro Carvalho Chehab 31652a49bcSMauro Carvalho ChehabGeneric routine provides a generic method to calculate gpmc timings 32652a49bcSMauro Carvalho Chehabfrom gpmc peripheral timings. struct gpmc_device_timings fields has to 33652a49bcSMauro Carvalho Chehabbe updated with timings from the datasheet of the peripheral that is 34652a49bcSMauro Carvalho Chehabconnected to gpmc. A few of the peripheral timings can be fed either 35652a49bcSMauro Carvalho Chehabin time or in cycles, provision to handle this scenario has been 36652a49bcSMauro Carvalho Chehabprovided (refer struct gpmc_device_timings definition). It may so 37652a49bcSMauro Carvalho Chehabhappen that timing as specified by peripheral datasheet is not present 38652a49bcSMauro Carvalho Chehabin timing structure, in this scenario, try to correlate peripheral 39652a49bcSMauro Carvalho Chehabtiming to the one available. If that doesn't work, try to add a new 40652a49bcSMauro Carvalho Chehabfield as required by peripheral, educate generic timing routine to 41652a49bcSMauro Carvalho Chehabhandle it, make sure that it does not break any of the existing. 42652a49bcSMauro Carvalho ChehabThen there may be cases where peripheral datasheet doesn't mention 43652a49bcSMauro Carvalho Chehabcertain fields of struct gpmc_device_timings, zero those entries. 44652a49bcSMauro Carvalho Chehab 45652a49bcSMauro Carvalho ChehabGeneric timing routine has been verified to work properly on 46652a49bcSMauro Carvalho Chehabmultiple onenand's and tusb6010 peripherals. 47652a49bcSMauro Carvalho Chehab 48652a49bcSMauro Carvalho ChehabA word of caution: generic timing routine has been developed based 49652a49bcSMauro Carvalho Chehabon understanding of gpmc timings, peripheral timings, available 50652a49bcSMauro Carvalho Chehabcustom timing routines, a kind of reverse engineering without 51652a49bcSMauro Carvalho Chehabmost of the datasheets & hardware (to be exact none of those supported 52652a49bcSMauro Carvalho Chehabin mainline having custom timing routine) and by simulation. 53652a49bcSMauro Carvalho Chehab 54652a49bcSMauro Carvalho Chehabgpmc timing dependency on peripheral timings: 55652a49bcSMauro Carvalho Chehab 56652a49bcSMauro Carvalho Chehab[<gpmc_timing>: <peripheral timing1>, <peripheral timing2> ...] 57652a49bcSMauro Carvalho Chehab 58652a49bcSMauro Carvalho Chehab1. common 59652a49bcSMauro Carvalho Chehab 60652a49bcSMauro Carvalho Chehabcs_on: 61652a49bcSMauro Carvalho Chehab t_ceasu 62652a49bcSMauro Carvalho Chehabadv_on: 63652a49bcSMauro Carvalho Chehab t_avdasu, t_ceavd 64652a49bcSMauro Carvalho Chehab 65652a49bcSMauro Carvalho Chehab2. sync common 66652a49bcSMauro Carvalho Chehab 67652a49bcSMauro Carvalho Chehabsync_clk: 68652a49bcSMauro Carvalho Chehab clk 69652a49bcSMauro Carvalho Chehabpage_burst_access: 70652a49bcSMauro Carvalho Chehab t_bacc 71652a49bcSMauro Carvalho Chehabclk_activation: 72652a49bcSMauro Carvalho Chehab t_ces, t_avds 73652a49bcSMauro Carvalho Chehab 74652a49bcSMauro Carvalho Chehab3. read async muxed 75652a49bcSMauro Carvalho Chehab 76652a49bcSMauro Carvalho Chehabadv_rd_off: 77652a49bcSMauro Carvalho Chehab t_avdp_r 78652a49bcSMauro Carvalho Chehaboe_on: 79652a49bcSMauro Carvalho Chehab t_oeasu, t_aavdh 80652a49bcSMauro Carvalho Chehabaccess: 81652a49bcSMauro Carvalho Chehab t_iaa, t_oe, t_ce, t_aa 82652a49bcSMauro Carvalho Chehabrd_cycle: 83652a49bcSMauro Carvalho Chehab t_rd_cycle, t_cez_r, t_oez 84652a49bcSMauro Carvalho Chehab 85652a49bcSMauro Carvalho Chehab4. read async non-muxed 86652a49bcSMauro Carvalho Chehab 87652a49bcSMauro Carvalho Chehabadv_rd_off: 88652a49bcSMauro Carvalho Chehab t_avdp_r 89652a49bcSMauro Carvalho Chehaboe_on: 90652a49bcSMauro Carvalho Chehab t_oeasu 91652a49bcSMauro Carvalho Chehabaccess: 92652a49bcSMauro Carvalho Chehab t_iaa, t_oe, t_ce, t_aa 93652a49bcSMauro Carvalho Chehabrd_cycle: 94652a49bcSMauro Carvalho Chehab t_rd_cycle, t_cez_r, t_oez 95652a49bcSMauro Carvalho Chehab 96652a49bcSMauro Carvalho Chehab5. read sync muxed 97652a49bcSMauro Carvalho Chehab 98652a49bcSMauro Carvalho Chehabadv_rd_off: 99652a49bcSMauro Carvalho Chehab t_avdp_r, t_avdh 100652a49bcSMauro Carvalho Chehaboe_on: 101652a49bcSMauro Carvalho Chehab t_oeasu, t_ach, cyc_aavdh_oe 102652a49bcSMauro Carvalho Chehabaccess: 103652a49bcSMauro Carvalho Chehab t_iaa, cyc_iaa, cyc_oe 104652a49bcSMauro Carvalho Chehabrd_cycle: 105652a49bcSMauro Carvalho Chehab t_cez_r, t_oez, t_ce_rdyz 106652a49bcSMauro Carvalho Chehab 107652a49bcSMauro Carvalho Chehab6. read sync non-muxed 108652a49bcSMauro Carvalho Chehab 109652a49bcSMauro Carvalho Chehabadv_rd_off: 110652a49bcSMauro Carvalho Chehab t_avdp_r 111652a49bcSMauro Carvalho Chehaboe_on: 112652a49bcSMauro Carvalho Chehab t_oeasu 113652a49bcSMauro Carvalho Chehabaccess: 114652a49bcSMauro Carvalho Chehab t_iaa, cyc_iaa, cyc_oe 115652a49bcSMauro Carvalho Chehabrd_cycle: 116652a49bcSMauro Carvalho Chehab t_cez_r, t_oez, t_ce_rdyz 117652a49bcSMauro Carvalho Chehab 118652a49bcSMauro Carvalho Chehab7. write async muxed 119652a49bcSMauro Carvalho Chehab 120652a49bcSMauro Carvalho Chehabadv_wr_off: 121652a49bcSMauro Carvalho Chehab t_avdp_w 122652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus: 123652a49bcSMauro Carvalho Chehab t_weasu, t_aavdh, cyc_aavhd_we 124652a49bcSMauro Carvalho Chehabwe_off: 125652a49bcSMauro Carvalho Chehab t_wpl 126652a49bcSMauro Carvalho Chehabcs_wr_off: 127652a49bcSMauro Carvalho Chehab t_wph 128652a49bcSMauro Carvalho Chehabwr_cycle: 129652a49bcSMauro Carvalho Chehab t_cez_w, t_wr_cycle 130652a49bcSMauro Carvalho Chehab 131652a49bcSMauro Carvalho Chehab8. write async non-muxed 132652a49bcSMauro Carvalho Chehab 133652a49bcSMauro Carvalho Chehabadv_wr_off: 134652a49bcSMauro Carvalho Chehab t_avdp_w 135652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus: 136652a49bcSMauro Carvalho Chehab t_weasu 137652a49bcSMauro Carvalho Chehabwe_off: 138652a49bcSMauro Carvalho Chehab t_wpl 139652a49bcSMauro Carvalho Chehabcs_wr_off: 140652a49bcSMauro Carvalho Chehab t_wph 141652a49bcSMauro Carvalho Chehabwr_cycle: 142652a49bcSMauro Carvalho Chehab t_cez_w, t_wr_cycle 143652a49bcSMauro Carvalho Chehab 144652a49bcSMauro Carvalho Chehab9. write sync muxed 145652a49bcSMauro Carvalho Chehab 146652a49bcSMauro Carvalho Chehabadv_wr_off: 147652a49bcSMauro Carvalho Chehab t_avdp_w, t_avdh 148652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus: 149652a49bcSMauro Carvalho Chehab t_weasu, t_rdyo, t_aavdh, cyc_aavhd_we 150652a49bcSMauro Carvalho Chehabwe_off: 151652a49bcSMauro Carvalho Chehab t_wpl, cyc_wpl 152652a49bcSMauro Carvalho Chehabcs_wr_off: 153652a49bcSMauro Carvalho Chehab t_wph 154652a49bcSMauro Carvalho Chehabwr_cycle: 155652a49bcSMauro Carvalho Chehab t_cez_w, t_ce_rdyz 156652a49bcSMauro Carvalho Chehab 157652a49bcSMauro Carvalho Chehab10. write sync non-muxed 158652a49bcSMauro Carvalho Chehab 159652a49bcSMauro Carvalho Chehabadv_wr_off: 160652a49bcSMauro Carvalho Chehab t_avdp_w 161652a49bcSMauro Carvalho Chehabwe_on, wr_data_mux_bus: 162652a49bcSMauro Carvalho Chehab t_weasu, t_rdyo 163652a49bcSMauro Carvalho Chehabwe_off: 164652a49bcSMauro Carvalho Chehab t_wpl, cyc_wpl 165652a49bcSMauro Carvalho Chehabcs_wr_off: 166652a49bcSMauro Carvalho Chehab t_wph 167652a49bcSMauro Carvalho Chehabwr_cycle: 168652a49bcSMauro Carvalho Chehab t_cez_w, t_ce_rdyz 169652a49bcSMauro Carvalho Chehab 170652a49bcSMauro Carvalho Chehab 171652a49bcSMauro Carvalho ChehabNote: 172652a49bcSMauro Carvalho Chehab Many of gpmc timings are dependent on other gpmc timings (a few 173652a49bcSMauro Carvalho Chehab gpmc timings purely dependent on other gpmc timings, a reason that 174652a49bcSMauro Carvalho Chehab some of the gpmc timings are missing above), and it will result in 175652a49bcSMauro Carvalho Chehab indirect dependency of peripheral timings to gpmc timings other than 176652a49bcSMauro Carvalho Chehab mentioned above, refer timing routine for more details. To know what 177652a49bcSMauro Carvalho Chehab these peripheral timings correspond to, please see explanations in 178652a49bcSMauro Carvalho Chehab struct gpmc_device_timings definition. And for gpmc timings refer 179652a49bcSMauro Carvalho Chehab IP details (link above). 180