powerpc: add ps3 platform system bus support
Subsystems (2)
PATCH 13/14 powerpc: add ps3 platform system bus support
From: Geoff Levand <[email protected]>
Adds a PS3 system bus driver. This system bus is a virtual bus used to present the PS3 system devices in the LDM.
--- drivers/Makefile | 1 drivers/ps3/Makefile | 1 drivers/ps3/system-bus.c | 358 ++++++++++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/ps3.h | 73 +++++++++ 4 files changed, 433 insertions(+)
drivers/Makefile +1 -0
@@ -77,3 +77,4 @@ obj-$(CONFIG_SUPERH) += sh/ obj-$(CONFIG_GENERIC_TIME) += clocksource/ obj-$(CONFIG_DMA_ENGINE) += dma/ +obj-$(CONFIG_PS3) += ps3/
drivers/ps3/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += system-bus.o
drivers/ps3/system-bus.c new file +358 -0
358 lines not on this page · raw message
include/asm-powerpc/ps3.h +73 -0
77 lines not on this page · raw message
Quoted 2 lines · Geoff Levand
Adds a PS3 system bus driver. This system bus is a virtual bus used to present the PS3 system devices in the LDM.
What is the benefit of yet another bus?
Can those 3 drivers be platform devices instead? The generated modalias files do not match anything.
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Geoff Levand
Adds a PS3 system bus driver. This system bus is a virtual bus used to present the PS3 system devices in the LDM.
What is the benefit of yet another bus?
We need a bus to abstract the MMIO, DMA and interrupt specifics of the hypervisor.
Quoted 1 line
Can those 3 drivers be platform devices instead?
It is my understanding that the platform bus was made to support legacy code.
We plan to put all the devices on the system bus. That work is now in progress.
Quoted 1 line
The generated modalias files do not match anything.
Module support is still todo. I am just now started on it. David Woodhouse sent a few patches, but I just merged them in without testing.
-Geoff
Quoted 5 lines · Geoff Levand
Quoted 1 line
The generated modalias files do not match anything.
Module support is still todo. I am just now started on it. David Woodhouse sent a few patches, but I just merged them in without testing.
This is my version, compile tested.
ps3fb calls into ps3av.
ps3av can be a module, but it does not force ps3fb to be a module as well. Maybe this can be enforced via some Kconfig tweaks.
--- arch/powerpc/platforms/ps3/system-bus.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
arch/powerpc/platforms/ps3/system-bus.c +27 -3
@@ -167,6 +167,30 @@ static int ps3_system_bus_remove(structreturn 0 ; } +static const char *ps3_system_bus_modalias (enum ps3_match_id match_id) +{ +const char *p; +switch (match_id) { +case PS3_MATCH_ID_EHCI : + p ="ps3-ehci" ; +break ; +case PS3_MATCH_ID_OHCI : + p ="ps3-ohci" ; +break ; +case PS3_MATCH_ID_GELIC : + p ="gelic_net" ; +break ; +case PS3_MATCH_ID_AV_SETTINGS : + p ="ps3av" ; +break ; +case PS3_MATCH_ID_SYSTEM_MANAGER : +default : + p ="unknown" ; +break ; + } +return p; +} +static int ps3_system_bus_uevent (struct device *_dev,char **envp,int num_envp,char *buffer,int buffer_size) {
@@ -174,8 +198,8 @@ static int ps3_system_bus_uevent(structint i=0 , length =0 ;if (add_uevent_var (envp, num_envp, &i, buffer, buffer_size, - &length,"MODALIAS=ps3:%d" , - dev->match_id)) + &length,"MODALIAS=%s" , +ps3_system_bus_modalias (dev->match_id)))return -ENOMEM ; envp[i] =NULL ;
@@ -186,7 +210,7 @@ static ssize_t modalias_show(struct devi char *buf) {struct ps3_system_bus_device *dev =to_ps3_system_bus_device (_dev); -int len =snprintf (buf,PAGE_SIZE ,"ps3:%d\n" , dev->match_id); +int len =snprintf (buf,PAGE_SIZE ,"%s\n" ,ps3_system_bus_modalias (dev->match_id));return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; }
Quoted 9 lines · Olaf Hering
Quoted 5 lines · Geoff Levand
Quoted 1 line
The generated modalias files do not match anything.
Module support is still todo. I am just now started on it. David Woodhouse sent a few patches, but I just merged them in without testing.
This is my version, compile tested.
I have no particular objection to this, but would observe that it's more normal to have the number->name mapping done in userspace by modprobe, rather than inside the kernel.
For now I'd just added explicit aliases like 'MODULE_ALIAS("ps3:3");' to the modules in question, because I hadn't yet worked out how to do all the mod_devicetable stuff to pick it out of the match_id in the driver structure.
Signature · 1 line
dwmw2
Quoted 3 lines · David Woodhouse
I have no particular objection to this, but would observe that it's more normal to have the
number->namemapping done in userspace by modprobe, rather than inside the kernel.
I have one ;-)
Quoted 4 lines
For now I'd just added explicit aliases like '
MODULE_ALIAS("ps3:3");' to the modules in question, because I hadn't yet worked out how to do all themod_devicetablestuff to pick it out of thematch_idin the driver structure.
I think the simple numbering is far more straightforward, because this way the bus doesn't need to know about what devices can be connected to it. The way that Olaf's patch does it, every new device type that may get added in the future needs both a device driver and a change to the bus code, while the other way, we can simply add a new driver.
Arnd <><