Skip to contentSkip to conversation

mpc5200: Add RTDM LPBFIFO driver and demo RTDM FPGA device driver

PATCH Superseded [email protected] 3 participants 7 messages Nov 21, 2012 – Nov 23, 2012

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mpc5200: Add RTDM LPBFIFO driver and demo RTDM FPGA device driver

From: Stefan Roese <[email protected]>

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

The lpb-fifo driver is ported from the Linux kernel lpb-fifo driver:

arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c

With all locking etc changed from Linux call to Xenomai/RTDM calls.

---
v2:
- Moved debug switches from #define in source to Kconfig
- Some minor spelling fixes

 ksrc/drivers/Config.in                        |   1 +
 ksrc/drivers/Kconfig                          |   1 +
 ksrc/drivers/Makefile                         |   6 +-
 ksrc/drivers/mpc5200_dma/Config.in            |  10 +
 ksrc/drivers/mpc5200_dma/Kconfig              |  41 ++
 ksrc/drivers/mpc5200_dma/Makefile             |  31 ++
 ksrc/drivers/mpc5200_dma/rt-fpga.c            | 694 ++++++++++++++++++++++++++
 ksrc/drivers/mpc5200_dma/rt-fpga.h            |  35 ++
 ksrc/drivers/mpc5200_dma/rt_mpc52xx_lpbfifo.c | 569 +++++++++++++++++++++
 scripts/Modules.frag                          |   3 +-
 10 files changed, 1388 insertions(+), 3 deletions(-)
 create mode 100644 ksrc/drivers/mpc5200_dma/Config.in
 create mode 100644 ksrc/drivers/mpc5200_dma/Kconfig
 create mode 100644 ksrc/drivers/mpc5200_dma/Makefile
 create mode 100644 ksrc/drivers/mpc5200_dma/rt-fpga.c
 create mode 100644 ksrc/drivers/mpc5200_dma/rt-fpga.h
 create mode 100644 ksrc/drivers/mpc5200_dma/rt_mpc52xx_lpbfifo.c
ksrc/drivers/Config.in +1 -0
index 0e50c44..bab3107 100644
@@ -12,5 +12,6 @@ comment 'Drivers'
 	source drivers/xenomai/can/Config.in
 	source drivers/xenomai/analogy/Config.in
 	source drivers/xenomai/ipc/Config.in
+	source drivers/xenomai/mpc5200_dma/Config.in
 endmenu
 fi
ksrc/drivers/Kconfig +1 -0
index 2a9bd8c..9ecc710 100644
@@ -7,5 +7,6 @@ source "drivers/xenomai/testing/Kconfig"
 source "drivers/xenomai/can/Kconfig"
 source "drivers/xenomai/analogy/Kconfig"
 source "drivers/xenomai/ipc/Kconfig"
+source "drivers/xenomai/mpc5200_dma/Kconfig"
 
 endmenu
ksrc/drivers/Makefile +4 -2
index 4968d87..e50ea1e 100644
@@ -2,13 +2,13 @@ ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 # Makefile frag for Linux v2.6 and v3.x
 
-obj-$(CONFIG_XENOMAI) += serial/ testing/ can/ analogy/ ipc/
+obj-$(CONFIG_XENOMAI) += serial/ testing/ can/ analogy/ ipc/ mpc5200_dma/
 
 else
 
 # Makefile frag for Linux v2.4
 
-mod-subdirs := serial testing can analogy ipc
+mod-subdirs := serial testing can analogy ipc mpc5200_dma
 
 subdir-$(CONFIG_XENO_DRIVERS_16550A) += serial
 
@@ -20,6 +20,8 @@ subdir-$(CONFIG_XENO_DRIVERS_CAN) += can
 subdir-$(CONFIG_XENO_DRIVERS_ANALOGY) += analogy
 subdir-$(CONFIG_XENO_DRIVERS_MPIPE) += ipc
 
+subdir-$(CONFIG_XENO_DRIVERS_MPC5200_DMA) += mpc5200_dma
+
 include $(TOPDIR)/Rules.make
 
 endif
