[PATCH 5/7] rapidio: add modular build option for the subsystem core

2013-06-28 Thread Alexandre Bounine
Add a configuration option to build RapidIO subsystem core code as a loadable
kernel module. Currently this option is available only for x86-based platforms,
with the additional patch for PowerPC planned to be provided later.

This patch replaces kernel command line parameter "riohdid=" with its
module-specific analog "rapidio.hdid=".  

Signed-off-by: Alexandre Bounine 
Cc: Matt Porter 
Cc: Li Yang 
Cc: Kumar Gala 
Cc: Andre van Herk 
Cc: Micha Nelissen 
Cc: Stef van Os 
Cc: Jean Delvare 
---
 arch/x86/Kconfig |4 ++--
 drivers/rapidio/Makefile |4 +++-
 drivers/rapidio/rio.c|   27 ++-
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fe120da..583ac42 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2246,11 +2246,11 @@ source "drivers/pcmcia/Kconfig"
 source "drivers/pci/hotplug/Kconfig"
 
 config RAPIDIO
-   bool "RapidIO support"
+   tristate "RapidIO support"
depends on PCI
default n
help
- If you say Y here, the kernel will include drivers and
+ If enabled this option will include drivers and the core
  infrastructure code to support RapidIO interconnect devices.
 
 source "drivers/rapidio/Kconfig"
diff --git a/drivers/rapidio/Makefile b/drivers/rapidio/Makefile
index 3036702..6271ada 100644
--- a/drivers/rapidio/Makefile
+++ b/drivers/rapidio/Makefile
@@ -1,7 +1,9 @@
 #
 # Makefile for RapidIO interconnect services
 #
-obj-y += rio.o rio-access.o rio-driver.o rio-sysfs.o
+obj-$(CONFIG_RAPIDIO) += rapidio.o
+rapidio-y := rio.o rio-access.o rio-driver.o rio-sysfs.o
+
 obj-$(CONFIG_RAPIDIO_ENUM_BASIC) += rio-scan.o
 
 obj-$(CONFIG_RAPIDIO)  += switches/
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 2054b62..f4f30af 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -5,7 +5,7 @@
  * Copyright 2005 MontaVista Software, Inc.
  * Matt Porter 
  *
- * Copyright 2009 Integrated Device Technology, Inc.
+ * Copyright 2009 - 2013 Integrated Device Technology, Inc.
  * Alex Bounine 
  *
  * This program is free software; you can redistribute  it and/or modify it
@@ -30,6 +30,17 @@
 
 #include "rio.h"
 
+MODULE_DESCRIPTION("RapidIO Subsystem Core");
+MODULE_AUTHOR("Matt Porter ");
+MODULE_AUTHOR("Alexandre Bounine ");
+MODULE_LICENSE("GPL");
+
+static int hdid[RIO_MAX_MPORTS];
+static int ids_num;
+module_param_array(hdid, int, &ids_num, 0);
+MODULE_PARM_DESC(hdid,
+   "Destination ID assignment to local RapidIO controllers");
+
 static LIST_HEAD(rio_devices);
 static DEFINE_SPINLOCK(rio_global_list_lock);
 
@@ -1860,24 +1871,14 @@ no_disc:
return 0;
 }
 
-static int hdids[RIO_MAX_MPORTS + 1];
-
 static int rio_get_hdid(int index)
 {
-   if (!hdids[0] || hdids[0] <= index || index >= RIO_MAX_MPORTS)
+   if (ids_num == 0 || ids_num <= index || index >= RIO_MAX_MPORTS)
return -1;
 
-   return hdids[index + 1];
+   return hdid[index];
 }
 
-static int rio_hdid_setup(char *str)
-{
-   (void)get_options(str, ARRAY_SIZE(hdids), hdids);
-   return 1;
-}
-
-__setup("riohdid=", rio_hdid_setup);
-
 int rio_register_mport(struct rio_mport *port)
 {
struct rio_scan_node *scan = NULL;
-- 
1.7.8.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 5/7] rapidio: add modular build option for the subsystem core

2013-07-26 Thread Jean Delvare
Hi Alexandre,

Le Friday 28 June 2013 à 15:18 -0400, Alexandre Bounine a écrit :
> Add a configuration option to build RapidIO subsystem core code as a loadable
> kernel module. Currently this option is available only for x86-based 
> platforms,
> with the additional patch for PowerPC planned to be provided later.
> 
> This patch replaces kernel command line parameter "riohdid=" with its
> module-specific analog "rapidio.hdid=".  
> 
> Signed-off-by: Alexandre Bounine 
> Cc: Matt Porter 
> Cc: Li Yang 
> Cc: Kumar Gala 
> Cc: Andre van Herk 
> Cc: Micha Nelissen 
> Cc: Stef van Os 
> Cc: Jean Delvare 
> ---
>  arch/x86/Kconfig |4 ++--
>  drivers/rapidio/Makefile |4 +++-
>  drivers/rapidio/rio.c|   27 ++-
>  3 files changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index fe120da..583ac42 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2246,11 +2246,11 @@ source "drivers/pcmcia/Kconfig"
>  source "drivers/pci/hotplug/Kconfig"
>  
>  config RAPIDIO
> - bool "RapidIO support"
> + tristate "RapidIO support"

Is there a reason why this was only done for x86 and not for mips and
powerpc?

>   depends on PCI
>   default n
>   help
> -   If you say Y here, the kernel will include drivers and
> +   If enabled this option will include drivers and the core
> infrastructure code to support RapidIO interconnect devices.
>  

-- 
Jean Delvare
Suse L3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: [PATCH 5/7] rapidio: add modular build option for the subsystem core

2013-07-26 Thread Bounine, Alexandre
Hi Jean,

> -Original Message-
> From: Jean Delvare [mailto:jdelv...@suse.de]
> Sent: Friday, July 26, 2013 7:01 AM

... skip 

> @@ -2246,11 +2246,11 @@ source "drivers/pcmcia/Kconfig"
> >  source "drivers/pci/hotplug/Kconfig"
> >
> >  config RAPIDIO
> > -   bool "RapidIO support"
> > +   tristate "RapidIO support"
> 
> Is there a reason why this was only done for x86 and not for mips and
> powerpc?
> 

I need to make a configuration patch for MIPS and PowerPC platforms that deals
with built-in RapidIO controllers available in some embedded SoCs.
For generic platforms with PCIe controllers 'tristate' changes similar to x86 
are good enough.
I think it was mentioned in PATCH 0/7 that we will have a follow-up patch a bit 
later.  

> > depends on PCI
> > default n
> > help
> > - If you say Y here, the kernel will include drivers and
> > + If enabled this option will include drivers and the core
> >   infrastructure code to support RapidIO interconnect devices.
> >
> 
> --
> Jean Delvare
> Suse L3

Alex.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev