Skip to contentSkip to conversation

musb_hdrc cleanup -- cppi and sparse

PATCH In review David Brownell 2 participants 2 messages Aug 25, 2007 – Aug 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 musb_hdrc cleanup -- cppi and sparse

Cleanup for CPPI DMA (for DaVinci, and someday TUSB6020):

- Move state ram structs to CPPI header, it's not DaVinci-specific

- Do some associated CamelCase removal, in conjunction with removing inappropriate "volatile" declarations.

This resolves a bunch of "sparse" warnings with this code, most of which seem to have been caused by bugs in older versions of "sparse".

---
 drivers/usb/musb/cppi_dma.c |  179 +++++++++++++++++++++-----------------------
 drivers/usb/musb/cppi_dma.h |   32 +++++++
 drivers/usb/musb/davinci.h  |   27 ------
 3 files changed, 121 insertions(+), 117 deletions(-)
drivers/usb/musb/davinci.h +3 -24
@@ -40,6 +40,8 @@
 #define DAVINCI_USB_EOI_REG		0x3c
 #define DAVINCI_USB_EOI_INTVEC		0x40
 
+/* BEGIN CPPI-generic (?) */
+
 /* CPPI related registers */
 #define DAVINCI_TXCPPI_CTRL_REG		0x80
 #define DAVINCI_TXCPPI_TEAR_REG		0x84
@@ -76,30 +78,7 @@
 #define DAVINCI_DMA_ALL_CHANNELS_ENABLE	0xF
 #define DAVINCI_DMA_ALL_CHANNELS_DISABLE 0xF
 
-/* FIXME relying on "volatile" here is wrong ... */
-
-/* define structures of Rx/Tx stateRam entries */
-struct cppi_tx_stateram {
-	volatile u32 headPtr;
-	volatile u32 sopDescPtr;
-	volatile u32 currDescPtr;
-	volatile u32 currBuffPtr;
-	volatile u32 flags;
-	volatile u32 remLength;
-	volatile u32 dummy;
-	volatile u32 completionPtr;
-};
-
-struct cppi_rx_stateram {
-	volatile u32 buffOffset;
-	volatile u32 headPtr;
-	volatile u32 sopDescPtr;
-	volatile u32 currDescPtr;
-	volatile u32 currBuffPtr;
-	volatile u32 pktLength;
-	volatile u32 byteCount;
-	volatile u32 completionPtr;
-};
+/* END CPPI-generic (?) */
 
 #define DAVINCI_USB_TX_ENDPTS_MASK	0x1f		/* ep0 + 4 tx */
 #define DAVINCI_USB_RX_ENDPTS_MASK	0x1e		/* 4 rx */
drivers/usb/musb/cppi_dma.h +31 -1
@@ -11,9 +11,39 @@
 
 #include "musb_dma.h"
 #include "musb_core.h"
+
+
+/* FIXME fully isolate CPPI from DaVinci ... the "CPPI generic" registers
+ * would seem to be shared with the TUSB6020 (over VLYNQ).
+ */
+
 #include "davinci.h"
 
 
+/* CPPI RX/TX state RAM */
+
+struct cppi_tx_stateram {
+	u32 tx_head;			/* "DMA packet" head descriptor */
+	u32 tx_buf;
+	u32 tx_current;			/* current descriptor */
+	u32 tx_buf_current;
+	u32 tx_info;			/* flags, remaining buflen */
+	u32 tx_rem_len;
+	u32 tx_dummy;			/* unused */
+	u32 tx_complete;
+};
+
+struct cppi_rx_stateram {
+	u32 rx_skipbytes;
+	u32 rx_head;
+	u32 rx_sop;			/* "DMA packet" head descriptor */
+	u32 rx_current;			/* current descriptor */
+	u32 rx_buf_current;
+	u32 rx_len_len;
+	u32 rx_cnt_cnt;
+	u32 rx_complete;
+};
+
 /* hOptions bit masks for CPPI BDs */
 #define CPPI_SOP_SET	((u32)(1 << 31))
 #define CPPI_EOP_SET	((u32)(1 << 30))
@@ -73,7 +103,7 @@ struct cppi_channel {
 	u32			currOffset;	/* requested segments */
 	u32			actualLen;	/* completed (Channel.actual) */
 
-	void __iomem		*stateRam;	/* CPPI state */
+	void __iomem		*state_ram;	/* CPPI state */
 
 	/* BD management fields */
 	struct cppi_descriptor	*bdPoolHead;
drivers/usb/musb/cppi_dma.c +87 -92

370 lines not on this page · raw message

#1 lore raw
Quoted 9 lines · David Brownell

Cleanup for CPPI DMA (for DaVinci, and someday TUSB6020):

- Move state ram structs to CPPI header, it's not DaVinci-specific

- Do some associated CamelCase removal, in conjunction with removing inappropriate "volatile" declarations.

This resolves a bunch of "sparse" warnings with this code, most of which seem to have been caused by bugs in older versions of "sparse".

Pushed.

Tony