Commit 068d9f6e authored by Hans-Christian Egtvedt's avatar Hans-Christian Egtvedt Committed by Haavard Skinnemoen

[AVR32] Add nwait and tdf parameters to SMC configuration

Complete the SMC configuration code by adding nwait and tdf
parameter. After this change, we support the same parameters as the
hardware.
Signed-off-by: default avatarHaavard Skinnemoen <hskinnemoen@atmel.com>
parent 9c8f8e75
...@@ -75,12 +75,35 @@ int smc_set_configuration(int cs, const struct smc_config *config) ...@@ -75,12 +75,35 @@ int smc_set_configuration(int cs, const struct smc_config *config)
return -EINVAL; return -EINVAL;
} }
switch (config->nwait_mode) {
case 0:
mode |= HSMC_BF(EXNW_MODE, HSMC_EXNW_MODE_DISABLED);
break;
case 1:
mode |= HSMC_BF(EXNW_MODE, HSMC_EXNW_MODE_RESERVED);
break;
case 2:
mode |= HSMC_BF(EXNW_MODE, HSMC_EXNW_MODE_FROZEN);
break;
case 3:
mode |= HSMC_BF(EXNW_MODE, HSMC_EXNW_MODE_READY);
break;
default:
return -EINVAL;
}
if (config->tdf_cycles) {
mode |= HSMC_BF(TDF_CYCLES, config->tdf_cycles);
}
if (config->nrd_controlled) if (config->nrd_controlled)
mode |= HSMC_BIT(READ_MODE); mode |= HSMC_BIT(READ_MODE);
if (config->nwe_controlled) if (config->nwe_controlled)
mode |= HSMC_BIT(WRITE_MODE); mode |= HSMC_BIT(WRITE_MODE);
if (config->byte_write) if (config->byte_write)
mode |= HSMC_BIT(BAT); mode |= HSMC_BIT(BAT);
if (config->tdf_mode)
mode |= HSMC_BIT(TDF_MODE);
pr_debug("smc cs%d: setup/%08x pulse/%08x cycle/%08x mode/%08x\n", pr_debug("smc cs%d: setup/%08x pulse/%08x cycle/%08x mode/%08x\n",
cs, setup, pulse, cycle, mode); cs, setup, pulse, cycle, mode);
......
...@@ -47,11 +47,33 @@ struct smc_config { ...@@ -47,11 +47,33 @@ struct smc_config {
*/ */
unsigned int nwe_controlled:1; unsigned int nwe_controlled:1;
/*
* 0: NWAIT is disabled
* 1: Reserved
* 2: NWAIT is frozen mode
* 3: NWAIT in ready mode
*/
unsigned int nwait_mode:2;
/* /*
* 0: Byte select access type * 0: Byte select access type
* 1: Byte write access type * 1: Byte write access type
*/ */
unsigned int byte_write:1; unsigned int byte_write:1;
/*
* Number of clock cycles before data is released after
* the rising edge of the read controlling signal
*
* Total cycles from SMC is tdf_cycles + 1
*/
unsigned int tdf_cycles:4;
/*
* 0: TDF optimization disabled
* 1: TDF optimization enabled
*/
unsigned int tdf_mode:1;
}; };
extern int smc_set_configuration(int cs, const struct smc_config *config); extern int smc_set_configuration(int cs, const struct smc_config *config);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment