From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
linux-arm-kernel@lists.infradead.org,
Olof Johansson <olof@lixom.net>,
Russell King <linux@arm.linux.org.uk>,
Rob Herring <rob.herring@calxeda.com>,
Ben Dooks <ben-linux@fluff.org>,
Ian Molton <ian.molton@codethink.co.uk>,
Nicolas Pitre <nico@fluxnic.net>,
Lior Amsalem <alior@marvell.com>,
Maen Suleiman <maen@marvell.com>,
Tawfik Bayouk <tawfik@marvell.com>,
Shadi Ammouri <shadi@marvell.com>,
Eran Ben-Avi <benavi@marvell.com>,
Yehuda Yitschak <yehuday@marvell.com>,
Nadav Haklai <nadavh@marvell.com>,
Ike Pan <ike.pan@canonical.com>,
Jani Monoses <jani.monoses@canonical.com>,
Chris Van Hoof <vanhoof@canonical.com>,
Dan Frazier <dann.frazier@canonical.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Leif Lindholm <leif.lindholm@arm.com>,
Jon Masters <jcm@redhat.com>, David Marlin <dmarlin@redhat.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] arm: mvebu: Add hardware I/O Coherency support
Date: Wed, 24 Oct 2012 13:48:04 +0200 [thread overview]
Message-ID: <5087D574.4030503@free-electrons.com> (raw)
In-Reply-To: <201210241136.12779.arnd@arndb.de>
On 10/24/2012 01:36 PM, Arnd Bergmann wrote:
> On Wednesday 24 October 2012, Gregory CLEMENT wrote:
>> +void __init armada_370_xp_coherency_iocache_init(void)
>> +{
>> + /* When the coherency fabric is available, the Armada XP and
>> + * Aramada 370 are close to a coherent architecture, so we based
>> + * our dma ops on the coherent one, and just changes the
>> + * operations which need a arch io sync */
>> + if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) {
>> + struct dma_map_ops *dma_ops = &armada_xp_dma_ops;
>> + memcpy(dma_ops, &arm_coherent_dma_ops, sizeof(*dma_ops));
>> + dma_ops->map_page = armada_xp_dma_map_page;
>> + dma_ops->unmap_page = armada_xp_dma_unmap_page;
>> + dma_ops->unmap_sg = arm_dma_ops.unmap_sg;
>> + dma_ops->sync_single_for_cpu = armada_xp_dma_sync;
>> + dma_ops->sync_single_for_device = armada_xp_dma_sync;
>> + dma_ops->sync_sg_for_cpu = arm_dma_ops.sync_sg_for_cpu;
>> + dma_ops->sync_sg_for_device = arm_dma_ops.sync_sg_for_device;
>> + }
>> + bus_register_notifier(&platform_bus_type, &armada_xp_platform_nb);
>
> I think it would be cleaner to statically define the operations in a constant
> structure and point directly to the functions you need. If necessary, use
> multiple structures.
My problem was that these functions are not exposed, only arm_dma_op and
arm_coherent_dma_ops are exported.
Or do you think about something like this:
struct dma_map_ops *dma_ops = {
.alloc = arm_dma_ops.arm_coherent_dma_alloc,
.free = arm_dma_ops.arm_coherent_dma_free,
.mmap = arm_dma_ops.arm_dma_mmap,
.get_sgtable = arm_dma_ops.arm_dma_get_sgtable,
.map_sg = arm_dma_ops.arm_dma_map_sg,
.set_dma_mask = arm_dma_ops.arm_dma_set_mask,
.map_page = armada_xp_dma_map_page,
.unmap_page = armada_xp_dma_unmap_page,
.unmap_sg = arm_dma_ops.unmap_sg,
.sync_single_for_cpu = armada_xp_dma_sync,
.sync_single_for_device = armada_xp_dma_sync,
.sync_sg_for_cpu = arm_dma_ops.sync_sg_for_cpu,
.sync_sg_for_device = arm_dma_ops.sync_sg_for_device,
};
>
> Arnd
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2012-10-24 11:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 8:03 [PATCH 0/2] Add hardware I/O coherency support for Armada 370/XP Gregory CLEMENT
2012-10-24 8:04 ` [PATCH 1/2] arm: plat-orion: Add coherency attribute when setup mbus target Gregory CLEMENT
2012-10-24 11:55 ` Thomas Petazzoni
2012-10-24 8:04 ` [PATCH 2/2] arm: mvebu: Add hardware I/O Coherency support Gregory CLEMENT
2012-10-24 8:11 ` Yehuda Yitschak
2012-10-24 11:36 ` Arnd Bergmann
2012-10-24 11:48 ` Gregory CLEMENT [this message]
2012-10-24 11:53 ` Gregory CLEMENT
2012-10-24 12:24 ` Arnd Bergmann
2012-10-24 13:56 ` Gregory CLEMENT
2012-10-24 20:30 ` Arnd Bergmann
[not found] ` <20121024082529.GZ11837@lunn.ch>
2012-10-24 11:50 ` Gregory CLEMENT
2012-10-24 12:27 ` Thomas Petazzoni
2012-10-24 14:39 ` Gregory CLEMENT
2012-10-24 14:56 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5087D574.4030503@free-electrons.com \
--to=gregory.clement@free-electrons.com \
--cc=alior@marvell.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=ben-linux@fluff.org \
--cc=benavi@marvell.com \
--cc=dann.frazier@canonical.com \
--cc=dmarlin@redhat.com \
--cc=ian.molton@codethink.co.uk \
--cc=ike.pan@canonical.com \
--cc=jani.monoses@canonical.com \
--cc=jason@lakedaemon.net \
--cc=jcm@redhat.com \
--cc=leif.lindholm@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=maen@marvell.com \
--cc=nadavh@marvell.com \
--cc=nico@fluxnic.net \
--cc=olof@lixom.net \
--cc=rob.herring@calxeda.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=shadi@marvell.com \
--cc=tawfik@marvell.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=vanhoof@canonical.com \
--cc=yehuday@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome