public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: rmk+kernel@arm•linux.org.uk (Russell King)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC 09/34] dmaengine: PL08x: move private data structures into amba-pl08x.c
Date: Tue, 29 May 2012 10:38:18 +0100	[thread overview]
Message-ID: <E1SZIsc-0006zJ-R0@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20120529093015.GF12217@n2100.arm.linux.org.uk>

Move the driver private data structures into the driver itself, rather
than having them exposed to everyone in a header file.

Signed-off-by: Russell King <rmk+kernel@arm•linux.org.uk>
---
 drivers/dma/amba-pl08x.c   |  136 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/amba/pl08x.h |  138 +-------------------------------------------
 2 files changed, 138 insertions(+), 136 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 757a65d..d3ba147 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -90,6 +90,7 @@
 #define DRIVER_NAME	"pl08xdmac"
 
 static struct amba_driver pl08x_amba_driver;
+struct pl08x_driver_data;
 
 /**
  * struct vendor_data - vendor-specific config parameters for PL08x derivatives
@@ -115,6 +116,141 @@ struct pl08x_lli {
 };
 
 /**
+ * struct pl08x_bus_data - information of source or destination
+ * busses for a transfer
+ * @addr: current address
+ * @maxwidth: the maximum width of a transfer on this bus
+ * @buswidth: the width of this bus in bytes: 1, 2 or 4
+ */
+struct pl08x_bus_data {
+	dma_addr_t addr;
+	u8 maxwidth;
+	u8 buswidth;
+};
+
+/**
+ * struct pl08x_phy_chan - holder for the physical channels
+ * @id: physical index to this channel
+ * @lock: a lock to use when altering an instance of this struct
+ * @signal: the physical signal (aka channel) serving this physical channel
+ * right now
+ * @serving: the virtual channel currently being served by this physical
+ * channel
+ */
+struct pl08x_phy_chan {
+	unsigned int id;
+	void __iomem *base;
+	spinlock_t lock;
+	int signal;
+	struct pl08x_dma_chan *serving;
+};
+
+/**
+ * struct pl08x_sg - structure containing data per sg
+ * @src_addr: src address of sg
+ * @dst_addr: dst address of sg
+ * @len: transfer len in bytes
+ * @node: node for txd's dsg_list
+ */
+struct pl08x_sg {
+	dma_addr_t src_addr;
+	dma_addr_t dst_addr;
+	size_t len;
+	struct list_head node;
+};
+
+/**
+ * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
+ * @tx: async tx descriptor
+ * @node: node for txd list for channels
+ * @dsg_list: list of children sg's
+ * @direction: direction of transfer
+ * @llis_bus: DMA memory address (physical) start for the LLIs
+ * @llis_va: virtual memory address start for the LLIs
+ * @cctl: control reg values for current txd
+ * @ccfg: config reg values for current txd
+ */
+struct pl08x_txd {
+	struct dma_async_tx_descriptor tx;
+	struct list_head node;
+	struct list_head dsg_list;
+	enum dma_transfer_direction direction;
+	dma_addr_t llis_bus;
+	struct pl08x_lli *llis_va;
+	/* Default cctl value for LLIs */
+	u32 cctl;
+	/*
+	 * Settings to be put into the physical channel when we
+	 * trigger this txd.  Other registers are in llis_va[0].
+	 */
+	u32 ccfg;
+};
+
+/**
+ * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
+ * states
+ * @PL08X_CHAN_IDLE: the channel is idle
+ * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
+ * channel and is running a transfer on it
+ * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
+ * channel, but the transfer is currently paused
+ * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
+ * channel to become available (only pertains to memcpy channels)
+ */
+enum pl08x_dma_chan_state {
+	PL08X_CHAN_IDLE,
+	PL08X_CHAN_RUNNING,
+	PL08X_CHAN_PAUSED,
+	PL08X_CHAN_WAITING,
+};
+
+/**
+ * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
+ * @chan: wrappped abstract channel
+ * @phychan: the physical channel utilized by this channel, if there is one
+ * @phychan_hold: if non-zero, hold on to the physical channel even if we
+ * have no pending entries
+ * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
+ * @name: name of channel
+ * @cd: channel platform data
+ * @runtime_addr: address for RX/TX according to the runtime config
+ * @runtime_direction: current direction of this channel according to
+ * runtime config
+ * @pend_list: queued transactions pending on this channel
+ * @at: active transaction on this channel
+ * @lock: a lock for this channel data
+ * @host: a pointer to the host (internal use)
+ * @state: whether the channel is idle, paused, running etc
+ * @slave: whether this channel is a device (slave) or for memcpy
+ * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
+ * channels. Fill with 'true' if peripheral should be flow controller. Direction
+ * will be selected at Runtime.
+ * @waiting: a TX descriptor on this channel which is waiting for a physical
+ * channel to become available
+ */
+struct pl08x_dma_chan {
+	struct dma_chan chan;
+	struct pl08x_phy_chan *phychan;
+	int phychan_hold;
+	struct tasklet_struct tasklet;
+	char *name;
+	const struct pl08x_channel_data *cd;
+	dma_addr_t src_addr;
+	dma_addr_t dst_addr;
+	u32 src_cctl;
+	u32 dst_cctl;
+	enum dma_transfer_direction runtime_direction;
+	struct list_head pend_list;
+	struct pl08x_txd *at;
+	spinlock_t lock;
+	struct pl08x_driver_data *host;
+	enum pl08x_dma_chan_state state;
+	bool slave;
+	bool device_fc;
+	struct pl08x_txd *waiting;
+};
+
+/**
  * struct pl08x_driver_data - the local state holder for the PL08x
  * @slave: slave engine for this instance
  * @memcpy: memcpy engine for this instance
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 85e3a53..48d02bf 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -21,8 +21,9 @@
 #include <linux/dmaengine.h>
 #include <linux/interrupt.h>
 
-struct pl08x_lli;
 struct pl08x_driver_data;
+struct pl08x_phy_chan;
+struct pl08x_txd;
 
 /* Bitmasks for selecting AHB ports for DMA transfers */
 enum {
@@ -68,141 +69,6 @@ struct pl08x_channel_data {
 };
 
 /**
- * Struct pl08x_bus_data - information of source or destination
- * busses for a transfer
- * @addr: current address
- * @maxwidth: the maximum width of a transfer on this bus
- * @buswidth: the width of this bus in bytes: 1, 2 or 4
- */
-struct pl08x_bus_data {
-	dma_addr_t addr;
-	u8 maxwidth;
-	u8 buswidth;
-};
-
-/**
- * struct pl08x_phy_chan - holder for the physical channels
- * @id: physical index to this channel
- * @lock: a lock to use when altering an instance of this struct
- * @signal: the physical signal (aka channel) serving this physical channel
- * right now
- * @serving: the virtual channel currently being served by this physical
- * channel
- */
-struct pl08x_phy_chan {
-	unsigned int id;
-	void __iomem *base;
-	spinlock_t lock;
-	int signal;
-	struct pl08x_dma_chan *serving;
-};
-
-/**
- * struct pl08x_sg - structure containing data per sg
- * @src_addr: src address of sg
- * @dst_addr: dst address of sg
- * @len: transfer len in bytes
- * @node: node for txd's dsg_list
- */
-struct pl08x_sg {
-	dma_addr_t src_addr;
-	dma_addr_t dst_addr;
-	size_t len;
-	struct list_head node;
-};
-
-/**
- * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
- * @tx: async tx descriptor
- * @node: node for txd list for channels
- * @dsg_list: list of children sg's
- * @direction: direction of transfer
- * @llis_bus: DMA memory address (physical) start for the LLIs
- * @llis_va: virtual memory address start for the LLIs
- * @cctl: control reg values for current txd
- * @ccfg: config reg values for current txd
- */
-struct pl08x_txd {
-	struct dma_async_tx_descriptor tx;
-	struct list_head node;
-	struct list_head dsg_list;
-	enum dma_transfer_direction direction;
-	dma_addr_t llis_bus;
-	struct pl08x_lli *llis_va;
-	/* Default cctl value for LLIs */
-	u32 cctl;
-	/*
-	 * Settings to be put into the physical channel when we
-	 * trigger this txd.  Other registers are in llis_va[0].
-	 */
-	u32 ccfg;
-};
-
-/**
- * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
- * states
- * @PL08X_CHAN_IDLE: the channel is idle
- * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
- * channel and is running a transfer on it
- * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
- * channel, but the transfer is currently paused
- * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
- * channel to become available (only pertains to memcpy channels)
- */
-enum pl08x_dma_chan_state {
-	PL08X_CHAN_IDLE,
-	PL08X_CHAN_RUNNING,
-	PL08X_CHAN_PAUSED,
-	PL08X_CHAN_WAITING,
-};
-
-/**
- * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
- * @chan: wrappped abstract channel
- * @phychan: the physical channel utilized by this channel, if there is one
- * @phychan_hold: if non-zero, hold on to the physical channel even if we
- * have no pending entries
- * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
- * @name: name of channel
- * @cd: channel platform data
- * @runtime_addr: address for RX/TX according to the runtime config
- * @runtime_direction: current direction of this channel according to
- * runtime config
- * @pend_list: queued transactions pending on this channel
- * @at: active transaction on this channel
- * @lock: a lock for this channel data
- * @host: a pointer to the host (internal use)
- * @state: whether the channel is idle, paused, running etc
- * @slave: whether this channel is a device (slave) or for memcpy
- * @device_fc: Flow Controller Settings for ccfg register. Only valid for slave
- * channels. Fill with 'true' if peripheral should be flow controller. Direction
- * will be selected at Runtime.
- * @waiting: a TX descriptor on this channel which is waiting for a physical
- * channel to become available
- */
-struct pl08x_dma_chan {
-	struct dma_chan chan;
-	struct pl08x_phy_chan *phychan;
-	int phychan_hold;
-	struct tasklet_struct tasklet;
-	char *name;
-	const struct pl08x_channel_data *cd;
-	dma_addr_t src_addr;
-	dma_addr_t dst_addr;
-	u32 src_cctl;
-	u32 dst_cctl;
-	enum dma_transfer_direction runtime_direction;
-	struct list_head pend_list;
-	struct pl08x_txd *at;
-	spinlock_t lock;
-	struct pl08x_driver_data *host;
-	enum pl08x_dma_chan_state state;
-	bool slave;
-	bool device_fc;
-	struct pl08x_txd *waiting;
-};
-
-/**
  * struct pl08x_platform_data - the platform configuration for the PL08x
  * PrimeCells.
  * @slave_channels: the channels defined for the different devices on the
-- 
1.7.4.4

  parent reply	other threads:[~2012-05-29  9:38 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29  9:30 [RFC 00/34] PL08x DMA conversion to virt-dma Russell King - ARM Linux
2012-05-29  9:35 ` [RFC 01/34] dmaengine: split out virtual channel DMA support from sa11x0 driver Russell King
2012-05-29  9:35 ` [RFC 02/34] dmaengine: virt-dma: vchan_find_desc() Russell King
2012-05-30  7:48   ` Linus Walleij
2012-05-29  9:36 ` [RFC 03/34] dmaengine: virt-dma: add support for cyclic DMA periodic callbacks Russell King
2012-05-30  7:52   ` Linus Walleij
2012-05-30  8:02     ` Russell King - ARM Linux
2012-05-31  1:29       ` Linus Walleij
2012-05-31  3:45       ` zhangfei gao
2012-05-31 19:17         ` Russell King - ARM Linux
2012-06-01  2:26           ` zhangfei gao
2012-06-01 10:39             ` Russell King - ARM Linux
2012-05-29  9:36 ` [RFC 04/34] dmaengine: PL08x: remove runtime PM support Russell King
2012-05-31  0:46   ` Linus Walleij
2012-06-01 10:45     ` Russell King - ARM Linux
2012-05-29  9:36 ` [RFC 05/34] dmaengine: PL08x: fix missed dma_transfer_direction fixup Russell King
2012-05-31  0:47   ` Linus Walleij
2012-06-01 10:47     ` Russell King - ARM Linux
2012-05-29  9:37 ` [RFC 06/34] dmaengine: PL08x: remove redundant spinlock Russell King
2012-05-31  0:48   ` Linus Walleij
2012-05-29  9:37 ` [RFC 07/34] dmaengine: PL08x: remove circular_buffer boolean from channel data Russell King
2012-05-31  0:49   ` Linus Walleij
2012-05-29  9:37 ` [RFC 08/34] dmaengine: PL08x: clean up get_signal/put_signal Russell King
2012-05-31  0:53   ` Linus Walleij
2012-06-01 10:48     ` Russell King - ARM Linux
2012-05-29  9:38 ` Russell King [this message]
2012-05-31  0:54   ` [RFC 09/34] dmaengine: PL08x: move private data structures into amba-pl08x.c Linus Walleij
2012-05-29  9:38 ` [RFC 10/34] dmaengine: PL08x: constify channel names and bus_id strings Russell King
2012-05-31  0:55   ` Linus Walleij
2012-05-29  9:38 ` [RFC 11/34] dmaengine: PL08x: get src/dst addr direct from dma_slave_config struct Russell King
2012-05-31  0:56   ` Linus Walleij
2012-05-29  9:39 ` [RFC 12/34] dmaengine: PL08x: get rid of device_fc in struct pl08x_dma_chan Russell King
2012-05-31  0:57   ` Linus Walleij
2012-05-29  9:39 ` [RFC 13/34] dmaengine: PL08x: move the bus and increment selection to dma prepare function Russell King
2012-05-31  0:57   ` Linus Walleij
2012-05-29  9:39 ` [RFC 14/34] dmaengine: PL08x: extract function to to generate cctl values Russell King
2012-05-31  1:00   ` Linus Walleij
2012-05-29  9:40 ` [RFC 15/34] dmaengine: PL08x: ignore 'direction' argument in dma_slave_config Russell King
2012-05-31  1:01   ` Linus Walleij
2012-05-29  9:40 ` [RFC 16/34] dmaengine: PL08x: get rid of unnecessary checks " Russell King
2012-05-31  1:02   ` Linus Walleij
2012-05-29  9:40 ` [RFC 17/34] dmaengine: PL08x: split DMA signal muxing from channel alloc Russell King
2012-05-31  1:03   ` Linus Walleij
2012-05-29  9:41 ` [RFC 18/34] dmaengine: PL08x: move DMA signal muxing into pl08x_dma_chan struct Russell King
2012-05-31  1:03   ` Linus Walleij
2012-05-29  9:41 ` [RFC 19/34] dmaengine: PL08x: track mux usage on a per-channel basis Russell King
2012-05-31  1:04   ` Linus Walleij
2012-05-29  9:42 ` [RFC 20/34] dmaengine: PL08x: convert to a list of completed descriptors Russell King
2012-05-31  1:04   ` Linus Walleij
2012-05-29  9:42 ` [RFC 21/34] dmaengine: PL08x: move DMA signal muxing into slave prepare code Russell King
2012-05-31  1:11   ` Linus Walleij
2012-05-29  9:42 ` [RFC 22/34] dmaengine: PL08x: remove waiting descriptor pointer Russell King
2012-05-31  1:11   ` Linus Walleij
2012-05-29  9:43 ` [RFC 23/34] dmaengine: PL08x: re-jig the starting of txds Russell King
2012-05-31  1:14   ` Linus Walleij
2012-06-01 10:52     ` Russell King - ARM Linux
2012-06-04 15:54       ` Linus Walleij
2012-05-29  9:43 ` [RFC 24/34] dmaengine: PL08x: split the pend_list in two Russell King
2012-05-31  1:20   ` Linus Walleij
2012-05-29  9:43 ` [RFC 25/34] dmaengine: PL08x: start next descriptor from irq context Russell King
2012-05-31  1:21   ` Linus Walleij
2012-05-29  9:44 ` [RFC 26/34] dmaengine: PL08x: rejig physical channel allocation Russell King
2012-05-31  1:23   ` Linus Walleij
2012-05-29  9:44 ` [RFC 27/34] dmaengine: PL08x: convert to use virt-dma structs Russell King
2012-05-31  1:23   ` Linus Walleij
2012-05-29  9:44 ` [RFC 28/34] dmaengine: PL08x: use vchan's spinlock Russell King
2012-05-31  1:24   ` Linus Walleij
2012-05-29  9:45 ` [RFC 29/34] dmaengine: PL08x: convert to use vchan submitted/issued lists Russell King
2012-05-31  1:24   ` Linus Walleij
2012-05-29  9:45 ` [RFC 30/34] dmaengine: PL08x: convert to use vchan done list Russell King
2012-05-31  1:24   ` Linus Walleij
2012-05-29  9:45 ` [RFC 31/34] dmaengine: PL08x: fix tx_status function to return correct residue Russell King
2012-05-31  1:25   ` Linus Walleij
2012-05-29  9:46 ` [RFC 32/34] dmaengine: PL08x: get rid of pl08x_prep_channel_resources Russell King
2012-05-31  1:25   ` Linus Walleij
2012-05-29  9:46 ` [RFC 33/34] dmaengine: PL08x: get rid of write only pool_ctr and free_txd locking Russell King
2012-05-31  1:26   ` Linus Walleij
2012-05-29  9:46 ` [RFC 34/34] dmaengine: PL08x: ensure all descriptors are freed when channel is released Russell King
2012-05-31  1:27   ` Linus Walleij
2012-06-01 10:55     ` Russell King - ARM Linux

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=E1SZIsc-0006zJ-R0@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm$(echo .)linux.org.uk \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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