ksrc/drivers/mpc5200_dma/Config.in new file +10 -0
new file mode 100644
index 0000000..367c4c6
@@ -0,0 +1,10 @@
+#
+# Xenomai configuration for Linux v2.4
+#
+
+mainmenu_option next_comment
+comment 'MPC5200 DMA drivers'
+
+dep_tristate 'MPC5200 DMA FPGA driver' CONFIG_XENO_DRIVERS_MPC5200_DMA $CONFIG_XENO_SKIN_RTDM
+
+endmenu
ksrc/drivers/mpc5200_dma/Kconfig new file +41 -0

41 lines not on this page · raw message

ksrc/drivers/mpc5200_dma/Makefile new file +31 -0
new file mode 100644
index 0000000..151dc79
@@ -0,0 +1,31 @@
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
+
+# Makefile frag for Linux v2.6 and v3.x
+
+EXTRA_CFLAGS += -D__IN_XENOMAI__ -Iinclude/xenomai
+
+obj-$(CONFIG_XENO_DRIVERS_MPC5200_DMA) += xeno_rt-fpga.o xeno_rt_mpc52xx_lpbfifo.o
+
+xeno_rt-fpga-y := rt-fpga.o
+xeno_rt_mpc52xx_lpbfifo-y := rt_mpc52xx_lpbfifo.o
+
+else
+
+# Makefile frag for Linux v2.4
+
+O_TARGET := built-in.o
+
+obj-$(CONFIG_XENO_DRIVERS_MPC5200_DMA) += xeno_rt-fpga.o xeno_rt_mpc52xx_lpbfifo.o
+
+xeno_mpc5200_dma-objs := rt-fpga.o rt_mpc52xx_lpbfifo.o
+
+export-objs := $(xeno_mpc5200_dma-objs)
+
+EXTRA_CFLAGS += -D__IN_XENOMAI__ -I$(TOPDIR)/include/xenomai -I$(TOPDIR)/include/xenomai/compat
+
+include $(TOPDIR)/Rules.make
+
+xeno_mpc5200_dma.o: $(xeno_mpc5200_dma-objs)
+	$(LD) -r -o $@ $(xeno_mpc5200_dma-objs)
+
+endif
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +694 -0

694 lines not on this page · raw message

ksrc/drivers/mpc5200_dma/rt-fpga.h new file +35 -0
new file mode 100644
index 0000000..f25cf2e
@@ -0,0 +1,35 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ */
+
+#ifndef _RT_FPGA_H
+#define _RT_FPGA_H
+
+/*
+ * IOCTL's for this FPGA driver
+ */
+#define RTIOC_TYPE_TESTING		RTDM_CLASS_TESTING
+#define FPGA_CONFIG	\
+	_IOW(RTIOC_TYPE_TESTING, 0x00, struct fpga_rw_data)
+#define FPGA_READ_WORD	\
+	_IOR(RTIOC_TYPE_TESTING, 0x01, struct fpga_rw_data)
+#define FPGA_WRITE_WORD	\
+	_IOW(RTIOC_TYPE_TESTING, 0x02, struct fpga_rw_data)
+#define FPGA_SET_TIMEOUT	\
+	_IOW(RTIOC_TYPE_TESTING, 0x03, struct fpga_rw_data)
+#define FPGA_GET_CYCLES_MISSED	\
+	_IOR(RTIOC_TYPE_TESTING, 0x04, struct fpga_rw_data)
+
+struct fpga_rw_data {
+	unsigned int offset;
+	unsigned short value;
+	unsigned int count;
+	unsigned int write_offset;
+	unsigned int write_count;
+	unsigned int timeout;
+	int cycles_missed;
+};
+
+#endif
ksrc/drivers/mpc5200_dma/rt_mpc52xx_lpbfifo.c new file +569 -0

569 lines not on this page · raw message

scripts/Modules.frag +2 -1
index d5e2ca4..24ad34a 100644
@@ -21,4 +21,5 @@ DRIVERS-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_PCI) += drivers/xenomai/can/sja10
 DRIVERS-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_DNG) += drivers/xenomai/can/sja1000/xeno_can_peak_dng.o
 DRIVERS-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_IXXAT_PCI) += drivers/xenomai/can/sja1000/xeno_can_ixxat_pci.o
 DRIVERS-$(CONFIG_XENO_DRIVERS_CAN_SJA1000_EMS_PCI) += drivers/xenomai/can/sja1000/xeno_can_ems_pci.o
