V4L/DVB (13742): [Mantis] Implement PCMCIA I/O Rd/Wr operations

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Manu Abraham 2009-12-04 05:10:25 -03:00 committed by Mauro Carvalho Chehab
parent d8b14f8a76
commit c9a750c909
2 changed files with 56 additions and 0 deletions

View File

@ -111,6 +111,60 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
return 0;
}
int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data)
{
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr |= MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
ca->hif_job_queue = MANTIS_HIF_IOMRD;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
*data = mmread(MANTIS_GPIF_HIFDIN);
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
return 0;
}
int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data)
{
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
mmwrite(data, MANTIS_GPIF_HIFDOUT);
ca->hif_job_queue = MANTIS_HIF_IOMWR;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
return 0;
}
int mantis_hif_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;

View File

@ -73,5 +73,7 @@ extern int mantis_hif_init(struct mantis_ca *ca);
extern void mantis_hif_exit(struct mantis_ca *ca);
extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data);
extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data);
#endif // __MANTIS_LINK_H