diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2015-02-03 00:36:21 -0500 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-22 23:29:40 -0400 |
| commit | f5718726714cd6114876c4e3ca9b6992ab81176c (patch) | |
| tree | c8cfe34ac28b22e89e8f5aac01c615ac61fbb221 /sound/ppc | |
| parent | 9eccca0843205f87c00404b663188b88eb248051 (diff) | |
powerpc: Move Power Macintosh drivers to generic byteswappers
ppc has special instruction forms to efficiently load and store values
in non-native endianness. These can be accessed via the arch-specific
{ld,st}_le{16,32}() inlines in arch/powerpc/include/asm/swab.h.
However, gcc is perfectly capable of generating the byte-reversing
load/store instructions when using the normal, generic cpu_to_le*() and
le*_to_cpu() functions eaning the arch-specific functions don't have much
point.
Worse the "le" in the names of the arch specific functions is now
misleading, because they always generate byte-reversing forms, but some
ppc machines can now run a little-endian kernel.
To start getting rid of the arch-specific forms, this patch removes them
from all the old Power Macintosh drivers, replacing them with the
generic byteswappers.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'sound/ppc')
| -rw-r--r-- | sound/ppc/pmac.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 13146d701413..0095a80a997f 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
| @@ -240,7 +240,7 @@ static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, | |||
| 240 | */ | 240 | */ |
| 241 | spin_lock_irq(&chip->reg_lock); | 241 | spin_lock_irq(&chip->reg_lock); |
| 242 | snd_pmac_dma_stop(rec); | 242 | snd_pmac_dma_stop(rec); |
| 243 | st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); | 243 | chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); |
| 244 | snd_pmac_dma_set_command(rec, &chip->extra_dma); | 244 | snd_pmac_dma_set_command(rec, &chip->extra_dma); |
| 245 | snd_pmac_dma_run(rec, RUN); | 245 | snd_pmac_dma_run(rec, RUN); |
| 246 | spin_unlock_irq(&chip->reg_lock); | 246 | 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 | */ | 251 | */ |
| 252 | offset = runtime->dma_addr; | 252 | offset = runtime->dma_addr; |
| 253 | for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) { | 253 | for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++) { |
| 254 | st_le32(&cp->phy_addr, offset); | 254 | cp->phy_addr = cpu_to_le32(offset); |
| 255 | st_le16(&cp->req_count, rec->period_size); | 255 | cp->req_count = cpu_to_le16(rec->period_size); |
| 256 | /*st_le16(&cp->res_count, 0);*/ | 256 | /*cp->res_count = cpu_to_le16(0);*/ |
| 257 | st_le16(&cp->xfer_status, 0); | 257 | cp->xfer_status = cpu_to_le16(0); |
| 258 | offset += rec->period_size; | 258 | offset += rec->period_size; |
| 259 | } | 259 | } |
| 260 | /* make loop */ | 260 | /* make loop */ |
| 261 | st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS); | 261 | cp->command = cpu_to_le16(DBDMA_NOP + BR_ALWAYS); |
| 262 | st_le32(&cp->cmd_dep, rec->cmd.addr); | 262 | cp->cmd_dep = cpu_to_le32(rec->cmd.addr); |
| 263 | 263 | ||
| 264 | snd_pmac_dma_stop(rec); | 264 | snd_pmac_dma_stop(rec); |
| 265 | snd_pmac_dma_set_command(rec, &rec->cmd); | 265 | 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 | #if 1 /* hmm.. how can we get the current dma pointer?? */ | 328 | #if 1 /* hmm.. how can we get the current dma pointer?? */ |
| 329 | int stat; | 329 | int stat; |
| 330 | volatile struct dbdma_cmd __iomem *cp = &rec->cmd.cmds[rec->cur_period]; | 330 | volatile struct dbdma_cmd __iomem *cp = &rec->cmd.cmds[rec->cur_period]; |
| 331 | stat = ld_le16(&cp->xfer_status); | 331 | stat = le16_to_cpu(cp->xfer_status); |
| 332 | if (stat & (ACTIVE|DEAD)) { | 332 | if (stat & (ACTIVE|DEAD)) { |
| 333 | count = in_le16(&cp->res_count); | 333 | count = in_le16(&cp->res_count); |
| 334 | if (count) | 334 | if (count) |
| @@ -427,26 +427,26 @@ static inline void snd_pmac_pcm_dead_xfer(struct pmac_stream *rec, | |||
| 427 | memcpy((void *)emergency_dbdma.cmds, (void *)cp, | 427 | memcpy((void *)emergency_dbdma.cmds, (void *)cp, |
| 428 | sizeof(struct dbdma_cmd)); | 428 | sizeof(struct dbdma_cmd)); |
| 429 | emergency_in_use = 1; | 429 | emergency_in_use = 1; |
| 430 | st_le16(&cp->xfer_status, 0); | 430 | cp->xfer_status = cpu_to_le16(0); |
| 431 | st_le16(&cp->req_count, rec->period_size); | 431 | cp->req_count = cpu_to_le16(rec->period_size); |
| 432 | cp = emergency_dbdma.cmds; | 432 | cp = emergency_dbdma.cmds; |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | /* now bump the values to reflect the amount | 435 | /* now bump the values to reflect the amount |
| 436 | we haven't yet shifted */ | 436 | we haven't yet shifted */ |
| 437 | req = ld_le16(&cp->req_count); | 437 | req = le16_to_cpu(cp->req_count); |
| 438 | res = ld_le16(&cp->res_count); | 438 | res = le16_to_cpu(cp->res_count); |
| 439 | phy = ld_le32(&cp->phy_addr); | 439 | phy = le32_to_cpu(cp->phy_addr); |
| 440 | phy += (req - res); | 440 | phy += (req - res); |
| 441 | st_le16(&cp->req_count, res); | 441 | cp->req_count = cpu_to_le16(res); |
| 442 | st_le16(&cp->res_count, 0); | 442 | cp->res_count = cpu_to_le16(0); |
| 443 | st_le16(&cp->xfer_status, 0); | 443 | cp->xfer_status = cpu_to_le16(0); |
| 444 | st_le32(&cp->phy_addr, phy); | 444 | cp->phy_addr = cpu_to_le32(phy); |
| 445 | 445 | ||
| 446 | st_le32(&cp->cmd_dep, rec->cmd.addr | 446 | cp->cmd_dep = cpu_to_le32(rec->cmd.addr |
| 447 | + sizeof(struct dbdma_cmd)*((rec->cur_period+1)%rec->nperiods)); | 447 | + sizeof(struct dbdma_cmd)*((rec->cur_period+1)%rec->nperiods)); |
| 448 | 448 | ||
| 449 | st_le16(&cp->command, OUTPUT_MORE | BR_ALWAYS | INTR_ALWAYS); | 449 | cp->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS | INTR_ALWAYS); |
| 450 | 450 | ||
| 451 | /* point at our patched up command block */ | 451 | /* point at our patched up command block */ |
| 452 | out_le32(&rec->dma->cmdptr, emergency_dbdma.addr); | 452 | 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 | else | 475 | else |
| 476 | cp = &rec->cmd.cmds[rec->cur_period]; | 476 | cp = &rec->cmd.cmds[rec->cur_period]; |
| 477 | 477 | ||
| 478 | stat = ld_le16(&cp->xfer_status); | 478 | stat = le16_to_cpu(cp->xfer_status); |
| 479 | 479 | ||
| 480 | if (stat & DEAD) { | 480 | if (stat & DEAD) { |
| 481 | snd_pmac_pcm_dead_xfer(rec, cp); | 481 | 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 | break; | 489 | break; |
| 490 | 490 | ||
| 491 | /*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/ | 491 | /*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/ |
| 492 | st_le16(&cp->xfer_status, 0); | 492 | cp->xfer_status = cpu_to_le16(0); |
| 493 | st_le16(&cp->req_count, rec->period_size); | 493 | cp->req_count = cpu_to_le16(rec->period_size); |
| 494 | /*st_le16(&cp->res_count, 0);*/ | 494 | /*cp->res_count = cpu_to_le16(0);*/ |
| 495 | rec->cur_period++; | 495 | rec->cur_period++; |
| 496 | if (rec->cur_period >= rec->nperiods) { | 496 | if (rec->cur_period >= rec->nperiods) { |
| 497 | rec->cur_period = 0; | 497 | rec->cur_period = 0; |
| @@ -760,11 +760,11 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add | |||
| 760 | struct pmac_stream *rec = &chip->playback; | 760 | struct pmac_stream *rec = &chip->playback; |
| 761 | 761 | ||
| 762 | snd_pmac_dma_stop(rec); | 762 | snd_pmac_dma_stop(rec); |
| 763 | st_le16(&chip->extra_dma.cmds->req_count, bytes); | 763 | chip->extra_dma.cmds->req_count = cpu_to_le16(bytes); |
| 764 | st_le16(&chip->extra_dma.cmds->xfer_status, 0); | 764 | chip->extra_dma.cmds->xfer_status = cpu_to_le16(0); |
| 765 | st_le32(&chip->extra_dma.cmds->cmd_dep, chip->extra_dma.addr); | 765 | chip->extra_dma.cmds->cmd_dep = cpu_to_le32(chip->extra_dma.addr); |
| 766 | st_le32(&chip->extra_dma.cmds->phy_addr, addr); | 766 | chip->extra_dma.cmds->phy_addr = cpu_to_le32(addr); |
| 767 | st_le16(&chip->extra_dma.cmds->command, OUTPUT_MORE + BR_ALWAYS); | 767 | chip->extra_dma.cmds->command = cpu_to_le16(OUTPUT_MORE + BR_ALWAYS); |
| 768 | out_le32(&chip->awacs->control, | 768 | out_le32(&chip->awacs->control, |
| 769 | (in_le32(&chip->awacs->control) & ~0x1f00) | 769 | (in_le32(&chip->awacs->control) & ~0x1f00) |
| 770 | | (speed << 8)); | 770 | | (speed << 8)); |
| @@ -776,7 +776,7 @@ void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long add | |||
| 776 | void snd_pmac_beep_dma_stop(struct snd_pmac *chip) | 776 | void snd_pmac_beep_dma_stop(struct snd_pmac *chip) |
| 777 | { | 777 | { |
| 778 | snd_pmac_dma_stop(&chip->playback); | 778 | snd_pmac_dma_stop(&chip->playback); |
| 779 | st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP); | 779 | chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); |
| 780 | snd_pmac_pcm_set_format(chip); /* reset format */ | 780 | snd_pmac_pcm_set_format(chip); /* reset format */ |
| 781 | } | 781 | } |
| 782 | 782 | ||