-
+DRIVERS-$(CONFIG_XENO_DRIVERS_MPC5200_DMA) += drivers/xenomai/mpc5200_dma/rt-fpga.o
+DRIVERS-$(CONFIG_XENO_DRIVERS_MPC5200_DMA) += drivers/xenomai/mpc5200_dma/rt_mpc52xx_lpbfifo.o
Signature · 1 line
1.8.0
#1 lore raw
Quoted 8 lines · On 2012-11-21 08:10, [email protected] wrote:

From: Stefan Roese <[email protected]>

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

Quoted 7 lines

The lpb-fifo driver is ported from the Linux kernel lpb-fifo driver:

arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c

With all locking etc changed from Linux call to Xenomai/RTDM calls.

How do the two interact? Also, I think separate patches are be better.

I'm only looking at the interface so far, but as they are undocumented, it's a bit tricky to analyze them. Can you add some documentation to generic interfaces at least?

...

Quoted 31 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +25 -0
new file mode 100644
index 0000000..70f1827
@@ -0,0 +1,694 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/uaccess.h>
+#include <linux/dma-mapping.h>

ksrc/drivers/mpc5200_dma/rt-fpga.c line 35

Quoted 10 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +10 -0
+#include <asm/mpc52xx.h>
+
+/* Xenomai headers */
+#include <native/timer.h>
+#include <rtdm/rtdm_driver.h>
+
+#include "rt-fpga.h"
+
+extern int rt_mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
+extern void rt_mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);

Err, no. These two functions define the interface of the lpbfifo? Then they belong into a header file.

...

ksrc/drivers/mpc5200_dma/rt-fpga.h

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +0 -0
new file mode 100644
index 0000000..f25cf2e

Wrong place for a user header -> include/rtdm.

ksrc/drivers/mpc5200_dma/rt-fpga.h line 2

Quoted 3 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +2 -0
@@ -0,0 +1,35 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support

Does this driver depend on a specific programming of that FPGA?

ksrc/drivers/mpc5200_dma/rt-fpga.h line 13

Quoted 11 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +11 -0
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ */
+
+#ifndef _RT_FPGA_H
+#define _RT_FPGA_H
+
+/*
+ * IOCTL's for this FPGA driver
+ */
+#define RTIOC_TYPE_TESTING		RTDM_CLASS_TESTING

RTIOC_CLASS_TESTING is for devices that support unit tests etc. Is this a unit test? Where is the user space counter part?

If it's not a test case, we should probably define RTDM_CLASS_CUSTOM and use that instead.

Quoted 10 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +10 -0
+#define FPGA_CONFIG	\
+	_IOW(RTIOC_TYPE_TESTING, 0x00, struct fpga_rw_data)
+#define FPGA_READ_WORD	\
+	_IOR(RTIOC_TYPE_TESTING, 0x01, struct fpga_rw_data)
+#define FPGA_WRITE_WORD	\
+	_IOW(RTIOC_TYPE_TESTING, 0x02, struct fpga_rw_data)
+#define FPGA_SET_TIMEOUT	\
+	_IOW(RTIOC_TYPE_TESTING, 0x03, struct fpga_rw_data)
+#define FPGA_GET_CYCLES_MISSED	\
+	_IOR(RTIOC_TYPE_TESTING, 0x04, struct fpga_rw_data)

ksrc/drivers/mpc5200_dma/rt-fpga.h line 33

Quoted 10 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +10 -0
+
+struct fpga_rw_data {
+	unsigned int offset;
+	unsigned short value;
+	unsigned int count;
+	unsigned int write_offset;
+	unsigned int write_count;
+	unsigned int timeout;
+	int cycles_missed;
+};

BTW, using a single data structure for all IOCTLs is a bit ugly. I doubt all fields have a meaning in all calls, do they?

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20121121/68017a32/attachment.pgp>

#2 lore raw

Hi Jan,

Quoted 12 lines · Jan Kiszka
Quoted 11 lines · On 2012-11-21 08:10, [email protected] wrote:

From: Stefan Roese <[email protected]>

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

The lpb-fifo driver is ported from the Linux kernel lpb-fifo driver:

