From a385bcb70c5686683a79d33efb2080a44922ccf3 Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Wed, 25 Oct 2017 23:01:46 +0200 Subject: [PATCH] clean up ddbread/write function names --- ddbridge/ddbridge-io.c | 24 ++++++++++++------------ ddbridge/ddbridge-io.h | 24 +++++++++++++++++------- ddbridge/ddbridge-ns.c | 6 +++--- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/ddbridge/ddbridge-io.c b/ddbridge/ddbridge-io.c index cd26458..0e26a7d 100644 --- a/ddbridge/ddbridge-io.c +++ b/ddbridge/ddbridge-io.c @@ -32,10 +32,10 @@ u32 ddblreadl(struct ddb_link *link, u32 adr) spin_lock_irqsave(&link->lock, flags); gtlw(link); - ddbwritel0(link, adr & 0xfffc, link->regs + 0x14); - ddbwritel0(link, 3, link->regs + 0x10); + ddblwritel0(link, adr & 0xfffc, link->regs + 0x14); + ddblwritel0(link, 3, link->regs + 0x10); gtlw(link); - val = ddbreadl0(link, link->regs + 0x1c); + val = ddblreadl0(link, link->regs + 0x1c); spin_unlock_irqrestore(&link->lock, flags); return val; } @@ -49,9 +49,9 @@ void ddblwritel(struct ddb_link *link, u32 val, u32 adr) spin_lock_irqsave(&link->lock, flags); gtlw(link); - ddbwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); - ddbwritel0(link, val, link->regs + 0x18); - ddbwritel0(link, 1, link->regs + 0x10); + ddblwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); + ddblwritel0(link, val, link->regs + 0x18); + ddblwritel0(link, 1, link->regs + 0x10); spin_unlock_irqrestore(&link->lock, flags); return; } @@ -67,10 +67,10 @@ u32 ddbreadl(struct ddb *dev, u32 adr) spin_lock_irqsave(&link->lock, flags); gtlw(link); - ddbwritel0(link, adr & 0xfffc, link->regs + 0x14); - ddbwritel0(link, 3, link->regs + 0x10); + ddblwritel0(link, adr & 0xfffc, link->regs + 0x14); + ddblwritel0(link, 3, link->regs + 0x10); gtlw(link); - val = ddbreadl0(link, link->regs + 0x1c); + val = ddblreadl0(link, link->regs + 0x1c); spin_unlock_irqrestore(&link->lock, flags); return val; } @@ -86,9 +86,9 @@ void ddbwritel(struct ddb *dev, u32 val, u32 adr) spin_lock_irqsave(&link->lock, flags); gtlw(link); - ddbwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); - ddbwritel0(link, val, link->regs + 0x18); - ddbwritel0(link, 1, link->regs + 0x10); + ddblwritel0(link, 0xf0000 | (adr & 0xfffc), link->regs + 0x14); + ddblwritel0(link, val, link->regs + 0x18); + ddblwritel0(link, 1, link->regs + 0x10); spin_unlock_irqrestore(&link->lock, flags); return; } diff --git a/ddbridge/ddbridge-io.h b/ddbridge/ddbridge-io.h index e6719b5..baff5cc 100644 --- a/ddbridge/ddbridge-io.h +++ b/ddbridge/ddbridge-io.h @@ -34,22 +34,32 @@ void gtlcpyfrom(struct ddb *dev, u8 *buf, u32 adr, long count); void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count); void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count); -static inline void ddbwriteb(struct ddb *dev, u32 val, u32 adr) +static inline void ddbwriteb0(struct ddb *dev, u32 val, u32 adr) { writeb(val, (char *)(dev->regs + (adr))); } -static inline u32 ddbreadb(struct ddb *dev, u32 adr) +static inline u32 ddbreadb0(struct ddb *dev, u32 adr) { return readb((char *)(dev->regs + (adr))); } -static inline void ddbwritel0(struct ddb_link *link, u32 val, u32 adr) +static inline void ddbwritel0(struct ddb *dev, u32 val, u32 adr) +{ + writel(val, (char *)(dev->regs + (adr))); +} + +static inline u32 ddbreadl0(struct ddb *dev, u32 adr) +{ + return readl((char *)(dev->regs + (adr))); +} + +static inline void ddblwritel0(struct ddb_link *link, u32 val, u32 adr) { writel(val, (char *)(link->dev->regs + (adr))); } -static inline u32 ddbreadl0(struct ddb_link *link, u32 adr) +static inline u32 ddblreadl0(struct ddb_link *link, u32 adr) { return readl((char *)(link->dev->regs + (adr))); } @@ -60,7 +70,7 @@ static inline void gtlw(struct ddb_link *link) u32 count = 0; static u32 max; - while (1 & ddbreadl0(link, link->regs + 0x10)) { + while (1 & ddblreadl0(link, link->regs + 0x10)) { if (++count == 1024) { pr_info("LTO\n"); break; @@ -70,13 +80,13 @@ static inline void gtlw(struct ddb_link *link) max = count; pr_info("TO=%u\n", max); } - if (ddbreadl0(link, link->regs + 0x10) & 0x8000) + if (ddblreadl0(link, link->regs + 0x10) & 0x8000) pr_err("link error\n"); } #else static inline void gtlw(struct ddb_link *link) { - while (1 & ddbreadl0(link, link->regs + 0x10)) + while (1 & ddblreadl0(link, link->regs + 0x10)) ; } #endif diff --git a/ddbridge/ddbridge-ns.c b/ddbridge/ddbridge-ns.c index c877b3a..bde6463 100644 --- a/ddbridge/ddbridge-ns.c +++ b/ddbridge/ddbridge-ns.c @@ -152,12 +152,12 @@ static int ns_set_pid(struct dvbnss *nss, u16 pid) else ddbmemset(dev, off, 0x00, 0x400); } else { - u8 val = ddbreadb(dev, off + byte); + u8 val = ddbreadb0(dev, off + byte); if (pid & 0x8000) - ddbwriteb(dev, val | bit, off + byte); + ddbwriteb0(dev, val | bit, off + byte); else - ddbwriteb(dev, val & ~bit, off + byte); + ddbwriteb0(dev, val & ~bit, off + byte); } } #else