aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2013-02-20 16:53:12 -0500
committerJon Hunter <jon-hunter@ti.com>2013-04-01 15:53:45 -0400
commit8c8a77712756edcef9298444868537af42334fc0 (patch)
tree3be80581884b41e8925ea66644aea4dcfdd311f7
parent3a544354d5b6e97459ba9c15e9d89dac60023553 (diff)
ARM: OMAP2+: Add function to read GPMC settings from device-tree
Adds a function to read the various GPMC chip-select settings from device-tree and store them in the gpmc_settings structure. Update the GPMC device-tree binding documentation to describe these options. Signed-off-by: Jon Hunter <jon-hunter@ti.com> Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
-rw-r--r--Documentation/devicetree/bindings/bus/ti-gpmc.txt23
-rw-r--r--arch/arm/mach-omap2/gpmc.c40
-rw-r--r--arch/arm/mach-omap2/gpmc.h2
3 files changed, 65 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
index 5ddb2e9efaaa..6fde1cfe51f8 100644
--- a/Documentation/devicetree/bindings/bus/ti-gpmc.txt
+++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
@@ -65,6 +65,29 @@ The following are only applicable to OMAP3+ and AM335x:
65 - gpmc,wr-access 65 - gpmc,wr-access
66 - gpmc,wr-data-mux-bus 66 - gpmc,wr-data-mux-bus
67 67
68GPMC chip-select settings properties for child nodes. All are optional.
69
70- gpmc,burst-length Page/burst length. Must be 4, 8 or 16.
71- gpmc,burst-wrap Enables wrap bursting
72- gpmc,burst-read Enables read page/burst mode
73- gpmc,burst-write Enables write page/burst mode
74- gpmc,device-nand Device is NAND
75- gpmc,device-width Total width of device(s) connected to a GPMC
76 chip-select in bytes. The GPMC supports 8-bit
77 and 16-bit devices and so this property must be
78 1 or 2.
79- gpmc,mux-add-data Address and data multiplexing configuration.
80 Valid values are 1 for address-address-data
81 multiplexing mode and 2 for address-data
82 multiplexing mode.
83- gpmc,sync-read Enables synchronous read. Defaults to asynchronous
84 is this is not set.
85- gpmc,sync-write Enables synchronous writes. Defaults to asynchronous
86 is this is not set.
87- gpmc,wait-pin Wait-pin used by client. Must be less than
88 "gpmc,num-waitpins".
89- gpmc,wait-on-read Enables wait monitoring on reads.
90- gpmc,wait-on-write Enables wait monitoring on writes.
68 91
69Example for an AM33xx board: 92Example for an AM33xx board:
70 93
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index b22771b4d9f2..85231b3a217e 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1187,6 +1187,46 @@ static struct of_device_id gpmc_dt_ids[] = {
1187}; 1187};
1188MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 1188MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
1189 1189
1190/**
1191 * gpmc_read_settings_dt - read gpmc settings from device-tree
1192 * @np: pointer to device-tree node for a gpmc child device
1193 * @p: pointer to gpmc settings structure
1194 *
1195 * Reads the GPMC settings for a GPMC child device from device-tree and
1196 * stores them in the GPMC settings structure passed. The GPMC settings
1197 * structure is initialised to zero by this function and so any
1198 * previously stored settings will be cleared.
1199 */
1200void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
1201{
1202 memset(p, 0, sizeof(struct gpmc_settings));
1203
1204 p->sync_read = of_property_read_bool(np, "gpmc,sync-read");
1205 p->sync_write = of_property_read_bool(np, "gpmc,sync-write");
1206 p->device_nand = of_property_read_bool(np, "gpmc,device-nand");
1207 of_property_read_u32(np, "gpmc,device-width", &p->device_width);
1208 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data);
1209
1210 if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) {
1211 p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap");
1212 p->burst_read = of_property_read_bool(np, "gpmc,burst-read");
1213 p->burst_write = of_property_read_bool(np, "gpmc,burst-write");
1214 if (!p->burst_read && !p->burst_write)
1215 pr_warn("%s: page/burst-length set but not used!\n",
1216 __func__);
1217 }
1218
1219 if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) {
1220 p->wait_on_read = of_property_read_bool(np,
1221 "gpmc,wait-on-read");
1222 p->wait_on_write = of_property_read_bool(np,
1223 "gpmc,wait-on-write");
1224 if (!p->wait_on_read && !p->wait_on_write)
1225 pr_warn("%s: read/write wait monitoring not enabled!\n",
1226 __func__);
1227 }
1228}
1229
1190static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, 1230static void __maybe_unused gpmc_read_timings_dt(struct device_node *np,
1191 struct gpmc_timings *gpmc_t) 1231 struct gpmc_timings *gpmc_t)
1192{ 1232{
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 87d2a226a3ba..707f6d58edd5 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -225,5 +225,7 @@ extern void gpmc_cs_free(int cs);
225extern void omap3_gpmc_save_context(void); 225extern void omap3_gpmc_save_context(void);
226extern void omap3_gpmc_restore_context(void); 226extern void omap3_gpmc_restore_context(void);
227extern int gpmc_configure(int cmd, int wval); 227extern int gpmc_configure(int cmd, int wval);
228extern void gpmc_read_settings_dt(struct device_node *np,
229 struct gpmc_settings *p);
228 230
229#endif 231#endif