Quoted 6 lines
Quoted 4 lines

arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c

With all locking etc changed from Linux call to Xenomai/RTDM calls.

How do the two interact? Also, I think separate patches are be better.

The FPGA RTDM driver calls the lpbfifo driver via the rt_mpc52xx_lpbfifo_submit() function.

Okay, I can split this into 2 patches in the next version.

Quoted 3 lines

I'm only looking at the interface so far, but as they are undocumented, it's a bit tricky to analyze them. Can you add some documentation to generic interfaces at least?

I can add the API for the userspace as well. This would make things clearer. Where should I put such a userspace application in the tree?

Quoted 38 lines

...

Quoted 36 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +30 -0
new file mode 100644
index 0000000..70f1827
@@ -0,0 +1,694 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/uaccess.h>
+#include <linux/dma-mapping.h>
+#include <asm/mpc52xx.h>
+
+/* Xenomai headers */
+#include <native/timer.h>
+#include <rtdm/rtdm_driver.h>
Quoted 8 lines

ksrc/drivers/mpc5200_dma/rt-fpga.c line 35

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +5 -0
+
+#include "rt-fpga.h"
+
+extern int rt_mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
+extern void rt_mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);

Err, no. These two functions define the interface of the lpbfifo? Then they belong into a header file.

Right. Will move those declarations.

Quoted 9 lines

...

ksrc/drivers/mpc5200_dma/rt-fpga.h

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +0 -0
new file mode 100644
index 0000000..f25cf2e

Wrong place for a user header -> include/rtdm.

Okay.

Quoted 5 lines

ksrc/drivers/mpc5200_dma/rt-fpga.h line 2

Quoted 3 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +2 -0
@@ -0,0 +1,35 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support

Does this driver depend on a specific programming of that FPGA?

Yes. As mentioned in the commit text, this is a specific custom design with a "specific" FPGA image. Not really usable for most Xenomai developers/users as is. But I think it might be a good example on how to implement such a thing. And implementing the RT DMA framework for the MPC5200.

Quoted 15 lines

ksrc/drivers/mpc5200_dma/rt-fpga.h line 13

Quoted 11 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +11 -0
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ */
+
+#ifndef _RT_FPGA_H
+#define _RT_FPGA_H
+
+/*
+ * IOCTL's for this FPGA driver
+ */
+#define RTIOC_TYPE_TESTING		RTDM_CLASS_TESTING

RTIOC_CLASS_TESTING is for devices that support unit tests etc. Is this a unit test? Where is the user space counter part?

Quoted 2 lines

If it's not a test case, we should probably define RTDM_CLASS_CUSTOM and use that instead.

Good. I'll move to RTDM_CLASS_CUSTOM instead.

Quoted 15 lines
Quoted 15 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +15 -0
+#define FPGA_CONFIG	\
+	_IOW(RTIOC_TYPE_TESTING, 0x00, struct fpga_rw_data)
+#define FPGA_READ_WORD	\
+	_IOR(RTIOC_TYPE_TESTING, 0x01, struct fpga_rw_data)
+#define FPGA_WRITE_WORD	\
+	_IOW(RTIOC_TYPE_TESTING, 0x02, struct fpga_rw_data)
+#define FPGA_SET_TIMEOUT	\
+	_IOW(RTIOC_TYPE_TESTING, 0x03, struct fpga_rw_data)
+#define FPGA_GET_CYCLES_MISSED	\
+	_IOR(RTIOC_TYPE_TESTING, 0x04, struct fpga_rw_data)
+
+struct fpga_rw_data {
+	unsigned int offset;
+	unsigned short value;
+	unsigned int count;
Quoted 8 lines

ksrc/drivers/mpc5200_dma/rt-fpga.h line 33

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +5 -0
+	unsigned int write_offset;
+	unsigned int write_count;
+	unsigned int timeout;
+	int cycles_missed;
+};

BTW, using a single data structure for all IOCTLs is a bit ugly. I doubt all fields have a meaning in all calls, do they?

No, they don't. I just didn't want to "pollute" this driver with n data structures. But I have no strong feelings here. If thats the preferred way, I'll change it to multiple structures.

Thanks,
Stefan

