Commit b7f859dd authored by Michael Ellerman's avatar Michael Ellerman

Merge branch 'next-remove-ldst' of...

Merge branch 'next-remove-ldst' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc into next
parents 428d4d65 0eebf9b5
...@@ -42,12 +42,12 @@ struct dbdma_regs { ...@@ -42,12 +42,12 @@ struct dbdma_regs {
* DBDMA command structure. These fields are all little-endian! * DBDMA command structure. These fields are all little-endian!
*/ */
struct dbdma_cmd { struct dbdma_cmd {
unsigned short req_count; /* requested byte transfer count */ __le16 req_count; /* requested byte transfer count */
unsigned short command; /* command word (has bit-fields) */ __le16 command; /* command word (has bit-fields) */
unsigned int phy_addr; /* physical data address */ __le32 phy_addr; /* physical data address */
unsigned int cmd_dep; /* command-dependent field */ __le32 cmd_dep; /* command-dependent field */
unsigned short res_count; /* residual count after completion */ __le16 res_count; /* residual count after completion */
unsigned short xfer_status; /* transfer status */ __le16 xfer_status; /* transfer status */
}; };
/* DBDMA command values in command field */ /* DBDMA command values in command field */
......
...@@ -585,7 +585,7 @@ struct kvm_vcpu_arch { ...@@ -585,7 +585,7 @@ struct kvm_vcpu_arch {
pgd_t *pgdir; pgd_t *pgdir;
u8 io_gpr; /* GPR used as IO source/target */ u8 io_gpr; /* GPR used as IO source/target */
u8 mmio_is_bigendian; u8 mmio_host_swabbed;
u8 mmio_sign_extend; u8 mmio_sign_extend;
u8 osi_needed; u8 osi_needed;
u8 osi_enabled; u8 osi_enabled;
......
...@@ -9,30 +9,4 @@ ...@@ -9,30 +9,4 @@
#include <uapi/asm/swab.h> #include <uapi/asm/swab.h>
static __inline__ __u16 ld_le16(const volatile __u16 *addr)
{
__u16 val;
__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
return val;
}
static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
{
__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}
static __inline__ __u32 ld_le32(const volatile __u32 *addr)
{
__u32 val;
__asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
return val;
}
static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
{
__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}
#endif /* _ASM_POWERPC_SWAB_H */ #endif /* _ASM_POWERPC_SWAB_H */
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
static inline void scr_writew(u16 val, volatile u16 *addr) static inline void scr_writew(u16 val, volatile u16 *addr)
{ {
st_le16(addr, val); *addr = cpu_to_le16(val);
} }
static inline u16 scr_readw(volatile const u16 *addr) static inline u16 scr_readw(volatile const u16 *addr)
{ {
return ld_le16(addr); return le16_to_cpu(*addr);
} }
#define VT_BUF_HAVE_MEMCPYW #define VT_BUF_HAVE_MEMCPYW
......
...@@ -720,7 +720,7 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu, ...@@ -720,7 +720,7 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
return; return;
} }
if (vcpu->arch.mmio_is_bigendian) { if (!vcpu->arch.mmio_host_swabbed) {
switch (run->mmio.len) { switch (run->mmio.len) {
case 8: gpr = *(u64 *)run->mmio.data; break; case 8: gpr = *(u64 *)run->mmio.data; break;
case 4: gpr = *(u32 *)run->mmio.data; break; case 4: gpr = *(u32 *)run->mmio.data; break;
...@@ -728,10 +728,10 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu, ...@@ -728,10 +728,10 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
case 1: gpr = *(u8 *)run->mmio.data; break; case 1: gpr = *(u8 *)run->mmio.data; break;
} }
} else { } else {
/* Convert BE data from userland back to LE. */
switch (run->mmio.len) { switch (run->mmio.len) {
case 4: gpr = ld_le32((u32 *)run->mmio.data); break; case 8: gpr = swab64(*(u64 *)run->mmio.data); break;
case 2: gpr = ld_le16((u16 *)run->mmio.data); break; case 4: gpr = swab32(*(u32 *)run->mmio.data); break;
case 2: gpr = swab16(*(u16 *)run->mmio.data); break;
case 1: gpr = *(u8 *)run->mmio.data; break; case 1: gpr = *(u8 *)run->mmio.data; break;
} }
} }
...@@ -780,14 +780,13 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -780,14 +780,13 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
int is_default_endian) int is_default_endian)
{ {
int idx, ret; int idx, ret;
int is_bigendian; bool host_swabbed;
/* Pity C doesn't have a logical XOR operator */
if (kvmppc_need_byteswap(vcpu)) { if (kvmppc_need_byteswap(vcpu)) {
/* Default endianness is "little endian". */ host_swabbed = is_default_endian;
is_bigendian = !is_default_endian;
} else { } else {
/* Default endianness is "big endian". */ host_swabbed = !is_default_endian;
is_bigendian = is_default_endian;
} }
if (bytes > sizeof(run->mmio.data)) { if (bytes > sizeof(run->mmio.data)) {
...@@ -800,7 +799,7 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -800,7 +799,7 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
run->mmio.is_write = 0; run->mmio.is_write = 0;
vcpu->arch.io_gpr = rt; vcpu->arch.io_gpr = rt;
vcpu->arch.mmio_is_bigendian = is_bigendian; vcpu->arch.mmio_host_swabbed = host_swabbed;
vcpu->mmio_needed = 1; vcpu->mmio_needed = 1;
vcpu->mmio_is_write = 0; vcpu->mmio_is_write = 0;
vcpu->arch.mmio_sign_extend = 0; vcpu->arch.mmio_sign_extend = 0;
...@@ -840,14 +839,13 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -840,14 +839,13 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
{ {
void *data = run->mmio.data; void *data = run->mmio.data;
int idx, ret; int idx, ret;
int is_bigendian; bool host_swabbed;
/* Pity C doesn't have a logical XOR operator */
if (kvmppc_need_byteswap(vcpu)) { if (kvmppc_need_byteswap(vcpu)) {
/* Default endianness is "little endian". */ host_swabbed = is_default_endian;
is_bigendian = !is_default_endian;
} else { } else {
/* Default endianness is "big endian". */ host_swabbed = !is_default_endian;
is_bigendian = is_default_endian;
} }
if (bytes > sizeof(run->mmio.data)) { if (bytes > sizeof(run->mmio.data)) {
...@@ -862,7 +860,7 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -862,7 +860,7 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
vcpu->mmio_is_write = 1; vcpu->mmio_is_write = 1;
/* Store the value at the lowest bytes in 'data'. */ /* Store the value at the lowest bytes in 'data'. */
if (is_bigendian) { if (!host_swabbed) {
switch (bytes) { switch (bytes) {
case 8: *(u64 *)data = val; break; case 8: *(u64 *)data = val; break;
case 4: *(u32 *)data = val; break; case 4: *(u32 *)data = val; break;
...@@ -870,11 +868,11 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu, ...@@ -870,11 +868,11 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
case 1: *(u8 *)data = val; break; case 1: *(u8 *)data = val; break;
} }
} else { } else {
/* Store LE value into 'data'. */
switch (bytes) { switch (bytes) {
case 4: st_le32(data, val); break; case 8: *(u64 *)data = swab64(val); break;
case 2: st_le16(data, val); break; case 4: *(u32 *)data = swab32(val); break;
case 1: *(u8 *)data = val; break; case 2: *(u16 *)data = swab16(val); break;
case 1: *(u8 *)data = val; break;
} }
} }
......
...@@ -540,9 +540,9 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc) ...@@ -540,9 +540,9 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)
BUG_ON (pi++ >= MAX_DCMDS); BUG_ON (pi++ >= MAX_DCMDS);
len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG; len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
st_le16(&table->command, write ? OUTPUT_MORE: INPUT_MORE); table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
st_le16(&table->req_count, len); table->req_count = cpu_to_le16(len);
st_le32(&table->phy_addr, addr); table->phy_addr = cpu_to_le32(addr);
table->cmd_dep = 0; table->cmd_dep = 0;
table->xfer_status = 0; table->xfer_status = 0;
table->res_count = 0; table->res_count = 0;
...@@ -557,12 +557,12 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc) ...@@ -557,12 +557,12 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)
/* Convert the last command to an input/output */ /* Convert the last command to an input/output */
table--; table--;
st_le16(&table->command, write ? OUTPUT_LAST: INPUT_LAST); table->command = cpu_to_le16(write ? OUTPUT_LAST: INPUT_LAST);
table++; table++;
/* Add the stop command to the end of the list */ /* Add the stop command to the end of the list */
memset(table, 0, sizeof(struct dbdma_cmd)); memset(table, 0, sizeof(struct dbdma_cmd));
st_le16(&table->command, DBDMA_STOP); table->command = cpu_to_le16(DBDMA_STOP);
dev_dbgdma(priv->dev, "%s: %d DMA list entries\n", __func__, pi); dev_dbgdma(priv->dev, "%s: %d DMA list entries\n", __func__, pi);
} }
......
...@@ -440,9 +440,9 @@ static inline void seek_track(struct floppy_state *fs, int n) ...@@ -440,9 +440,9 @@ static inline void seek_track(struct floppy_state *fs, int n)
static inline void init_dma(struct dbdma_cmd *cp, int cmd, static inline void init_dma(struct dbdma_cmd *cp, int cmd,
void *buf, int count) void *buf, int count)
{ {
st_le16(&cp->req_count, count); cp->req_count = cpu_to_le16(count);
st_le16(&cp->command, cmd); cp->command = cpu_to_le16(cmd);
st_le32(&cp->phy_addr, virt_to_bus(buf)); cp->phy_addr = cpu_to_le32(virt_to_bus(buf));
cp->xfer_status = 0; cp->xfer_status = 0;
} }
...@@ -771,8 +771,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) ...@@ -771,8 +771,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id)
} }
/* turn off DMA */ /* turn off DMA */
out_le32(&dr->control, (RUN | PAUSE) << 16); out_le32(&dr->control, (RUN | PAUSE) << 16);
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
resid = ld_le16(&cp->res_count); resid = le16_to_cpu(cp->res_count);
if (intr & ERROR_INTR) { if (intr & ERROR_INTR) {
n = fs->scount - 1 - resid / 512; n = fs->scount - 1 - resid / 512;
if (n > 0) { if (n > 0) {
...@@ -1170,7 +1170,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index) ...@@ -1170,7 +1170,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index)
fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space);
memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd));
st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); fs->dma_cmd[1].command = cpu_to_le16(DBDMA_STOP);
if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD) if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD)
swim3_mb_event(mdev, MB_FD); swim3_mb_event(mdev, MB_FD);
......
...@@ -1497,9 +1497,9 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -1497,9 +1497,9 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
drive->name); drive->name);
return 0; return 0;
} }
st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE); table->command = cpu_to_le16(wr? OUTPUT_MORE: INPUT_MORE);
st_le16(&table->req_count, tc); table->req_count = cpu_to_le16(tc);
st_le32(&table->phy_addr, cur_addr); table->phy_addr = cpu_to_le32(cur_addr);
table->cmd_dep = 0; table->cmd_dep = 0;
table->xfer_status = 0; table->xfer_status = 0;
table->res_count = 0; table->res_count = 0;
...@@ -1513,10 +1513,10 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) ...@@ -1513,10 +1513,10 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
/* convert the last command to an input/output last command */ /* convert the last command to an input/output last command */
if (count) { if (count) {
st_le16(&table[-1].command, wr? OUTPUT_LAST: INPUT_LAST); table[-1].command = cpu_to_le16(wr? OUTPUT_LAST: INPUT_LAST);
/* add the stop command to the end of the list */ /* add the stop command to the end of the list */
memset(table, 0, sizeof(struct dbdma_cmd)); memset(table, 0, sizeof(struct dbdma_cmd));
st_le16(&table->command, DBDMA_STOP); table->command = cpu_to_le16(DBDMA_STOP);
mb(); mb();
writel(hwif->dmatable_dma, &dma->cmdptr); writel(hwif->dmatable_dma, &dma->cmdptr);
return 1; return 1;
......
...@@ -182,31 +182,31 @@ static void rackmeter_setup_dbdma(struct rackmeter *rm) ...@@ -182,31 +182,31 @@ static void rackmeter_setup_dbdma(struct rackmeter *rm)
/* Prepare 4 dbdma commands for the 2 buffers */ /* Prepare 4 dbdma commands for the 2 buffers */
memset(cmd, 0, 4 * sizeof(struct dbdma_cmd)); memset(cmd, 0, 4 * sizeof(struct dbdma_cmd));
st_le16(&cmd->req_count, 4); cmd->req_count = cpu_to_le16(4);
st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM); cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
st_le32(&cmd->phy_addr, rm->dma_buf_p + cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, mark)); offsetof(struct rackmeter_dma, mark));
st_le32(&cmd->cmd_dep, 0x02000000); cmd->cmd_dep = cpu_to_le32(0x02000000);
cmd++; cmd++;
st_le16(&cmd->req_count, SAMPLE_COUNT * 4); cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
st_le16(&cmd->command, OUTPUT_MORE); cmd->command = cpu_to_le16(OUTPUT_MORE);
st_le32(&cmd->phy_addr, rm->dma_buf_p + cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, buf1)); offsetof(struct rackmeter_dma, buf1));
cmd++; cmd++;
st_le16(&cmd->req_count, 4); cmd->req_count = cpu_to_le16(4);
st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM); cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
st_le32(&cmd->phy_addr, rm->dma_buf_p + cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, mark)); offsetof(struct rackmeter_dma, mark));
st_le32(&cmd->cmd_dep, 0x01000000); cmd->cmd_dep = cpu_to_le32(0x01000000);
cmd++; cmd++;
st_le16(&cmd->req_count, SAMPLE_COUNT * 4); cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
st_le16(&cmd->command, OUTPUT_MORE | BR_ALWAYS); cmd->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS);
st_le32(&cmd->phy_addr, rm->dma_buf_p + cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, buf2)); offsetof(struct rackmeter_dma, buf2));
st_le32(&cmd->cmd_dep, rm->dma_buf_p); cmd->cmd_dep = cpu_to_le32(rm->dma_buf_p);
rackmeter_do_pause(rm, 0); rackmeter_do_pause(rm, 0);
} }
......
...@@ -416,9 +416,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) ...@@ -416,9 +416,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
int result = 0; int result = 0;
unsigned char lat; unsigned char lat;
struct bt878 *bt; struct bt878 *bt;
#if defined(__powerpc__)
unsigned int cmd;
#endif
unsigned int cardid; unsigned int cardid;
printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n", printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
...@@ -461,15 +458,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) ...@@ -461,15 +458,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
printk("irq: %d, latency: %d, memory: 0x%lx\n", printk("irq: %d, latency: %d, memory: 0x%lx\n",
bt->irq, lat, bt->bt878_adr); bt->irq, lat, bt->bt878_adr);
#if defined(__powerpc__)
/* on OpenFirmware machines (PowerMac at least), PCI memory cycle */
/* response on cards with no firmware is not enabled by OF */
pci_read_config_dword(dev, PCI_COMMAND, &cmd);
cmd = (cmd | PCI_COMMAND_MEMORY);
pci_write_config_dword(dev, PCI_COMMAND, cmd);
#endif
#ifdef __sparc__ #ifdef __sparc__
bt->bt878_mem = (unsigned char *) bt->bt878_adr; bt->bt878_mem = (unsigned char *) bt->bt878_adr;
#else #else
......
...@@ -142,18 +142,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin, ...@@ -142,18 +142,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin,
u32 irq_err_ignore); u32 irq_err_ignore);
void bt878_stop(struct bt878 *bt); void bt878_stop(struct bt878 *bt);
#if defined(__powerpc__) /* big-endian */
static inline void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
{
st_le32(addr, val);
eieio();
}
#define bmtwrite(dat,adr) io_st_le32((adr),(dat))
#define bmtread(adr) ld_le32((adr))
#else
#define bmtwrite(dat,adr) writel((dat), (adr)) #define bmtwrite(dat,adr) writel((dat), (adr))
#define bmtread(adr) readl(adr) #define bmtread(adr) readl(adr)
#endif
#endif #endif
...@@ -281,7 +281,7 @@ static inline void buffer_swap32(u32 *buf, int len) ...@@ -281,7 +281,7 @@ static inline void buffer_swap32(u32 *buf, int len)
int i; int i;
for (i = 0; i < ((len + 3) / 4); i++) { for (i = 0; i < ((len + 3) / 4); i++) {
st_le32(buf, *buf); *buf = swab32(*buf);
buf++; buf++;
} }
} }
......
...@@ -483,8 +483,8 @@ static int bmac_suspend(struct macio_dev *mdev, pm_message_t state) ...@@ -483,8 +483,8 @@ static int bmac_suspend(struct macio_dev *mdev, pm_message_t state)
bmwrite(dev, TXCFG, (config & ~TxMACEnable)); bmwrite(dev, TXCFG, (config & ~TxMACEnable));
bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */ bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */
/* disable rx and tx dma */ /* disable rx and tx dma */
st_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
st_le32(&td->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
/* free some skb's */ /* free some skb's */
for (i=0; i<N_RX_RING; i++) { for (i=0; i<N_RX_RING; i++) {
if (bp->rx_bufs[i] != NULL) { if (bp->rx_bufs[i] != NULL) {
...@@ -699,8 +699,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id) ...@@ -699,8 +699,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
while (1) { while (1) {
cp = &bp->rx_cmds[i]; cp = &bp->rx_cmds[i];
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
residual = ld_le16(&cp->res_count); residual = le16_to_cpu(cp->res_count);
if ((stat & ACTIVE) == 0) if ((stat & ACTIVE) == 0)
break; break;
nb = RX_BUFLEN - residual - 2; nb = RX_BUFLEN - residual - 2;
...@@ -728,8 +728,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id) ...@@ -728,8 +728,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
skb_reserve(bp->rx_bufs[i], 2); skb_reserve(bp->rx_bufs[i], 2);
} }
bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); bmac_construct_rxbuff(skb, &bp->rx_cmds[i]);
st_le16(&cp->res_count, 0); cp->res_count = cpu_to_le16(0);
st_le16(&cp->xfer_status, 0); cp->xfer_status = cpu_to_le16(0);
last = i; last = i;
if (++i >= N_RX_RING) i = 0; if (++i >= N_RX_RING) i = 0;
} }
...@@ -769,7 +769,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id) ...@@ -769,7 +769,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id)
while (1) { while (1) {
cp = &bp->tx_cmds[bp->tx_empty]; cp = &bp->tx_cmds[bp->tx_empty];
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
if (txintcount < 10) { if (txintcount < 10) {
XXDEBUG(("bmac_txdma_xfer_stat=%#0x\n", stat)); XXDEBUG(("bmac_txdma_xfer_stat=%#0x\n", stat));
} }
...@@ -1411,8 +1411,8 @@ static int bmac_close(struct net_device *dev) ...@@ -1411,8 +1411,8 @@ static int bmac_close(struct net_device *dev)
bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */ bmwrite(dev, INTDISABLE, DisableAll); /* disable all intrs */
/* disable rx and tx dma */ /* disable rx and tx dma */
st_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
st_le32(&td->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */
/* free some skb's */ /* free some skb's */
XXDEBUG(("bmac: free rx bufs\n")); XXDEBUG(("bmac: free rx bufs\n"));
...@@ -1493,7 +1493,7 @@ static void bmac_tx_timeout(unsigned long data) ...@@ -1493,7 +1493,7 @@ static void bmac_tx_timeout(unsigned long data)
cp = &bp->tx_cmds[bp->tx_empty]; cp = &bp->tx_cmds[bp->tx_empty];
/* XXDEBUG((KERN_DEBUG "bmac: tx dmastat=%x %x runt=%d pr=%x fs=%x fc=%x\n", */ /* XXDEBUG((KERN_DEBUG "bmac: tx dmastat=%x %x runt=%d pr=%x fs=%x fc=%x\n", */
/* ld_le32(&td->status), ld_le16(&cp->xfer_status), bp->tx_bad_runt, */ /* le32_to_cpu(td->status), le16_to_cpu(cp->xfer_status), bp->tx_bad_runt, */
/* mb->pr, mb->xmtfs, mb->fifofc)); */ /* mb->pr, mb->xmtfs, mb->fifofc)); */
/* turn off both tx and rx and reset the chip */ /* turn off both tx and rx and reset the chip */
...@@ -1506,7 +1506,7 @@ static void bmac_tx_timeout(unsigned long data) ...@@ -1506,7 +1506,7 @@ static void bmac_tx_timeout(unsigned long data)
bmac_enable_and_reset_chip(dev); bmac_enable_and_reset_chip(dev);
/* restart rx dma */ /* restart rx dma */
cp = bus_to_virt(ld_le32(&rd->cmdptr)); cp = bus_to_virt(le32_to_cpu(rd->cmdptr));
out_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD)); out_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD));
out_le16(&cp->xfer_status, 0); out_le16(&cp->xfer_status, 0);
out_le32(&rd->cmdptr, virt_to_bus(cp)); out_le32(&rd->cmdptr, virt_to_bus(cp));
...@@ -1553,10 +1553,10 @@ static void dump_dbdma(volatile struct dbdma_cmd *cp,int count) ...@@ -1553,10 +1553,10 @@ static void dump_dbdma(volatile struct dbdma_cmd *cp,int count)
ip = (int*)(cp+i); ip = (int*)(cp+i);
printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n", printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n",
ld_le32(ip+0), le32_to_cpup(ip+0),
ld_le32(ip+1), le32_to_cpup(ip+1),
ld_le32(ip+2), le32_to_cpup(ip+2),
ld_le32(ip+3)); le32_to_cpup(ip+3));
} }
} }
......
...@@ -310,7 +310,7 @@ static void dbdma_reset(volatile struct dbdma_regs __iomem *dma) ...@@ -310,7 +310,7 @@ static void dbdma_reset(volatile struct dbdma_regs __iomem *dma)
* way on some machines. * way on some machines.
*/ */
for (i = 200; i > 0; --i) for (i = 200; i > 0; --i)
if (ld_le32(&dma->control) & RUN) if (le32_to_cpu(dma->control) & RUN)
udelay(1); udelay(1);
} }
...@@ -452,21 +452,21 @@ static int mace_open(struct net_device *dev) ...@@ -452,21 +452,21 @@ static int mace_open(struct net_device *dev)
data = skb->data; data = skb->data;
} }
mp->rx_bufs[i] = skb; mp->rx_bufs[i] = skb;
st_le16(&cp->req_count, RX_BUFLEN); cp->req_count = cpu_to_le16(RX_BUFLEN);
st_le16(&cp->command, INPUT_LAST + INTR_ALWAYS); cp->command = cpu_to_le16(INPUT_LAST + INTR_ALWAYS);
st_le32(&cp->phy_addr, virt_to_bus(data)); cp->phy_addr = cpu_to_le32(virt_to_bus(data));
cp->xfer_status = 0; cp->xfer_status = 0;
++cp; ++cp;
} }
mp->rx_bufs[i] = NULL; mp->rx_bufs[i] = NULL;
st_le16(&cp->command, DBDMA_STOP); cp->command = cpu_to_le16(DBDMA_STOP);
mp->rx_fill = i; mp->rx_fill = i;
mp->rx_empty = 0; mp->rx_empty = 0;
/* Put a branch back to the beginning of the receive command list */ /* Put a branch back to the beginning of the receive command list */
++cp; ++cp;
st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS);
st_le32(&cp->cmd_dep, virt_to_bus(mp->rx_cmds)); cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->rx_cmds));
/* start rx dma */ /* start rx dma */
out_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ out_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
...@@ -475,8 +475,8 @@ static int mace_open(struct net_device *dev) ...@@ -475,8 +475,8 @@ static int mace_open(struct net_device *dev)
/* put a branch at the end of the tx command list */ /* put a branch at the end of the tx command list */
cp = mp->tx_cmds + NCMDS_TX * N_TX_RING; cp = mp->tx_cmds + NCMDS_TX * N_TX_RING;
st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS);
st_le32(&cp->cmd_dep, virt_to_bus(mp->tx_cmds)); cp->cmd_dep = cpu_to_le32(virt_to_bus(mp->tx_cmds));
/* reset tx dma */ /* reset tx dma */
out_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16); out_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
...@@ -507,8 +507,8 @@ static int mace_close(struct net_device *dev) ...@@ -507,8 +507,8 @@ static int mace_close(struct net_device *dev)
out_8(&mb->imr, 0xff); /* disable all intrs */ out_8(&mb->imr, 0xff); /* disable all intrs */
/* disable rx and tx dma */ /* disable rx and tx dma */
st_le32(&rd->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ rd->control = cpu_to_le32((RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
st_le32(&td->control, (RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */ td->control = cpu_to_le32((RUN|PAUSE|FLUSH|WAKE) << 16); /* clear run bit */
mace_clean_rings(mp); mace_clean_rings(mp);
...@@ -558,8 +558,8 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) ...@@ -558,8 +558,8 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev)
} }
mp->tx_bufs[fill] = skb; mp->tx_bufs[fill] = skb;
cp = mp->tx_cmds + NCMDS_TX * fill; cp = mp->tx_cmds + NCMDS_TX * fill;
st_le16(&cp->req_count, len); cp->req_count = cpu_to_le16(len);
st_le32(&cp->phy_addr, virt_to_bus(skb->data)); cp->phy_addr = cpu_to_le32(virt_to_bus(skb->data));
np = mp->tx_cmds + NCMDS_TX * next; np = mp->tx_cmds + NCMDS_TX * next;
out_le16(&np->command, DBDMA_STOP); out_le16(&np->command, DBDMA_STOP);
...@@ -691,7 +691,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) ...@@ -691,7 +691,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
out_8(&mb->xmtfc, AUTO_PAD_XMIT); out_8(&mb->xmtfc, AUTO_PAD_XMIT);
continue; continue;
} }
dstat = ld_le32(&td->status); dstat = le32_to_cpu(td->status);
/* stop DMA controller */ /* stop DMA controller */
out_le32(&td->control, RUN << 16); out_le32(&td->control, RUN << 16);
/* /*
...@@ -724,7 +724,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) ...@@ -724,7 +724,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
*/ */
} }
cp = mp->tx_cmds + NCMDS_TX * i; cp = mp->tx_cmds + NCMDS_TX * i;
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
if ((fs & (UFLO|LCOL|LCAR|RTRY)) || (dstat & DEAD) || xcount == 0) { if ((fs & (UFLO|LCOL|LCAR|RTRY)) || (dstat & DEAD) || xcount == 0) {
/* /*
* Check whether there were in fact 2 bytes written to * Check whether there were in fact 2 bytes written to
...@@ -830,7 +830,7 @@ static void mace_tx_timeout(unsigned long data) ...@@ -830,7 +830,7 @@ static void mace_tx_timeout(unsigned long data)
mace_reset(dev); mace_reset(dev);
/* restart rx dma */ /* restart rx dma */
cp = bus_to_virt(ld_le32(&rd->cmdptr)); cp = bus_to_virt(le32_to_cpu(rd->cmdptr));
dbdma_reset(rd); dbdma_reset(rd);
out_le16(&cp->xfer_status, 0); out_le16(&cp->xfer_status, 0);
out_le32(&rd->cmdptr, virt_to_bus(cp)); out_le32(&rd->cmdptr, virt_to_bus(cp));
...@@ -889,20 +889,20 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id) ...@@ -889,20 +889,20 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
spin_lock_irqsave(&mp->lock, flags); spin_lock_irqsave(&mp->lock, flags);
for (i = mp->rx_empty; i != mp->rx_fill; ) { for (i = mp->rx_empty; i != mp->rx_fill; ) {
cp = mp->rx_cmds + i; cp = mp->rx_cmds + i;
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
if ((stat & ACTIVE) == 0) { if ((stat & ACTIVE) == 0) {
next = i + 1; next = i + 1;
if (next >= N_RX_RING) if (next >= N_RX_RING)
next = 0; next = 0;
np = mp->rx_cmds + next; np = mp->rx_cmds + next;
if (next != mp->rx_fill && if (next != mp->rx_fill &&
(ld_le16(&np->xfer_status) & ACTIVE) != 0) { (le16_to_cpu(np->xfer_status) & ACTIVE) != 0) {
printk(KERN_DEBUG "mace: lost a status word\n"); printk(KERN_DEBUG "mace: lost a status word\n");
++mace_lost_status; ++mace_lost_status;
} else } else
break; break;
} }
nb = ld_le16(&cp->req_count) - ld_le16(&cp->res_count); nb = le16_to_cpu(cp->req_count) - le16_to_cpu(cp->res_count);
out_le16(&cp->command, DBDMA_STOP); out_le16(&cp->command, DBDMA_STOP);
/* got a packet, have a look at it */ /* got a packet, have a look at it */
skb = mp->rx_bufs[i]; skb = mp->rx_bufs[i];
...@@ -962,13 +962,13 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id) ...@@ -962,13 +962,13 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id)
mp->rx_bufs[i] = skb; mp->rx_bufs[i] = skb;
} }
} }
st_le16(&cp->req_count, RX_BUFLEN); cp->req_count = cpu_to_le16(RX_BUFLEN);
data = skb? skb->data: dummy_buf; data = skb? skb->data: dummy_buf;
st_le32(&cp->phy_addr, virt_to_bus(data)); cp->phy_addr = cpu_to_le32(virt_to_bus(data));
out_le16(&cp->xfer_status, 0); out_le16(&cp->xfer_status, 0);
out_le16(&cp->command, INPUT_LAST + INTR_ALWAYS); out_le16(&cp->command, INPUT_LAST + INTR_ALWAYS);
#if 0 #if 0
if ((ld_le32(&rd->status) & ACTIVE) != 0) { if ((le32_to_cpu(rd->status) & ACTIVE) != 0) {
out_le32(&rd->control, (PAUSE << 16) | PAUSE); out_le32(&rd->control, (PAUSE << 16) | PAUSE);
while ((in_le32(&rd->status) & ACTIVE) != 0) while ((in_le32(&rd->status) & ACTIVE) != 0)
; ;
......
...@@ -382,16 +382,16 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd) ...@@ -382,16 +382,16 @@ static void set_dma_cmds(struct fsc_state *state, struct scsi_cmnd *cmd)
if (dma_len > 0xffff) if (dma_len > 0xffff)
panic("mac53c94: scatterlist element >= 64k"); panic("mac53c94: scatterlist element >= 64k");
total += dma_len; total += dma_len;
st_le16(&dcmds->req_count, dma_len); dcmds->req_count = cpu_to_le16(dma_len);
st_le16(&dcmds->command, dma_cmd); dcmds->command = cpu_to_le16(dma_cmd);
st_le32(&dcmds->phy_addr, dma_addr); dcmds->phy_addr = cpu_to_le32(dma_addr);
dcmds->xfer_status = 0; dcmds->xfer_status = 0;
++dcmds; ++dcmds;
} }
dma_cmd += OUTPUT_LAST - OUTPUT_MORE; dma_cmd += OUTPUT_LAST - OUTPUT_MORE;
st_le16(&dcmds[-1].command, dma_cmd); dcmds[-1].command = cpu_to_le16(dma_cmd);
st_le16(&dcmds->command, DBDMA_STOP); dcmds->command = cpu_to_le16(DBDMA_STOP);
cmd->SCp.this_residual = total; cmd->SCp.this_residual = total;
} }
......
...@@ -1287,9 +1287,9 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd) ...@@ -1287,9 +1287,9 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
} }
if (dma_len > 0xffff) if (dma_len > 0xffff)
panic("mesh: scatterlist element >= 64k"); panic("mesh: scatterlist element >= 64k");
st_le16(&dcmds->req_count, dma_len - off); dcmds->req_count = cpu_to_le16(dma_len - off);
st_le16(&dcmds->command, dma_cmd); dcmds->command = cpu_to_le16(dma_cmd);
st_le32(&dcmds->phy_addr, dma_addr + off); dcmds->phy_addr = cpu_to_le32(dma_addr + off);
dcmds->xfer_status = 0; dcmds->xfer_status = 0;
++dcmds; ++dcmds;
dtot += dma_len - off; dtot += dma_len - off;
...@@ -1303,15 +1303,15 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd) ...@@ -1303,15 +1303,15 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
static char mesh_extra_buf[64]; static char mesh_extra_buf[64];
dtot = sizeof(mesh_extra_buf); dtot = sizeof(mesh_extra_buf);
st_le16(&dcmds->req_count, dtot); dcmds->req_count = cpu_to_le16(dtot);
st_le32(&dcmds->phy_addr, virt_to_phys(mesh_extra_buf)); dcmds->phy_addr = cpu_to_le32(virt_to_phys(mesh_extra_buf));
dcmds->xfer_status = 0; dcmds->xfer_status = 0;
++dcmds; ++dcmds;
} }
dma_cmd += OUTPUT_LAST - OUTPUT_MORE; dma_cmd += OUTPUT_LAST - OUTPUT_MORE;
st_le16(&dcmds[-1].command, dma_cmd); dcmds[-1].command = cpu_to_le16(dma_cmd);
memset(dcmds, 0, sizeof(*dcmds)); memset(dcmds, 0, sizeof(*dcmds));
st_le16(&dcmds->command, DBDMA_STOP); dcmds->command = cpu_to_le16(DBDMA_STOP);
ms->dma_count = dtot; ms->dma_count = dtot;
} }
......
...@@ -315,7 +315,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info) ...@@ -315,7 +315,7 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
container_of(info, struct fb_info_control, info); container_of(info, struct fb_info_control, info);
unsigned ctrl; unsigned ctrl;
ctrl = ld_le32(CNTRL_REG(p,ctrl)); ctrl = le32_to_cpup(CNTRL_REG(p,ctrl));
if (blank_mode > 0) if (blank_mode > 0)
switch (blank_mode) { switch (blank_mode) {
case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_VSYNC_SUSPEND:
......
...@@ -168,7 +168,7 @@ static int platinumfb_blank(int blank, struct fb_info *fb) ...@@ -168,7 +168,7 @@ static int platinumfb_blank(int blank, struct fb_info *fb)
struct fb_info_platinum *info = (struct fb_info_platinum *) fb; struct fb_info_platinum *info = (struct fb_info_platinum *) fb;
int ctrl; int ctrl;
ctrl = ld_le32(&info->platinum_regs->ctrl.r) | 0x33; ctrl = le32_to_cpup(&info->platinum_regs->ctrl.r) | 0x33;
if (blank) if (blank)
--blank_mode; --blank_mode;
if (blank & VESA_VSYNC_SUSPEND) if (blank & VESA_VSYNC_SUSPEND)
......
...@@ -240,7 +240,7 @@ static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, ...@@ -240,7 +240,7 @@ static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec,
*/ */
spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock);
snd_pmac_dma_stop(rec); snd_pmac_dma_stop(rec);
st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP);
snd_pmac_dma_set_command(rec, &chip->extra_dma); snd_pmac_dma_set_command(rec, &chip->extra_dma);
snd_pmac_dma_run(rec, RUN); snd_pmac_dma_run(rec, RUN);
spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock);
...@@ -251,15 +251,15 @@ static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, ...@@ -251,15 +251,15 @@ static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec,
*/ */
offset = runtime->dma_addr; offset = runtime->dma_addr;
for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) { for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) {
st_le32(&cp->phy_addr, offset); cp->phy_addr = cpu_to_le32(offset);
st_le16(&cp->req_count, rec->period_size); cp->req_count = cpu_to_le16(rec->period_size);
/*st_le16(&cp->res_count, 0);*/ /*cp->res_count = cpu_to_le16(0);*/
st_le16(&cp->xfer_status, 0); cp->xfer_status = cpu_to_le16(0);
offset += rec->period_size; offset += rec->period_size;
} }
/* make loop */ /* make loop */
st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS);
st_le32(&cp->cmd_dep, rec->cmd.addr); cp->cmd_dep = cpu_to_le32(rec->cmd.addr);
snd_pmac_dma_stop(rec); snd_pmac_dma_stop(rec);
snd_pmac_dma_set_command(rec, &rec->cmd); snd_pmac_dma_set_command(rec, &rec->cmd);
...@@ -328,7 +328,7 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, ...@@ -328,7 +328,7 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip,
#if 1 /* hmm.. how can we get the current dma pointer?? */ #if 1 /* hmm.. how can we get the current dma pointer?? */
int stat; int stat;
volatile struct dbdma_cmd __iomem *cp = &rec->cmd.cmds[rec->cur_period]; volatile struct dbdma_cmd __iomem *cp = &rec->cmd.cmds[rec->cur_period];
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
if (stat & (ACTIVE|DEAD)) { if (stat & (ACTIVE|DEAD)) {
count = in_le16(&cp->res_count); count = in_le16(&cp->res_count);
if (count) if (count)
...@@ -427,26 +427,26 @@ static inline void snd_pmac_pcm_dead_xfer(struct pmac_stream *rec, ...@@ -427,26 +427,26 @@ static inline void snd_pmac_pcm_dead_xfer(struct pmac_stream *rec,
memcpy((void *)emergency_dbdma.cmds, (void *)cp, memcpy((void *)emergency_dbdma.cmds, (void *)cp,
sizeof(struct dbdma_cmd)); sizeof(struct dbdma_cmd));
emergency_in_use = 1; emergency_in_use = 1;
st_le16(&cp->xfer_status, 0); cp->xfer_status = cpu_to_le16(0);
st_le16(&cp->req_count, rec->period_size); cp->req_count = cpu_to_le16(rec->period_size);
cp = emergency_dbdma.cmds; cp = emergency_dbdma.cmds;
} }
/* now bump the values to reflect the amount /* now bump the values to reflect the amount
we haven't yet shifted */ we haven't yet shifted */
req = ld_le16(&cp->req_count); req = le16_to_cpu(cp->req_count);
res = ld_le16(&cp->res_count); res = le16_to_cpu(cp->res_count);
phy = ld_le32(&cp->phy_addr); phy = le32_to_cpu(cp->phy_addr);
phy += (req - res); phy += (req - res);
st_le16(&cp->req_count, res); cp->req_count = cpu_to_le16(res);
st_le16(&cp->res_count, 0); cp->res_count = cpu_to_le16(0);
st_le16(&cp->xfer_status, 0); cp->xfer_status = cpu_to_le16(0);
st_le32(&cp->phy_addr, phy); cp->phy_addr = cpu_to_le32(phy);
st_le32(&cp->cmd_dep, rec->cmd.addr cp->cmd_dep = cpu_to_le32(rec->cmd.addr
+ sizeof(struct dbdma_cmd)*((rec->cur_period+1)%rec->nperiods)); + sizeof(struct dbdma_cmd)*((rec->cur_period+1)%rec->nperiods));
st_le16(&cp->command, OUTPUT_MORE | BR_ALWAYS | INTR_ALWAYS); cp->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS | INTR_ALWAYS);
/* point at our patched up command block */ /* point at our patched up command block */
out_le32(&rec->dma->cmdptr, emergency_dbdma.addr); out_le32(&rec->dma->cmdptr, emergency_dbdma.addr);
...@@ -475,7 +475,7 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) ...@@ -475,7 +475,7 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec)
else else
cp = &rec->cmd.cmds[rec->cur_period]; cp = &rec->cmd.cmds[rec->cur_period];
stat = ld_le16(&cp->xfer_status); stat = le16_to_cpu(cp->xfer_status);
if (stat & DEAD) { if (stat & DEAD) {
snd_pmac_pcm_dead_xfer(rec, cp); snd_pmac_pcm_dead_xfer(rec, cp);
...@@ -489,9 +489,9 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) ...@@ -489,9 +489,9 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec)
break; break;
/*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/ /*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/
st_le16(&cp->xfer_status, 0); cp->xfer_status = cpu_to_le16(0);
st_le16(&cp->req_count, rec->period_size); cp->req_count = cpu_to_le16(rec->period_size);
/*st_le16(&cp->res_count, 0);*/ /*cp->res_count = cpu_to_le16(0);*/
rec->cur_period++; rec->cur_period++;
if (rec->cur_period >= rec->nperiods) { if (rec->cur_period >= rec->nperiods) {
rec->cur_period = 0; rec->cur_period = 0;
...@@ -760,11 +760,11 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add ...@@ -760,11 +760,11 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add
struct pmac_stream *rec = &chip->playback; struct pmac_stream *rec = &chip->playback;
snd_pmac_dma_stop(rec); snd_pmac_dma_stop(rec);
st_le16(&chip->extra_dma.cmds->req_count, bytes); chip->extra_dma.cmds->req_count = cpu_to_le16(bytes);
st_le16(&chip->extra_dma.cmds->xfer_status, 0); chip->extra_dma.cmds->xfer_status = cpu_to_le16(0);
st_le32(&chip->extra_dma.cmds->cmd_dep, chip->extra_dma.addr); chip->extra_dma.cmds->cmd_dep = cpu_to_le32(chip->extra_dma.addr);
st_le32(&chip->extra_dma.cmds->phy_addr, addr); chip->extra_dma.cmds->phy_addr = cpu_to_le32(addr);
st_le16(&chip->extra_dma.cmds->command, OUTPUT_MORE + BR_ALWAYS); chip->extra_dma.cmds->command = cpu_to_le16(OUTPUT_MORE + BR_ALWAYS);
out_le32(&chip->awacs->control, out_le32(&chip->awacs->control,
(in_le32(&chip->awacs->control) & ~0x1f00) (in_le32(&chip->awacs->control) & ~0x1f00)
| (speed << 8)); | (speed << 8));
...@@ -776,7 +776,7 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add ...@@ -776,7 +776,7 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add
void snd_pmac_beep_dma_stop(struct snd_pmac *chip) void snd_pmac_beep_dma_stop(struct snd_pmac *chip)
{ {
snd_pmac_dma_stop(&chip->playback); snd_pmac_dma_stop(&chip->playback);
st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP);
snd_pmac_pcm_set_format(chip); /* reset format */ snd_pmac_pcm_set_format(chip); /* reset format */
} }
......
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