aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2016-03-22 17:26:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-22 18:36:02 -0400
commit9a0b062742e7e039273c0c2ba4b96ad9ec7e7d8f (patch)
tree902e3fd63e79f4911b2896a67e8e06d93626abd4 /arch/powerpc/sysdev
parentb6cb95e8eb97e51a1a1b5609b59df859cc6dc2f2 (diff)
rapidio: add global inbound port write interfaces
Add new Port Write handler registration interfaces that attach PW handlers to local mport device objects. This is different from old interface that attaches PW callback to individual RapidIO device. The new interfaces are intended for use for common event handling (e.g. hot-plug notifications) while the old interface is available for individual device drivers. This patch is based on patch proposed by Andre van Herk but preserves existing per-device interface and adds lock protection for list handling. Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Aurelien Jacquiot <a-jacquiot@ti.com> Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c1
-rw-r--r--arch/powerpc/sysdev/fsl_rio.h1
-rw-r--r--arch/powerpc/sysdev/fsl_rmu.c16
3 files changed, 12 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 385371acc0d0..f5bf38b94595 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -726,6 +726,7 @@ int fsl_rio_setup(struct platform_device *dev)
726 fsl_rio_inbound_mem_init(priv); 726 fsl_rio_inbound_mem_init(priv);
727 727
728 dbell->mport[i] = port; 728 dbell->mport[i] = port;
729 pw->mport[i] = port;
729 730
730 if (rio_register_mport(port)) { 731 if (rio_register_mport(port)) {
731 release_resource(&port->iores); 732 release_resource(&port->iores);
diff --git a/arch/powerpc/sysdev/fsl_rio.h b/arch/powerpc/sysdev/fsl_rio.h
index d53407a34f32..12dd18fd4795 100644
--- a/arch/powerpc/sysdev/fsl_rio.h
+++ b/arch/powerpc/sysdev/fsl_rio.h
@@ -97,6 +97,7 @@ struct fsl_rio_dbell {
97}; 97};
98 98
99struct fsl_rio_pw { 99struct fsl_rio_pw {
100 struct rio_mport *mport[MAX_PORT_NUM];
100 struct device *dev; 101 struct device *dev;
101 struct rio_pw_regs __iomem *pw_regs; 102 struct rio_pw_regs __iomem *pw_regs;
102 struct rio_port_write_msg port_write_msg; 103 struct rio_port_write_msg port_write_msg;
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c
index ffe0ee832768..c1826de4e749 100644
--- a/arch/powerpc/sysdev/fsl_rmu.c
+++ b/arch/powerpc/sysdev/fsl_rmu.c
@@ -481,14 +481,14 @@ pw_done:
481static void fsl_pw_dpc(struct work_struct *work) 481static void fsl_pw_dpc(struct work_struct *work)
482{ 482{
483 struct fsl_rio_pw *pw = container_of(work, struct fsl_rio_pw, pw_work); 483 struct fsl_rio_pw *pw = container_of(work, struct fsl_rio_pw, pw_work);
484 u32 msg_buffer[RIO_PW_MSG_SIZE/sizeof(u32)]; 484 union rio_pw_msg msg_buffer;
485 int i;
485 486
486 /* 487 /*
487 * Process port-write messages 488 * Process port-write messages
488 */ 489 */
489 while (kfifo_out_spinlocked(&pw->pw_fifo, (unsigned char *)msg_buffer, 490 while (kfifo_out_spinlocked(&pw->pw_fifo, (unsigned char *)&msg_buffer,
490 RIO_PW_MSG_SIZE, &pw->pw_fifo_lock)) { 491 RIO_PW_MSG_SIZE, &pw->pw_fifo_lock)) {
491 /* Process one message */
492#ifdef DEBUG_PW 492#ifdef DEBUG_PW
493 { 493 {
494 u32 i; 494 u32 i;
@@ -496,15 +496,19 @@ static void fsl_pw_dpc(struct work_struct *work)
496 for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32); i++) { 496 for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32); i++) {
497 if ((i%4) == 0) 497 if ((i%4) == 0)
498 pr_debug("\n0x%02x: 0x%08x", i*4, 498 pr_debug("\n0x%02x: 0x%08x", i*4,
499 msg_buffer[i]); 499 msg_buffer.raw[i]);
500 else 500 else
501 pr_debug(" 0x%08x", msg_buffer[i]); 501 pr_debug(" 0x%08x", msg_buffer.raw[i]);
502 } 502 }
503 pr_debug("\n"); 503 pr_debug("\n");
504 } 504 }
505#endif 505#endif
506 /* Pass the port-write message to RIO core for processing */ 506 /* Pass the port-write message to RIO core for processing */
507 rio_inb_pwrite_handler((union rio_pw_msg *)msg_buffer); 507 for (i = 0; i < MAX_PORT_NUM; i++) {
508 if (pw->mport[i])
509 rio_inb_pwrite_handler(pw->mport[i],
510 &msg_buffer);
511 }
508 } 512 }
509} 513}
510 514