diff options
| -rw-r--r-- | drivers/memory/atmel-ebi.c | 10 | ||||
| -rw-r--r-- | drivers/mfd/atmel-smc.c | 2 |
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 | ||
| 77 | static void at91sam9_ebi_get_config(struct atmel_ebi_dev *ebid, | 77 | static 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 |
