rapidio: rework device hierarchy and introduce mport class of devices

This patch removes an artificial RapidIO bus root device and establishes
actual device hierarchy by providing reference to real parent devices.
It also introduces device class for RapidIO controller devices (on-chip
or an eternal bridge, known as "mport").

Existing implementation was sufficient for SoC-based platforms that have
a single RapidIO controller.  With introduction of devices using
multiple RapidIO controllers and PCIe-to-RapidIO bridges the old scheme
is very limiting or does not work at all.  The implemented changes allow
to properly reference platform's local RapidIO mport devices and provide
device details needed for upper layers.

This change to RapidIO device hierarchy does not break any known
existing kernel or user space interfaces.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Stef van Os <stef.van.os@prodrive-technologies.com>
Cc: Jerry Jacobs <jerry.jacobs@prodrive-technologies.com>
Cc: Arno Tiemersma <arno.tiemersma@prodrive-technologies.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Este commit está contenido en:
Alexandre Bounine
2014-04-07 15:38:56 -07:00
cometido por Linus Torvalds
padre 40f847baf5
commit 2aaf308b95
Se han modificado 10 ficheros con 133 adiciones y 16 borrados

Ver fichero

@@ -341,3 +341,43 @@ const struct attribute_group *rio_bus_groups[] = {
&rio_bus_group,
NULL,
};
static ssize_t
port_destid_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct rio_mport *mport = to_rio_mport(dev);
if (mport)
return sprintf(buf, "0x%04x\n", mport->host_deviceid);
else
return -ENODEV;
}
static DEVICE_ATTR_RO(port_destid);
static ssize_t sys_size_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct rio_mport *mport = to_rio_mport(dev);
if (mport)
return sprintf(buf, "%u\n", mport->sys_size);
else
return -ENODEV;
}
static DEVICE_ATTR_RO(sys_size);
static struct attribute *rio_mport_attrs[] = {
&dev_attr_port_destid.attr,
&dev_attr_sys_size.attr,
NULL,
};
static const struct attribute_group rio_mport_group = {
.attrs = rio_mport_attrs,
};
const struct attribute_group *rio_mport_groups[] = {
&rio_mport_group,
NULL,
};