diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2011-03-23 19:43:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:41 -0400 |
commit | f8f0626989c85b3d8bd67eff29d9dd3d14a5e71f (patch) | |
tree | 1132c3ca38b6f68c00864df0ded229c45230d4c5 /arch/powerpc/sysdev/fsl_rio.c | |
parent | e15b4d687f3015aa7953687e5a80f1cc4ba9b736 (diff) |
rapidio: add architecture specific callbacks
This set of patches eliminates RapidIO dependency on PowerPC architecture
and makes it available to other architectures (x86 and MIPS). It also
enables support of new platform independent RapidIO controllers such as
PCI-to-SRIO and PCI Express-to-SRIO.
This patch:
Extend number of mport callback functions to eliminate direct linking of
architecture specific mport operations.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/sysdev/fsl_rio.c')
-rw-r--r-- | arch/powerpc/sysdev/fsl_rio.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 3eff2c3a9ad5..f95cb5636d19 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -482,7 +482,7 @@ fsl_rio_config_write(struct rio_mport *mport, int index, u16 destid, | |||
482 | } | 482 | } |
483 | 483 | ||
484 | /** | 484 | /** |
485 | * rio_hw_add_outb_message - Add message to the MPC85xx outbound message queue | 485 | * fsl_add_outb_message - Add message to the MPC85xx outbound message queue |
486 | * @mport: Master port with outbound message queue | 486 | * @mport: Master port with outbound message queue |
487 | * @rdev: Target of outbound message | 487 | * @rdev: Target of outbound message |
488 | * @mbox: Outbound mailbox | 488 | * @mbox: Outbound mailbox |
@@ -492,8 +492,8 @@ fsl_rio_config_write(struct rio_mport *mport, int index, u16 destid, | |||
492 | * Adds the @buffer message to the MPC85xx outbound message queue. Returns | 492 | * Adds the @buffer message to the MPC85xx outbound message queue. Returns |
493 | * %0 on success or %-EINVAL on failure. | 493 | * %0 on success or %-EINVAL on failure. |
494 | */ | 494 | */ |
495 | int | 495 | static int |
496 | rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, | 496 | fsl_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, |
497 | void *buffer, size_t len) | 497 | void *buffer, size_t len) |
498 | { | 498 | { |
499 | struct rio_priv *priv = mport->priv; | 499 | struct rio_priv *priv = mport->priv; |
@@ -502,9 +502,8 @@ rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, | |||
502 | + priv->msg_tx_ring.tx_slot; | 502 | + priv->msg_tx_ring.tx_slot; |
503 | int ret = 0; | 503 | int ret = 0; |
504 | 504 | ||
505 | pr_debug | 505 | pr_debug("RIO: fsl_add_outb_message(): destid %4.4x mbox %d buffer " \ |
506 | ("RIO: rio_hw_add_outb_message(): destid %4.4x mbox %d buffer %8.8x len %8.8x\n", | 506 | "%8.8x len %8.8x\n", rdev->destid, mbox, (int)buffer, len); |
507 | rdev->destid, mbox, (int)buffer, len); | ||
508 | 507 | ||
509 | if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) { | 508 | if ((len < 8) || (len > RIO_MAX_MSG_SIZE)) { |
510 | ret = -EINVAL; | 509 | ret = -EINVAL; |
@@ -554,8 +553,6 @@ rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox, | |||
554 | return ret; | 553 | return ret; |
555 | } | 554 | } |
556 | 555 | ||
557 | EXPORT_SYMBOL_GPL(rio_hw_add_outb_message); | ||
558 | |||
559 | /** | 556 | /** |
560 | * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler | 557 | * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler |
561 | * @irq: Linux interrupt number | 558 | * @irq: Linux interrupt number |
@@ -600,7 +597,7 @@ fsl_rio_tx_handler(int irq, void *dev_instance) | |||
600 | } | 597 | } |
601 | 598 | ||
602 | /** | 599 | /** |
603 | * rio_open_outb_mbox - Initialize MPC85xx outbound mailbox | 600 | * fsl_open_outb_mbox - Initialize MPC85xx outbound mailbox |
604 | * @mport: Master port implementing the outbound message unit | 601 | * @mport: Master port implementing the outbound message unit |
605 | * @dev_id: Device specific pointer to pass on event | 602 | * @dev_id: Device specific pointer to pass on event |
606 | * @mbox: Mailbox to open | 603 | * @mbox: Mailbox to open |
@@ -610,7 +607,8 @@ fsl_rio_tx_handler(int irq, void *dev_instance) | |||
610 | * and enables the outbound message unit. Returns %0 on success and | 607 | * and enables the outbound message unit. Returns %0 on success and |
611 | * %-EINVAL or %-ENOMEM on failure. | 608 | * %-EINVAL or %-ENOMEM on failure. |
612 | */ | 609 | */ |
613 | int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) | 610 | static int |
611 | fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) | ||
614 | { | 612 | { |
615 | int i, j, rc = 0; | 613 | int i, j, rc = 0; |
616 | struct rio_priv *priv = mport->priv; | 614 | struct rio_priv *priv = mport->priv; |
@@ -706,14 +704,14 @@ int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entr | |||
706 | } | 704 | } |
707 | 705 | ||
708 | /** | 706 | /** |
709 | * rio_close_outb_mbox - Shut down MPC85xx outbound mailbox | 707 | * fsl_close_outb_mbox - Shut down MPC85xx outbound mailbox |
710 | * @mport: Master port implementing the outbound message unit | 708 | * @mport: Master port implementing the outbound message unit |
711 | * @mbox: Mailbox to close | 709 | * @mbox: Mailbox to close |
712 | * | 710 | * |
713 | * Disables the outbound message unit, free all buffers, and | 711 | * Disables the outbound message unit, free all buffers, and |
714 | * frees the outbound message interrupt. | 712 | * frees the outbound message interrupt. |
715 | */ | 713 | */ |
716 | void rio_close_outb_mbox(struct rio_mport *mport, int mbox) | 714 | static void fsl_close_outb_mbox(struct rio_mport *mport, int mbox) |
717 | { | 715 | { |
718 | struct rio_priv *priv = mport->priv; | 716 | struct rio_priv *priv = mport->priv; |
719 | /* Disable inbound message unit */ | 717 | /* Disable inbound message unit */ |
@@ -770,7 +768,7 @@ fsl_rio_rx_handler(int irq, void *dev_instance) | |||
770 | } | 768 | } |
771 | 769 | ||
772 | /** | 770 | /** |
773 | * rio_open_inb_mbox - Initialize MPC85xx inbound mailbox | 771 | * fsl_open_inb_mbox - Initialize MPC85xx inbound mailbox |
774 | * @mport: Master port implementing the inbound message unit | 772 | * @mport: Master port implementing the inbound message unit |
775 | * @dev_id: Device specific pointer to pass on event | 773 | * @dev_id: Device specific pointer to pass on event |
776 | * @mbox: Mailbox to open | 774 | * @mbox: Mailbox to open |
@@ -780,7 +778,8 @@ fsl_rio_rx_handler(int irq, void *dev_instance) | |||
780 | * and enables the inbound message unit. Returns %0 on success | 778 | * and enables the inbound message unit. Returns %0 on success |
781 | * and %-EINVAL or %-ENOMEM on failure. | 779 | * and %-EINVAL or %-ENOMEM on failure. |
782 | */ | 780 | */ |
783 | int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) | 781 | static int |
782 | fsl_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) | ||
784 | { | 783 | { |
785 | int i, rc = 0; | 784 | int i, rc = 0; |
786 | struct rio_priv *priv = mport->priv; | 785 | struct rio_priv *priv = mport->priv; |
@@ -844,14 +843,14 @@ int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entri | |||
844 | } | 843 | } |
845 | 844 | ||
846 | /** | 845 | /** |
847 | * rio_close_inb_mbox - Shut down MPC85xx inbound mailbox | 846 | * fsl_close_inb_mbox - Shut down MPC85xx inbound mailbox |
848 | * @mport: Master port implementing the inbound message unit | 847 | * @mport: Master port implementing the inbound message unit |
849 | * @mbox: Mailbox to close | 848 | * @mbox: Mailbox to close |
850 | * | 849 | * |
851 | * Disables the inbound message unit, free all buffers, and | 850 | * Disables the inbound message unit, free all buffers, and |
852 | * frees the inbound message interrupt. | 851 | * frees the inbound message interrupt. |
853 | */ | 852 | */ |
854 | void rio_close_inb_mbox(struct rio_mport *mport, int mbox) | 853 | static void fsl_close_inb_mbox(struct rio_mport *mport, int mbox) |
855 | { | 854 | { |
856 | struct rio_priv *priv = mport->priv; | 855 | struct rio_priv *priv = mport->priv; |
857 | /* Disable inbound message unit */ | 856 | /* Disable inbound message unit */ |
@@ -866,7 +865,7 @@ void rio_close_inb_mbox(struct rio_mport *mport, int mbox) | |||
866 | } | 865 | } |
867 | 866 | ||
868 | /** | 867 | /** |
869 | * rio_hw_add_inb_buffer - Add buffer to the MPC85xx inbound message queue | 868 | * fsl_add_inb_buffer - Add buffer to the MPC85xx inbound message queue |
870 | * @mport: Master port implementing the inbound message unit | 869 | * @mport: Master port implementing the inbound message unit |
871 | * @mbox: Inbound mailbox number | 870 | * @mbox: Inbound mailbox number |
872 | * @buf: Buffer to add to inbound queue | 871 | * @buf: Buffer to add to inbound queue |
@@ -874,12 +873,12 @@ void rio_close_inb_mbox(struct rio_mport *mport, int mbox) | |||
874 | * Adds the @buf buffer to the MPC85xx inbound message queue. Returns | 873 | * Adds the @buf buffer to the MPC85xx inbound message queue. Returns |
875 | * %0 on success or %-EINVAL on failure. | 874 | * %0 on success or %-EINVAL on failure. |
876 | */ | 875 | */ |
877 | int rio_hw_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf) | 876 | static int fsl_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf) |
878 | { | 877 | { |
879 | int rc = 0; | 878 | int rc = 0; |
880 | struct rio_priv *priv = mport->priv; | 879 | struct rio_priv *priv = mport->priv; |
881 | 880 | ||
882 | pr_debug("RIO: rio_hw_add_inb_buffer(), msg_rx_ring.rx_slot %d\n", | 881 | pr_debug("RIO: fsl_add_inb_buffer(), msg_rx_ring.rx_slot %d\n", |
883 | priv->msg_rx_ring.rx_slot); | 882 | priv->msg_rx_ring.rx_slot); |
884 | 883 | ||
885 | if (priv->msg_rx_ring.virt_buffer[priv->msg_rx_ring.rx_slot]) { | 884 | if (priv->msg_rx_ring.virt_buffer[priv->msg_rx_ring.rx_slot]) { |
@@ -898,17 +897,15 @@ int rio_hw_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf) | |||
898 | return rc; | 897 | return rc; |
899 | } | 898 | } |
900 | 899 | ||
901 | EXPORT_SYMBOL_GPL(rio_hw_add_inb_buffer); | ||
902 | |||
903 | /** | 900 | /** |
904 | * rio_hw_get_inb_message - Fetch inbound message from the MPC85xx message unit | 901 | * fsl_get_inb_message - Fetch inbound message from the MPC85xx message unit |
905 | * @mport: Master port implementing the inbound message unit | 902 | * @mport: Master port implementing the inbound message unit |
906 | * @mbox: Inbound mailbox number | 903 | * @mbox: Inbound mailbox number |
907 | * | 904 | * |
908 | * Gets the next available inbound message from the inbound message queue. | 905 | * Gets the next available inbound message from the inbound message queue. |
909 | * A pointer to the message is returned on success or NULL on failure. | 906 | * A pointer to the message is returned on success or NULL on failure. |
910 | */ | 907 | */ |
911 | void *rio_hw_get_inb_message(struct rio_mport *mport, int mbox) | 908 | static void *fsl_get_inb_message(struct rio_mport *mport, int mbox) |
912 | { | 909 | { |
913 | struct rio_priv *priv = mport->priv; | 910 | struct rio_priv *priv = mport->priv; |
914 | u32 phys_buf, virt_buf; | 911 | u32 phys_buf, virt_buf; |
@@ -945,8 +942,6 @@ void *rio_hw_get_inb_message(struct rio_mport *mport, int mbox) | |||
945 | return buf; | 942 | return buf; |
946 | } | 943 | } |
947 | 944 | ||
948 | EXPORT_SYMBOL_GPL(rio_hw_get_inb_message); | ||
949 | |||
950 | /** | 945 | /** |
951 | * fsl_rio_dbell_handler - MPC85xx doorbell interrupt handler | 946 | * fsl_rio_dbell_handler - MPC85xx doorbell interrupt handler |
952 | * @irq: Linux interrupt number | 947 | * @irq: Linux interrupt number |
@@ -1431,6 +1426,13 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1431 | ops->cwrite = fsl_rio_config_write; | 1426 | ops->cwrite = fsl_rio_config_write; |
1432 | ops->dsend = fsl_rio_doorbell_send; | 1427 | ops->dsend = fsl_rio_doorbell_send; |
1433 | ops->pwenable = fsl_rio_pw_enable; | 1428 | ops->pwenable = fsl_rio_pw_enable; |
1429 | ops->open_outb_mbox = fsl_open_outb_mbox; | ||
1430 | ops->open_inb_mbox = fsl_open_inb_mbox; | ||
1431 | ops->close_outb_mbox = fsl_close_outb_mbox; | ||
1432 | ops->close_inb_mbox = fsl_close_inb_mbox; | ||
1433 | ops->add_outb_message = fsl_add_outb_message; | ||
1434 | ops->add_inb_buffer = fsl_add_inb_buffer; | ||
1435 | ops->get_inb_message = fsl_get_inb_message; | ||
1434 | 1436 | ||
1435 | port = kzalloc(sizeof(struct rio_mport), GFP_KERNEL); | 1437 | port = kzalloc(sizeof(struct rio_mport), GFP_KERNEL); |
1436 | if (!port) { | 1438 | if (!port) { |