Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

On Tue, Mar 6, 2018 at 2:06 AM, Michael Schmitz <schmitzmic@xxxxxxxxx> wrote:
thanks for explaining - I had forgotten that the SCSI adapter in elgar
is probably on the CPU accelerator card.

00: Phase 5 Digital Products CyberSCSI/Blizzard 1220
        Type: Zorro II
        Address: 00e90000 (00010000 bytes)
        Serial number: 00000000
        Slot address: 00e9
        Slot size: 0001

is the output for that card.

The register address space of these cards (except Fastlane) fits into
the smaller ZorroII space.

Your version of the patch, plus setup of the 32 bit mask in the
driver, is the correct solution. Do you want me to submit a corrected
patch, or can you do that on the fly?

I will apply, and queue for v4.16:

commit 45243ee871a5681042d6fa6e43ddb4f6fe06669d
Author: Michael Schmitz <schmitzmic@xxxxxxxxx>
Date:   Sat Mar 3 12:04:13 2018 +1300

    zorro: Set up z->dev.dma_mask for the DMA API

    The generic DMA API uses dev->dma_mask to check the DMA addressable
    memory bitmask, and warns if no mask is set or even allocated.

    Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
    to point to z->dev.dma_coherent_mask so device drivers that need DMA have
    everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
    still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.

    Signed-off-by: Michael Schmitz <schmitzmic@xxxxxxxxx>
    [geert: Handle Zorro II with 24-bit address space]
    Acked-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index cc1b1ac57d61e8b7..4a5bccba55548720 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -16,6 +16,7 @@
 #include <linux/bitops.h>
 #include <linux/string.h>
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 #include <linux/slab.h>

 #include <asm/byteorder.h>
@@ -185,6 +186,16 @@ static int __init amiga_zorro_probe(struct
platform_device *pdev)
                z->dev.parent = &bus->dev;
                z->dev.bus = &zorro_bus_type;
                z->dev.id = i;
+               switch (z->rom.er_Type & ERT_TYPEMASK) {
+               case ERT_ZORROIII:
+                       z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+                       break;
+               case ERT_ZORROII:
+               default:
+                       z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
+                       break;
+               }
+               z->dev.dma_mask = &z->dev.coherent_dma_mask;
        }

        /* ... then register them */

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux