Commit 63b40456 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc64: Add missing null terminating entry to bq4802_match[].
  sparc: use the new byteorder headers
  rtc-m48t59: shift zero year to 1968 on sparc (rev 2)
  dbri: check dma_alloc_coherent errors
  sparc64: remove byteshifting from out* helpers
parents eff25028 770a4241
...@@ -4,15 +4,14 @@ ...@@ -4,15 +4,14 @@
#include <asm/types.h> #include <asm/types.h>
#include <asm/asi.h> #include <asm/asi.h>
#ifdef __GNUC__ #define __BIG_ENDIAN
#ifdef CONFIG_SPARC32 #ifdef CONFIG_SPARC32
#define __SWAB_64_THRU_32__ #define __SWAB_64_THRU_32__
#endif #endif
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC64
static inline __u16 __arch_swab16p(const __u16 *addr)
static inline __u16 ___arch__swab16p(const __u16 *addr)
{ {
__u16 ret; __u16 ret;
...@@ -21,8 +20,9 @@ static inline __u16 ___arch__swab16p(const __u16 *addr) ...@@ -21,8 +20,9 @@ static inline __u16 ___arch__swab16p(const __u16 *addr)
: "r" (addr), "i" (ASI_PL)); : "r" (addr), "i" (ASI_PL));
return ret; return ret;
} }
#define __arch_swab16p __arch_swab16p
static inline __u32 ___arch__swab32p(const __u32 *addr) static inline __u32 __arch_swab32p(const __u32 *addr)
{ {
__u32 ret; __u32 ret;
...@@ -31,8 +31,9 @@ static inline __u32 ___arch__swab32p(const __u32 *addr) ...@@ -31,8 +31,9 @@ static inline __u32 ___arch__swab32p(const __u32 *addr)
: "r" (addr), "i" (ASI_PL)); : "r" (addr), "i" (ASI_PL));
return ret; return ret;
} }
#define __arch_swab32p __arch_swab32p
static inline __u64 ___arch__swab64p(const __u64 *addr) static inline __u64 __arch_swab64p(const __u64 *addr)
{ {
__u64 ret; __u64 ret;
...@@ -41,17 +42,10 @@ static inline __u64 ___arch__swab64p(const __u64 *addr) ...@@ -41,17 +42,10 @@ static inline __u64 ___arch__swab64p(const __u64 *addr)
: "r" (addr), "i" (ASI_PL)); : "r" (addr), "i" (ASI_PL));
return ret; return ret;
} }
#define __arch_swab64p __arch_swab64p
#define __arch__swab16p(x) ___arch__swab16p(x)
#define __arch__swab32p(x) ___arch__swab32p(x)
#define __arch__swab64p(x) ___arch__swab64p(x)
#endif /* CONFIG_SPARC64 */ #endif /* CONFIG_SPARC64 */
#define __BYTEORDER_HAS_U64__ #include <linux/byteorder.h>
#endif
#include <linux/byteorder/big_endian.h>
#endif /* _SPARC_BYTEORDER_H */ #endif /* _SPARC_BYTEORDER_H */
...@@ -119,35 +119,16 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs) ...@@ -119,35 +119,16 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct m48t59_plat_data *pdata = pdev->dev.platform_data; struct m48t59_plat_data *pdata = pdev->dev.platform_data;
void __iomem *regs = pdata->ioaddr;
unsigned char val = readb(regs + ofs); return readb(pdata->ioaddr + ofs);
/* the year 0 is 1968 */
if (ofs == pdata->offset + M48T59_YEAR) {
val += 0x68;
if ((val & 0xf) > 9)
val += 6;
}
return val;
} }
static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct m48t59_plat_data *pdata = pdev->dev.platform_data; struct m48t59_plat_data *pdata = pdev->dev.platform_data;
void __iomem *regs = pdata->ioaddr;
writeb(val, pdata->ioaddr + ofs);
if (ofs == pdata->offset + M48T59_YEAR) {
if (val < 0x68)
val += 0x32;
else
val -= 0x68;
if ((val & 0xf) > 9)
val += 6;
if ((val & 0xf0) > 0x9A)
val += 0x60;
}
writeb(val, regs + ofs);
} }
static struct m48t59_plat_data m48t59_data = { static struct m48t59_plat_data m48t59_data = {
......
...@@ -490,6 +490,7 @@ static struct of_device_id __initdata bq4802_match[] = { ...@@ -490,6 +490,7 @@ static struct of_device_id __initdata bq4802_match[] = {
.name = "rtc", .name = "rtc",
.compatible = "bq4802", .compatible = "bq4802",
}, },
{},
}; };
static struct of_platform_driver bq4802_driver = { static struct of_platform_driver bq4802_driver = {
...@@ -503,39 +504,16 @@ static struct of_platform_driver bq4802_driver = { ...@@ -503,39 +504,16 @@ static struct of_platform_driver bq4802_driver = {
static unsigned char mostek_read_byte(struct device *dev, u32 ofs) static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct m48t59_plat_data *pdata = pdev->dev.platform_data; void __iomem *regs = (void __iomem *) pdev->resource[0].start;
void __iomem *regs;
unsigned char val; return readb(regs + ofs);
regs = (void __iomem *) pdev->resource[0].start;
val = readb(regs + ofs);
/* the year 0 is 1968 */
if (ofs == pdata->offset + M48T59_YEAR) {
val += 0x68;
if ((val & 0xf) > 9)
val += 6;
}
return val;
} }
static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct m48t59_plat_data *pdata = pdev->dev.platform_data; void __iomem *regs = (void __iomem *) pdev->resource[0].start;
void __iomem *regs;
regs = (void __iomem *) pdev->resource[0].start;
if (ofs == pdata->offset + M48T59_YEAR) {
if (val < 0x68)
val += 0x32;
else
val -= 0x68;
if ((val & 0xf) > 9)
val += 6;
if ((val & 0xf0) > 0x9A)
val += 0x60;
}
writeb(val, regs + ofs); writeb(val, regs + ofs);
} }
......
...@@ -20,107 +20,62 @@ void outsw(unsigned long __addr, const void *src, unsigned long count) ...@@ -20,107 +20,62 @@ void outsw(unsigned long __addr, const void *src, unsigned long count)
{ {
void __iomem *addr = (void __iomem *) __addr; void __iomem *addr = (void __iomem *) __addr;
if (count) { while (count--) {
u16 *ps = (u16 *)src; __raw_writew(*(u16 *)src, addr);
u32 *pi; src += sizeof(u16);
if (((u64)src) & 0x2) {
u16 val = le16_to_cpup(ps);
outw(val, addr);
ps++;
count--;
}
pi = (u32 *)ps;
while (count >= 2) {
u32 w = le32_to_cpup(pi);
pi++;
outw(w >> 0, addr);
outw(w >> 16, addr);
count -= 2;
}
ps = (u16 *)pi;
if (count) {
u16 val = le16_to_cpup(ps);
outw(val, addr);
}
} }
} }
void outsl(unsigned long __addr, const void *src, unsigned long count) void outsl(unsigned long __addr, const void *src, unsigned long count)
{ {
void __iomem *addr = (void __iomem *) __addr; void __iomem *addr = (void __iomem *) __addr;
u32 l, l2;
if (count) { if (!count)
if ((((u64)src) & 0x3) == 0) { return;
u32 *p = (u32 *)src;
while (count--) {
u32 val = cpu_to_le32p(p);
outl(val, addr);
p++;
}
} else {
u8 *pb;
u16 *ps = (u16 *)src;
u32 l = 0, l2;
u32 *pi;
switch (((u64)src) & 0x3) {
case 0x2:
count -= 1;
l = cpu_to_le16p(ps) << 16;
ps++;
pi = (u32 *)ps;
while (count--) {
l2 = cpu_to_le32p(pi);
pi++;
outl(((l >> 16) | (l2 << 16)), addr);
l = l2;
}
ps = (u16 *)pi;
l2 = cpu_to_le16p(ps);
outl(((l >> 16) | (l2 << 16)), addr);
break;
case 0x1:
count -= 1;
pb = (u8 *)src;
l = (*pb++ << 8);
ps = (u16 *)pb;
l2 = cpu_to_le16p(ps);
ps++;
l |= (l2 << 16);
pi = (u32 *)ps;
while (count--) {
l2 = cpu_to_le32p(pi);
pi++;
outl(((l >> 8) | (l2 << 24)), addr);
l = l2;
}
pb = (u8 *)pi;
outl(((l >> 8) | (*pb << 24)), addr);
break;
case 0x3: switch (((unsigned long)src) & 0x3) {
count -= 1; case 0x0:
pb = (u8 *)src; /* src is naturally aligned */
l = (*pb++ << 24); while (count--) {
pi = (u32 *)pb; __raw_writel(*(u32 *)src, addr);
while (count--) { src += sizeof(u32);
l2 = cpu_to_le32p(pi); }
pi++; break;
outl(((l >> 24) | (l2 << 8)), addr); case 0x2:
l = l2; /* 2-byte alignment */
} while (count--) {
ps = (u16 *)pi; l = (*(u16 *)src) << 16;
l2 = cpu_to_le16p(ps); l |= *(u16 *)(src + sizeof(u16));
ps++; __raw_writel(l, addr);
pb = (u8 *)ps; src += sizeof(u32);
l2 |= (*pb << 16); }
outl(((l >> 24) | (l2 << 8)), addr); break;
break; case 0x1:
} /* Hold three bytes in l each time, grab a byte from l2 */
l = (*(u8 *)src) << 24;
l |= (*(u16 *)(src + sizeof(u8))) << 8;
src += sizeof(u8) + sizeof(u16);
while (count--) {
l2 = *(u32 *)src;
l |= (l2 >> 24);
__raw_writel(l, addr);
l = l2 << 8;
src += sizeof(u32);
}
break;
case 0x3:
/* Hold a byte in l each time, grab 3 bytes from l2 */
l = (*(u8 *)src) << 24;
src += sizeof(u8);
while (count--) {
l2 = *(u32 *)src;
l |= (l2 >> 8);
__raw_writel(l, addr);
l = l2 << 24;
src += sizeof(u32);
} }
break;
} }
} }
......
...@@ -87,6 +87,10 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -87,6 +87,10 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
dev_dbg(dev, "Century bit is enabled\n"); dev_dbg(dev, "Century bit is enabled\n");
tm->tm_year += 100; /* one century */ tm->tm_year += 100; /* one century */
} }
#ifdef CONFIG_SPARC
/* Sun SPARC machines count years since 1968 */
tm->tm_year += 68;
#endif
tm->tm_wday = bcd2bin(val & 0x07); tm->tm_wday = bcd2bin(val & 0x07);
tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F); tm->tm_hour = bcd2bin(M48T59_READ(M48T59_HOUR) & 0x3F);
...@@ -110,11 +114,20 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -110,11 +114,20 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
struct m48t59_private *m48t59 = platform_get_drvdata(pdev); struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
unsigned long flags; unsigned long flags;
u8 val = 0; u8 val = 0;
int year = tm->tm_year;
#ifdef CONFIG_SPARC
/* Sun SPARC machines count years since 1968 */
year -= 68;
#endif
dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n", dev_dbg(dev, "RTC set time %04d-%02d-%02d %02d/%02d/%02d\n",
tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, year + 1900, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec); tm->tm_hour, tm->tm_min, tm->tm_sec);
if (year < 0)
return -EINVAL;
spin_lock_irqsave(&m48t59->lock, flags); spin_lock_irqsave(&m48t59->lock, flags);
/* Issue the WRITE command */ /* Issue the WRITE command */
M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL); M48T59_SET_BITS(M48T59_CNTL_WRITE, M48T59_CNTL);
...@@ -125,9 +138,9 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -125,9 +138,9 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY); M48T59_WRITE((bin2bcd(tm->tm_mday) & 0x3F), M48T59_MDAY);
/* tm_mon is 0-11 */ /* tm_mon is 0-11 */
M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH); M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH);
M48T59_WRITE(bin2bcd(tm->tm_year % 100), M48T59_YEAR); M48T59_WRITE(bin2bcd(year % 100), M48T59_YEAR);
if (pdata->type == M48T59RTC_TYPE_M48T59 && (tm->tm_year / 100)) if (pdata->type == M48T59RTC_TYPE_M48T59 && (year / 100))
val = (M48T59_WDAY_CEB | M48T59_WDAY_CB); val = (M48T59_WDAY_CEB | M48T59_WDAY_CB);
val |= (bin2bcd(tm->tm_wday) & 0x07); val |= (bin2bcd(tm->tm_wday) & 0x07);
M48T59_WRITE(val, M48T59_WDAY); M48T59_WRITE(val, M48T59_WDAY);
...@@ -159,6 +172,10 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -159,6 +172,10 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL); M48T59_SET_BITS(M48T59_CNTL_READ, M48T59_CNTL);
tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR)); tm->tm_year = bcd2bin(M48T59_READ(M48T59_YEAR));
#ifdef CONFIG_SPARC
/* Sun SPARC machines count years since 1968 */
tm->tm_year += 68;
#endif
/* tm_mon is 0-11 */ /* tm_mon is 0-11 */
tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1; tm->tm_mon = bcd2bin(M48T59_READ(M48T59_MONTH)) - 1;
...@@ -192,11 +209,20 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -192,11 +209,20 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
struct rtc_time *tm = &alrm->time; struct rtc_time *tm = &alrm->time;
u8 mday, hour, min, sec; u8 mday, hour, min, sec;
unsigned long flags; unsigned long flags;
int year = tm->tm_year;
#ifdef CONFIG_SPARC
/* Sun SPARC machines count years since 1968 */
year -= 68;
#endif
/* If no irq, we don't support ALARM */ /* If no irq, we don't support ALARM */
if (m48t59->irq == NO_IRQ) if (m48t59->irq == NO_IRQ)
return -EIO; return -EIO;
if (year < 0)
return -EINVAL;
/* /*
* 0xff means "always match" * 0xff means "always match"
*/ */
...@@ -228,7 +254,7 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -228,7 +254,7 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
spin_unlock_irqrestore(&m48t59->lock, flags); spin_unlock_irqrestore(&m48t59->lock, flags);
dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n", dev_dbg(dev, "RTC set alarm time %04d-%02d-%02d %02d/%02d/%02d\n",
tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, year + 1900, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec); tm->tm_hour, tm->tm_min, tm->tm_sec);
return 0; return 0;
} }
......
...@@ -2534,6 +2534,8 @@ static int __devinit snd_dbri_create(struct snd_card *card, ...@@ -2534,6 +2534,8 @@ static int __devinit snd_dbri_create(struct snd_card *card,
dbri->dma = dma_alloc_coherent(&op->dev, dbri->dma = dma_alloc_coherent(&op->dev,
sizeof(struct dbri_dma), sizeof(struct dbri_dma),
&dbri->dma_dvma, GFP_ATOMIC); &dbri->dma_dvma, GFP_ATOMIC);
if (!dbri->dma)
return -ENOMEM;
memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));
dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",
......
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