Commit ad7bdbc8 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Miquel Raynal

memory: atmel-ebi: add generic name for ebi regmap

The sam9x60 board defines the CCFG_EBICSA register under SFR,
and not as a MATRIX register, as previous boards do. Add a
more generic name for the EBI regmap as a prerequisite for
sam9x60 ebi support.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent b309df24
...@@ -36,6 +36,7 @@ struct atmel_ebi_dev { ...@@ -36,6 +36,7 @@ struct atmel_ebi_dev {
struct atmel_ebi_caps { struct atmel_ebi_caps {
unsigned int available_cs; unsigned int available_cs;
unsigned int ebi_csa_offs; unsigned int ebi_csa_offs;
const char *regmap_name;
void (*get_config)(struct atmel_ebi_dev *ebid, void (*get_config)(struct atmel_ebi_dev *ebid,
struct atmel_ebi_dev_config *conf); struct atmel_ebi_dev_config *conf);
int (*xlate_config)(struct atmel_ebi_dev *ebid, int (*xlate_config)(struct atmel_ebi_dev *ebid,
...@@ -47,7 +48,7 @@ struct atmel_ebi_caps { ...@@ -47,7 +48,7 @@ struct atmel_ebi_caps {
struct atmel_ebi { struct atmel_ebi {
struct clk *clk; struct clk *clk;
struct regmap *matrix; struct regmap *regmap;
struct { struct {
struct regmap *regmap; struct regmap *regmap;
struct clk *clk; struct clk *clk;
...@@ -357,7 +358,7 @@ static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np, ...@@ -357,7 +358,7 @@ static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
* one "atmel,smc-" property is present. * one "atmel,smc-" property is present.
*/ */
if (ebi->caps->ebi_csa_offs && apply) if (ebi->caps->ebi_csa_offs && apply)
regmap_update_bits(ebi->matrix, regmap_update_bits(ebi->regmap,
ebi->caps->ebi_csa_offs, ebi->caps->ebi_csa_offs,
BIT(cs), 0); BIT(cs), 0);
...@@ -372,6 +373,7 @@ static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np, ...@@ -372,6 +373,7 @@ static int atmel_ebi_dev_setup(struct atmel_ebi *ebi, struct device_node *np,
static const struct atmel_ebi_caps at91sam9260_ebi_caps = { static const struct atmel_ebi_caps at91sam9260_ebi_caps = {
.available_cs = 0xff, .available_cs = 0xff,
.ebi_csa_offs = AT91SAM9260_MATRIX_EBICSA, .ebi_csa_offs = AT91SAM9260_MATRIX_EBICSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -380,6 +382,7 @@ static const struct atmel_ebi_caps at91sam9260_ebi_caps = { ...@@ -380,6 +382,7 @@ static const struct atmel_ebi_caps at91sam9260_ebi_caps = {
static const struct atmel_ebi_caps at91sam9261_ebi_caps = { static const struct atmel_ebi_caps at91sam9261_ebi_caps = {
.available_cs = 0xff, .available_cs = 0xff,
.ebi_csa_offs = AT91SAM9261_MATRIX_EBICSA, .ebi_csa_offs = AT91SAM9261_MATRIX_EBICSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -388,6 +391,7 @@ static const struct atmel_ebi_caps at91sam9261_ebi_caps = { ...@@ -388,6 +391,7 @@ static const struct atmel_ebi_caps at91sam9261_ebi_caps = {
static const struct atmel_ebi_caps at91sam9263_ebi0_caps = { static const struct atmel_ebi_caps at91sam9263_ebi0_caps = {
.available_cs = 0x3f, .available_cs = 0x3f,
.ebi_csa_offs = AT91SAM9263_MATRIX_EBI0CSA, .ebi_csa_offs = AT91SAM9263_MATRIX_EBI0CSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -396,6 +400,7 @@ static const struct atmel_ebi_caps at91sam9263_ebi0_caps = { ...@@ -396,6 +400,7 @@ static const struct atmel_ebi_caps at91sam9263_ebi0_caps = {
static const struct atmel_ebi_caps at91sam9263_ebi1_caps = { static const struct atmel_ebi_caps at91sam9263_ebi1_caps = {
.available_cs = 0x7, .available_cs = 0x7,
.ebi_csa_offs = AT91SAM9263_MATRIX_EBI1CSA, .ebi_csa_offs = AT91SAM9263_MATRIX_EBI1CSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -404,6 +409,7 @@ static const struct atmel_ebi_caps at91sam9263_ebi1_caps = { ...@@ -404,6 +409,7 @@ static const struct atmel_ebi_caps at91sam9263_ebi1_caps = {
static const struct atmel_ebi_caps at91sam9rl_ebi_caps = { static const struct atmel_ebi_caps at91sam9rl_ebi_caps = {
.available_cs = 0x3f, .available_cs = 0x3f,
.ebi_csa_offs = AT91SAM9RL_MATRIX_EBICSA, .ebi_csa_offs = AT91SAM9RL_MATRIX_EBICSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -412,6 +418,7 @@ static const struct atmel_ebi_caps at91sam9rl_ebi_caps = { ...@@ -412,6 +418,7 @@ static const struct atmel_ebi_caps at91sam9rl_ebi_caps = {
static const struct atmel_ebi_caps at91sam9g45_ebi_caps = { static const struct atmel_ebi_caps at91sam9g45_ebi_caps = {
.available_cs = 0x3f, .available_cs = 0x3f,
.ebi_csa_offs = AT91SAM9G45_MATRIX_EBICSA, .ebi_csa_offs = AT91SAM9G45_MATRIX_EBICSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -420,6 +427,7 @@ static const struct atmel_ebi_caps at91sam9g45_ebi_caps = { ...@@ -420,6 +427,7 @@ static const struct atmel_ebi_caps at91sam9g45_ebi_caps = {
static const struct atmel_ebi_caps at91sam9x5_ebi_caps = { static const struct atmel_ebi_caps at91sam9x5_ebi_caps = {
.available_cs = 0x3f, .available_cs = 0x3f,
.ebi_csa_offs = AT91SAM9X5_MATRIX_EBICSA, .ebi_csa_offs = AT91SAM9X5_MATRIX_EBICSA,
.regmap_name = "atmel,matrix",
.get_config = at91sam9_ebi_get_config, .get_config = at91sam9_ebi_get_config,
.xlate_config = atmel_ebi_xslate_smc_config, .xlate_config = atmel_ebi_xslate_smc_config,
.apply_config = at91sam9_ebi_apply_config, .apply_config = at91sam9_ebi_apply_config,
...@@ -543,13 +551,14 @@ static int atmel_ebi_probe(struct platform_device *pdev) ...@@ -543,13 +551,14 @@ static int atmel_ebi_probe(struct platform_device *pdev)
/* /*
* The sama5d3 does not provide an EBICSA register and thus does need * The sama5d3 does not provide an EBICSA register and thus does need
* to access the matrix registers. * to access it.
*/ */
if (ebi->caps->ebi_csa_offs) { if (ebi->caps->ebi_csa_offs) {
ebi->matrix = ebi->regmap =
syscon_regmap_lookup_by_phandle(np, "atmel,matrix"); syscon_regmap_lookup_by_phandle(np,
if (IS_ERR(ebi->matrix)) ebi->caps->regmap_name);
return PTR_ERR(ebi->matrix); if (IS_ERR(ebi->regmap))
return PTR_ERR(ebi->regmap);
} }
ret = of_property_read_u32(np, "#address-cells", &val); ret = of_property_read_u32(np, "#address-cells", &val);
......
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