#3 lore raw

Hi Stefan,

Quoted 25 lines · Stefan Roese

Hi Jan,

Quoted 12 lines · Jan Kiszka
Quoted 11 lines · On 2012-11-21 08:10, [email protected] wrote:

From: Stefan Roese <[email protected]>

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

The lpb-fifo driver is ported from the Linux kernel lpb-fifo driver:

Quoted 6 lines
Quoted 4 lines

arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c

With all locking etc changed from Linux call to Xenomai/RTDM calls.

How do the two interact? Also, I think separate patches are be better.

The FPGA RTDM driver calls the lpbfifo driver via the rt_mpc52xx_lpbfifo_submit() function.

Quoted 8 lines

Okay, I can split this into 2 patches in the next version.

Quoted 3 lines

I'm only looking at the interface so far, but as they are undocumented, it's a bit tricky to analyze them. Can you add some documentation to generic interfaces at least?

I can add the API for the userspace as well. This would make things clearer. Where should I put such a userspace application in the tree?

I'm unsure about putting it into tree at all, see below.

Quoted 68 lines
Quoted 39 lines

...

Quoted 36 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +30 -0
new file mode 100644
index 0000000..70f1827
@@ -0,0 +1,694 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support
+ *
+ *  Copyright (C) 2012 Stefan Roese <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/uaccess.h>
+#include <linux/dma-mapping.h>
+#include <asm/mpc52xx.h>
+
+/* Xenomai headers */
+#include <native/timer.h>
+#include <rtdm/rtdm_driver.h>
Quoted 8 lines

ksrc/drivers/mpc5200_dma/rt-fpga.c line 35

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.c new file +5 -0
+
+#include "rt-fpga.h"
+
+extern int rt_mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
+extern void rt_mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);

Err, no. These two functions define the interface of the lpbfifo? Then they belong into a header file.

Right. Will move those declarations.

Quoted 9 lines

...

ksrc/drivers/mpc5200_dma/rt-fpga.h

Quoted 5 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +0 -0
new file mode 100644
index 0000000..f25cf2e

Wrong place for a user header -> include/rtdm.

Okay.

Quoted 5 lines

ksrc/drivers/mpc5200_dma/rt-fpga.h line 2

Quoted 3 lines
ksrc/drivers/mpc5200_dma/rt-fpga.h new file +2 -0
@@ -0,0 +1,35 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support

Does this driver depend on a specific programming of that FPGA?

Quoted 5 lines

Yes. As mentioned in the commit text, this is a specific custom design with a "specific" FPGA image. Not really usable for most Xenomai developers/users as is. But I think it might be a good example on how to implement such a thing. And implementing the RT DMA framework for the MPC5200.

So, basically no one will be able to run your special test case. Is there any other use case, even an artificial one, for DMA on the MPC5200 that can be run without the special FPGA setup? Otherwise, it might be more helpful to provide a very basic example for the RT DMA API usage as pseudo code.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20121122/0d487dcd/attachment.pgp>

#4 lore raw

Hi Jan,

On 11/22/2012 08:58 PM, Jan Kiszka wrote:

<big snip>

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Review line 2

