aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-08-22 09:27:37 -0400
committerArnd Bergmann <arnd@arndb.de>2017-08-22 09:27:37 -0400
commit324c654dfc28f899d150873ffb99549c0dcafe47 (patch)
treea87780c03fe618bd9f653373cd10d248518c5eb7
parent4459398b6d9e3055ced5de9820364b3bdd79ac25 (diff)
parent3fb3b3c4b68e33bb4acf42361b6a0db96115de35 (diff)
Merge tag 'at91-ab-4.13-drivers-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux into fixes
Pull "Driver fixes for 4.13" from Alexandre Belloni: - Multiple EBI/SMC timing setting/calculation fixes * tag 'at91-ab-4.13-drivers-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: memory: atmel-ebi: Fix smc cycle xlate converter memory: atmel-ebi: Allow t_DF timings of zero ns memory: atmel-ebi: Fix smc timing return value evaluation
-rw-r--r--drivers/memory/atmel-ebi.c10
-rw-r--r--drivers/mfd/atmel-smc.c2
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 99e644cda4d1..ebf69ff48ae2 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -72,7 +72,7 @@ struct atmel_smc_timing_xlate {
72 { .name = nm, .converter = atmel_smc_cs_conf_set_pulse, .shift = pos} 72 { .name = nm, .converter = atmel_smc_cs_conf_set_pulse, .shift = pos}
73 73
74#define ATMEL_SMC_CYCLE_XLATE(nm, pos) \ 74#define ATMEL_SMC_CYCLE_XLATE(nm, pos) \
75 { .name = nm, .converter = atmel_smc_cs_conf_set_setup, .shift = pos} 75 { .name = nm, .converter = atmel_smc_cs_conf_set_cycle, .shift = pos}
76 76
77static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid, 77static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid,
78 struct atmel_ebi_dev_config *conf) 78 struct atmel_ebi_dev_config *conf)
@@ -120,12 +120,14 @@ static int atmel_ebi_xslate_smc_timings(struct atmel_ebi_dev *ebid,
120 if (!ret) { 120 if (!ret) {
121 required = true; 121 required = true;
122 ncycles = DIV_ROUND_UP(val, clk_period_ns); 122 ncycles = DIV_ROUND_UP(val, clk_period_ns);
123 if (ncycles > ATMEL_SMC_MODE_TDF_MAX || 123 if (ncycles > ATMEL_SMC_MODE_TDF_MAX) {
124 ncycles < ATMEL_SMC_MODE_TDF_MIN) {
125 ret = -EINVAL; 124 ret = -EINVAL;
126 goto out; 125 goto out;
127 } 126 }
128 127
128 if (ncycles < ATMEL_SMC_MODE_TDF_MIN)
129 ncycles = ATMEL_SMC_MODE_TDF_MIN;
130
129 smcconf->mode |= ATMEL_SMC_MODE_TDF(ncycles); 131 smcconf->mode |= ATMEL_SMC_MODE_TDF(ncycles);
130 } 132 }
131 133
@@ -263,7 +265,7 @@ static int atmel_ebi_xslate_smc_config(struct atmel_ebi_dev *ebid,
263 } 265 }
264 266
265 ret = atmel_ebi_xslate_smc_timings(ebid, np, &conf->smcconf); 267 ret = atmel_ebi_xslate_smc_timings(ebid, np, &conf->smcconf);
266 if (ret) 268 if (ret < 0)
267 return -EINVAL; 269 return -EINVAL;
268 270
269 if ((ret > 0 && !required) || (!ret && required)) { 271 if ((ret > 0 && !required) || (!ret && required)) {
diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
index 954cf0f66a31..20cc0ea470fa 100644
--- a/drivers/mfd/atmel-smc.c
+++ b/drivers/mfd/atmel-smc.c
@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(atmel_smc_cs_conf_set_pulse);
206 * parameter 206 * parameter
207 * 207 *
208 * This function encodes the @ncycles value as described in the datasheet 208 * This function encodes the @ncycles value as described in the datasheet
209 * (section "SMC Pulse Register"), and then stores the result in the 209 * (section "SMC Cycle Register"), and then stores the result in the
210 * @conf->setup field at @shift position. 210 * @conf->setup field at @shift position.
211 * 211 *
212 * Returns -EINVAL if @shift is invalid, -ERANGE if @ncycles does not fit in 212 * Returns -EINVAL if @shift is invalid, -ERANGE if @ncycles does not fit in