pata/at91: use newly introduced SMC accessors
pata_at91 driver is broken since faee0cc
:
"make smc register base soc independent"
Fix it with newly introduced SMC accessors.
The overall action of removal of at91_sys_read/write will allow
to use the pata_at91 on a single zImage kernel.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: linux-ide@vger.kernel.org
This commit is contained in:
parent
59594e13e4
commit
88dcde98ad
|
@ -207,11 +207,11 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int use_iordy;
|
int use_iordy;
|
||||||
|
struct sam9_smc_config smc;
|
||||||
unsigned int t6z; /* data tristate time in ns */
|
unsigned int t6z; /* data tristate time in ns */
|
||||||
unsigned int cycle; /* SMC Cycle width in MCK ticks */
|
unsigned int cycle; /* SMC Cycle width in MCK ticks */
|
||||||
unsigned int setup; /* SMC Setup width in MCK ticks */
|
unsigned int setup; /* SMC Setup width in MCK ticks */
|
||||||
unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */
|
unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */
|
||||||
unsigned int cs_setup = 0;/* CS4 or CS5 setup width in MCK ticks */
|
|
||||||
unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/
|
unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/
|
||||||
unsigned int tdf_cycles; /* SMC TDF MCK ticks */
|
unsigned int tdf_cycles; /* SMC TDF MCK ticks */
|
||||||
unsigned long mck_hz; /* MCK frequency in Hz */
|
unsigned long mck_hz; /* MCK frequency in Hz */
|
||||||
|
@ -244,26 +244,20 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev,
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles);
|
dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles);
|
||||||
info->mode |= AT91_SMC_TDF_(tdf_cycles);
|
|
||||||
|
|
||||||
/* write SMC Setup Register */
|
/* SMC Setup Register */
|
||||||
at91_sys_write(AT91_SMC_SETUP(info->cs),
|
smc.nwe_setup = smc.nrd_setup = setup;
|
||||||
AT91_SMC_NWESETUP_(setup) |
|
smc.ncs_write_setup = smc.ncs_read_setup = 0;
|
||||||
AT91_SMC_NRDSETUP_(setup) |
|
/* SMC Pulse Register */
|
||||||
AT91_SMC_NCS_WRSETUP_(cs_setup) |
|
smc.nwe_pulse = smc.nrd_pulse = pulse;
|
||||||
AT91_SMC_NCS_RDSETUP_(cs_setup));
|
smc.ncs_write_pulse = smc.ncs_read_pulse = cs_pulse;
|
||||||
/* write SMC Pulse Register */
|
/* SMC Cycle Register */
|
||||||
at91_sys_write(AT91_SMC_PULSE(info->cs),
|
smc.write_cycle = smc.read_cycle = cycle;
|
||||||
AT91_SMC_NWEPULSE_(pulse) |
|
/* SMC Mode Register*/
|
||||||
AT91_SMC_NRDPULSE_(pulse) |
|
smc.tdf_cycles = tdf_cycles;
|
||||||
AT91_SMC_NCS_WRPULSE_(cs_pulse) |
|
smc.mode = info->mode;
|
||||||
AT91_SMC_NCS_RDPULSE_(cs_pulse));
|
|
||||||
/* write SMC Cycle Register */
|
sam9_smc_configure(0, info->cs, &smc);
|
||||||
at91_sys_write(AT91_SMC_CYCLE(info->cs),
|
|
||||||
AT91_SMC_NWECYCLE_(cycle) |
|
|
||||||
AT91_SMC_NRDCYCLE_(cycle));
|
|
||||||
/* write SMC Mode Register*/
|
|
||||||
at91_sys_write(AT91_SMC_MODE(info->cs), info->mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
||||||
|
@ -288,20 +282,20 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev,
|
||||||
struct at91_ide_info *info = dev->link->ap->host->private_data;
|
struct at91_ide_info *info = dev->link->ap->host->private_data;
|
||||||
unsigned int consumed;
|
unsigned int consumed;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned int mode;
|
struct sam9_smc_config smc;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
mode = at91_sys_read(AT91_SMC_MODE(info->cs));
|
sam9_smc_read_mode(0, info->cs, &smc);
|
||||||
|
|
||||||
/* set 16bit mode before writing data */
|
/* set 16bit mode before writing data */
|
||||||
at91_sys_write(AT91_SMC_MODE(info->cs),
|
smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16;
|
||||||
(mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16);
|
sam9_smc_write_mode(0, info->cs, &smc);
|
||||||
|
|
||||||
consumed = ata_sff_data_xfer(dev, buf, buflen, rw);
|
consumed = ata_sff_data_xfer(dev, buf, buflen, rw);
|
||||||
|
|
||||||
/* restore 8bit mode after data is written */
|
/* restore 8bit mode after data is written */
|
||||||
at91_sys_write(AT91_SMC_MODE(info->cs),
|
smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8;
|
||||||
(mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8);
|
sam9_smc_write_mode(0, info->cs, &smc);
|
||||||
|
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
return consumed;
|
return consumed;
|
||||||
|
|
Loading…
Reference in a new issue