Quoted 3 lines
(quoted diff) +2 -0
@@ -0,0 +1,35 @@
+/*
+ *  Xenomai RTDM device driver for A3M071 FPGA with interrupt support

Does this driver depend on a specific programming of that FPGA?

Quoted 7 lines
Quoted 5 lines

Yes. As mentioned in the commit text, this is a specific custom design with a "specific" FPGA image. Not really usable for most Xenomai developers/users as is. But I think it might be a good example on how to implement such a thing. And implementing the RT DMA framework for the MPC5200.

So, basically no one will be able to run your special test case.

That is not entirely correct. This driver will run on the board with this special FPGA of course (a3m071, mpc5200 based). Linux mainline support is also pending for it (will most likely hit v3.8).

Quoted 5 lines

Is
there any other use case, even an artificial one, for DMA on the MPC5200 that can be run without the special FPGA setup? Otherwise, it might be more helpful to provide a very basic example for the RT DMA API usage as pseudo code.

I always find a real-world example better than "pseudo code". Even if it can't be used as-is in the most systems. Such a real-world RTDM device driver is proven to be working (not only compile tested).

Anyways, I'm going to send a new patch version today. You (and/or others) may decide if its worth adding this driver in the xenomai code base. Again, it has often proven to be good to include special cases from my point of view. Others can only benefit from it.

Thanks,
Stefan

#5 lore raw
In reply to [email protected]

Dear Stefan,

Quoted 6 lines · In message <[email protected]> you wrote:

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

...

ksrc/drivers/mpc5200_dma/Config.in line 2

Quoted 5 lines
ksrc/drivers/mpc5200_dma/Config.in new file +2 -0
@@ -0,0 +1,10 @@
+#
+# Xenomai configuration for Linux v2.4

Linux v2.4 ???

I am pretty sure this driver will not run with a 2.4 Linux kenrel...

ksrc/drivers/mpc5200_dma/Config.in

Quoted 9 lines
ksrc/drivers/mpc5200_dma/Config.in new file +9 -0
+#define dbg(format, arg...)						\
+	printk("%s (%d): " format, __func__, __LINE__, ##arg)
+#else
+#define dbg(format, arg...)						\
+do {									\
+	if (0)								\
+		printk("%s (%d): " format, __func__, __LINE__, ##arg);	\
+} while (0)
+#endif

Why do you define your own (incomaptible to everything else) debug facilities? Can you not rather use the existing kernel debug macros?

Quoted 1 line

+#ifdef PRINT_READ_TIME

I see no translation happening anywhere between PRINT_READ_TIME and CONFIG_XENO_DRIVERS_MPC5200_DMA_PRINT_READ_TIME - am I missing something?

Quoted 1 line

+#ifdef NO_DMA

Ditto for NO_DMA versus CONFIG_XENO_DRIVERS_MPC5200_DMA_NO_DMA ?

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
"Evil does seek to maintain power by suppressing the truth."
"Or by misleading the innocent."
	-- Spock and McCoy, "And The Children Shall Lead",
	   stardate 5029.5.
#6 lore raw

Hi Wolfgang,

Quoted 16 lines · Wolfgang Denk
Quoted 6 lines · In message <[email protected]> you wrote:

This patch adds support for the RTDM LPB (LocalPlusBus) FIFO driver for the MPC5200. It will be used for DMA support in an RTDM FPGA device driver. This rt-fpga.c driver is a custom device driver, but might be useful for other developers as well. Thats why I included it here too.

...

ksrc/drivers/mpc5200_dma/Config.in line 2

Quoted 5 lines
ksrc/drivers/mpc5200_dma/Config.in new file +2 -0
@@ -0,0 +1,10 @@
+#
+# Xenomai configuration for Linux v2.4

Linux v2.4 ???

Quoted 1 line

I am pretty sure this driver will not run with a 2.4 Linux kenrel...

Yes. I just put it in since all drivers in ksrc had it as well. Will remove in the next version.

Quoted 5 lines
Quoted 5 lines
ksrc/drivers/mpc5200_dma/Config.in new file +5 -0
+#define dbg(format, arg...)						\
+	printk("%s (%d): " format, __func__, __LINE__, ##arg)
+#else
+#define dbg(format, arg...)						\
+do {									\
Quoted 8 lines

ksrc/drivers/mpc5200_dma/Config.in

Quoted 4 lines
ksrc/drivers/mpc5200_dma/Config.in new file +4 -0
+	if (0)								\
+		printk("%s (%d): " format, __func__, __LINE__, ##arg);	\
+} while (0)
+#endif

Why do you define your own (incomaptible to everything else) debug facilities? Can you not rather use the existing kernel debug macros?

I'll move to a common kernel debug function/macro in the next patch version.

Quoted 9 lines
Quoted 1 line

+#ifdef PRINT_READ_TIME

I see no translation happening anywhere between PRINT_READ_TIME and CONFIG_XENO_DRIVERS_MPC5200_DMA_PRINT_READ_TIME - am I missing something?

Quoted 1 line

+#ifdef NO_DMA

Ditto for NO_DMA versus CONFIG_XENO_DRIVERS_MPC5200_DMA_NO_DMA ?

Good catch. I forgot to switch all occurrences of these defines. Will fix in next version.

Thanks,
Stefan