diff mbox

[02/11] ARM: OMAP2+: gpmc-onenand: Drop global gpmc_settings

Message ID 20171015231810.zwhwj25sz4pumttf@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Oct. 15, 2017, 11:18 p.m. UTC
As gpmc_read_settings_dt zeroes gpmc_settings, there is
no point to set any defaults.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 arch/arm/mach-omap2/gpmc-onenand.c | 54 ++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 32 deletions(-)
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 6847a07aacf9..3b50b9b5cb2f 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -46,21 +46,8 @@  static struct platform_device gpmc_onenand_device = {
 	.resource	= &gpmc_onenand_resource,
 };
 
-static struct gpmc_settings onenand_async = {
-	.device_width	= GPMC_DEVWIDTH_16BIT,
-	.mux_add_data	= GPMC_MUX_AD,
-};
-
-static struct gpmc_settings onenand_sync = {
-	.burst_read	= true,
-	.burst_wrap	= true,
-	.burst_len	= GPMC_BURST_16,
-	.device_width	= GPMC_DEVWIDTH_16BIT,
-	.mux_add_data	= GPMC_MUX_AD,
-	.wait_pin	= 0,
-};
-
-static void omap2_onenand_calc_async_timings(struct gpmc_timings *t)
+static void omap2_onenand_calc_async_timings(struct gpmc_timings *t,
+					     struct gpmc_settings *s)
 {
 	struct gpmc_device_timings dev_t;
 	const int t_cer = 15;
@@ -86,7 +73,7 @@  static void omap2_onenand_calc_async_timings(struct gpmc_timings *t)
 	dev_t.t_wpl = t_wpl * 1000;
 	dev_t.t_wph = t_wph * 1000;
 
-	gpmc_calc_timings(t, &onenand_async, &dev_t);
+	gpmc_calc_timings(t, s, &dev_t);
 }
 
 static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
@@ -156,6 +143,7 @@  static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
 }
 
 static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
+					    struct gpmc_settings *s,
 					    unsigned int flags,
 					    int freq)
 {
@@ -236,10 +224,10 @@  static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 	memset(&dev_t, 0, sizeof(dev_t));
 
 	if (onenand_flags & ONENAND_FLAG_SYNCREAD)
-		onenand_sync.sync_read = true;
+		s->sync_read = true;
 	if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
-		onenand_sync.sync_write = true;
-		onenand_sync.burst_write = true;
+		s->sync_write = true;
+		s->burst_write = true;
 	} else {
 		dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000;
 		dev_t.t_wpl = t_wpl * 1000;
@@ -262,12 +250,13 @@  static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
 	dev_t.cyc_aavdh_oe = 1;
 	dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period;
 
-	gpmc_calc_timings(t, &onenand_sync, &dev_t);
+	gpmc_calc_timings(t, s, &dev_t);
 }
 
 static int omap2_onenand_setup_async(void __iomem *onenand_base)
 {
 	struct gpmc_timings t;
+	struct gpmc_settings s;
 	int ret;
 
 	/*
@@ -275,23 +264,23 @@  static int omap2_onenand_setup_async(void __iomem *onenand_base)
 	 * omap2_onenand_set_async_mode() to work to detect the onenand
 	 * supported clock rate for the sync timings.
 	 */
-	gpmc_read_settings_dt(gpmc_onenand_data->of_node, &onenand_async);
-	if (onenand_async.sync_read || onenand_async.sync_write) {
-		if (onenand_async.sync_write)
+	gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s);
+	if (s.sync_read || s.sync_write) {
+		if (s.sync_write)
 			gpmc_onenand_data->flags |= ONENAND_SYNC_READWRITE;
 		else
 			gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
-		onenand_async.sync_read = false;
+		s.sync_read = false;
 	}
 
-	onenand_async.sync_write = true;
-	omap2_onenand_calc_async_timings(&t);
+	s.sync_write = true;
+	omap2_onenand_calc_async_timings(&t, &s);
 
-	ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async);
+	ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s);
 	if (ret < 0)
 		return ret;
 
-	ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &onenand_async);
+	ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &s);
 	if (ret < 0)
 		return ret;
 
@@ -304,6 +293,7 @@  static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
 {
 	int ret, freq = *freq_ptr;
 	struct gpmc_timings t;
+	struct gpmc_settings s;
 
 	if (!freq) {
 		/* Very first call freq is not known */
@@ -313,15 +303,15 @@  static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
 		set_onenand_cfg(onenand_base);
 	}
 
-	gpmc_read_settings_dt(gpmc_onenand_data->of_node, &onenand_sync);
+	gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s);
 
-	omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq);
+	omap2_onenand_calc_sync_timings(&t, &s, gpmc_onenand_data->flags, freq);
 
-	ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync);
+	ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s);
 	if (ret < 0)
 		return ret;
 
-	ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &onenand_sync);
+	ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &s);
 	if (ret < 0)
 		return ret;