Hi, Greg!
While doing "platformization" for one of the Freescale SoC's, I have discovered a serious drawback of the model - it prevents registering driver with the same name.
For instance, cpm2 on either ppc82xx or ppc85xx is very flexible, and its device fsl-cpm-scc could (and actually are) utilized in the different drivers.
Those devices will have different bus_id, but pdev->name fields are the same for all the fsl-cpm-scc, only id is different there. Hence the fsl-cpm-scc could be driver_register'ed only once, while it is required several times.
Could you please suggest possible solutions for this situation? This is relatively common case among freescale chips, so I guess inventing a workaround is odd, and writing an additional shim to handle CPM device multiplexing is odd either.
TIA!
--
Sincerely,
Vitaly
On Tue, Nov 15, 2005 at 07:51:20PM +0300, Vitaly Bordug wrote:
Hi, Greg!
While doing "platformization" for one of the Freescale SoC's, I have
discovered a serious drawback of the model - it prevents registering
driver with the same name.
That's not a "drawback" :)
For instance, cpm2 on either ppc82xx or ppc85xx is very flexible, and
its device fsl-cpm-scc could (and actually are) utilized in the
different drivers.
Those devices will have different bus_id, but pdev->name fields are the
same for all the fsl-cpm-scc, only id is different there. Hence the
fsl-cpm-scc could be driver_register'ed only once, while it is required
several times.
A driver is registered only once, but can be bound to multiple devices
just fine, right?
Could you please suggest possible solutions for this situation? This is
relatively common case among freescale chips, so I guess inventing a
workaround is odd, and writing an additional shim to handle CPM device
multiplexing is odd either.
I don't see the problem here. Are you looking at the new stuff in
2.6.15-rc1?
thanks,
greg k-h
On Tue, Nov 15, 2005 at 07:51:20PM +0300, Vitaly Bordug wrote:
quoted
Hi, Greg!
While doing "platformization" for one of the Freescale SoC's, I have discovered a serious drawback of the model - it prevents registering driver with the same name.
That's not a "drawback" :)
quoted
For instance, cpm2 on either ppc82xx or ppc85xx is very flexible, and its device fsl-cpm-scc could (and actually are) utilized in the different drivers.
Those devices will have different bus_id, but pdev->name fields are the same for all the fsl-cpm-scc, only id is different there. Hence the fsl-cpm-scc could be driver_register'ed only once, while it is required several times.
A driver is registered only once, but can be bound to multiple devices
just fine, right?
Please let me know, how?
I have for instance struct device_driver with name="fsl-cpm-scc" in both fs_enet and cpm_uart(one using SCC1, the other - SCC4, the same device with different id's).
Once it has been registered in fs_enet, I could not register it in cpm_uart, due to kobject_register fo require unique names in kobject->name. Am I missing something?
Not registering it in CPM_UART, how the pdev could be obtained?
Maybe this is clear, but platform stuff is cumbersome some times...
quoted
Could you please suggest possible solutions for this situation? This is relatively common case among freescale chips, so I guess inventing a workaround is odd, and writing an additional shim to handle CPM device multiplexing is odd either.
I don't see the problem here. Are you looking at the new stuff in
2.6.15-rc1?
Yes, sort of. I am going to add 8xx IRDA and make cpm_uart platform device model compatible.
On Tue, Nov 15, 2005 at 08:59:06PM +0300, Vitaly Bordug wrote:
Greg KH wrote:
quoted
On Tue, Nov 15, 2005 at 07:51:20PM +0300, Vitaly Bordug wrote:
quoted
Hi, Greg!
While doing "platformization" for one of the Freescale SoC's, I have
discovered a serious drawback of the model - it prevents registering
driver with the same name.
That's not a "drawback" :)
quoted
For instance, cpm2 on either ppc82xx or ppc85xx is very flexible, and
its device fsl-cpm-scc could (and actually are) utilized in the
different drivers.
Those devices will have different bus_id, but pdev->name fields are the
same for all the fsl-cpm-scc, only id is different there. Hence the
fsl-cpm-scc could be driver_register'ed only once, while it is required
several times.
A driver is registered only once, but can be bound to multiple devices
just fine, right?
Please let me know, how?
All PCI and USB and I2C drivers are able to bind to multiple devices :)
I have for instance struct device_driver with name="fsl-cpm-scc" in both
fs_enet and cpm_uart(one using SCC1, the other - SCC4, the same device with
different id's).
Once it has been registered in fs_enet, I could not register it in
cpm_uart, due to kobject_register fo require unique names in kobject->name.
Am I missing something?
You only register the driver once. The individual devices can be bound
to the same driver, right?
Not registering it in CPM_UART, how the pdev could be obtained?
Maybe this is clear, but platform stuff is cumbersome some times...
Then make it cleaner :)
If you have specific code that explains this better, that might help
out.
thanks,
greg k-h
From: Kumar Gala <hidden> Date: 2005-11-15 19:37:03
You only register the driver once. The individual devices can be bound
to the same driver, right?
quoted
Not registering it in CPM_UART, how the pdev could be obtained?
Maybe this is clear, but platform stuff is cumbersome some times...
Then make it cleaner :)
This is where the confusion is. We have two instances of device A. We
want instance 1 of device A bound to driver "enet" and instance 2 of
device A bound to "serial".
Today both instances are called "deviceA". However we can't register two
different drivers as "deviceA".
Not sure if that clarifies the issue any.
- kumar
On Tue, Nov 15, 2005 at 07:51:20PM +0300, Vitaly Bordug wrote:
quoted
Hi, Greg!
While doing "platformization" for one of the Freescale SoC's, I have
discovered a serious drawback of the model - it prevents registering
driver with the same name.
That's not a "drawback" :)
quoted
For instance, cpm2 on either ppc82xx or ppc85xx is very flexible, and
its device fsl-cpm-scc could (and actually are) utilized in the
different drivers.
Those devices will have different bus_id, but pdev->name fields are
the same for all the fsl-cpm-scc, only id is different there. Hence
the fsl-cpm-scc could be driver_register'ed only once, while it is
required several times.
A driver is registered only once, but can be bound to multiple devices
just fine, right?
Please let me know, how?
I have for instance struct device_driver with name="fsl-cpm-scc" in both
fs_enet and cpm_uart(one using SCC1, the other - SCC4, the same device
with different id's).
Once it has been registered in fs_enet, I could not register it in
cpm_uart, due to kobject_register fo require unique names in
kobject->name. Am I missing something?
May be better to convert fsl-cpm-scc to BUS driver which will be
derived from platform_driver? In this case you'll get flexible
SCCx enumerator as bonus.
--
Regards
Andrey Volkov
From: Andy Fleming <hidden> Date: 2005-11-15 19:43:40
On Nov 15, 2005, at 11:59, Greg KH wrote:
quoted
I have for instance struct device_driver with name="fsl-cpm-scc" in both
fs_enet and cpm_uart(one using SCC1, the other - SCC4, the same device with
different id's).
Once it has been registered in fs_enet, I could not register it in
cpm_uart, due to kobject_register fo require unique names in kobject->name.
Am I missing something?
You only register the driver once. The individual devices can be bound
to the same driver, right?
quoted
Not registering it in CPM_UART, how the pdev could be obtained?
Maybe this is clear, but platform stuff is cumbersome some times...
Then make it cleaner :)
If you have specific code that explains this better, that might help
out.
So the problem Vitaly is referring to is that the CPM is somewhat programmable. The SCC (Serial Communications Controller) is capable of being used as a uart, or as an ethernet device, depending on software configuration. Currently, most systems I'm aware of configure this at boot time, depending on how the kernel has been configured. So the same SOC may have SCC1 as a uart on one board, but as an ethernet controller on another board.
I believe there is work being done to clean this up, and make it more flexible. As a temporary solution, we might want to declare 8 different devices. Something like "cpm-scc-uart", and "cpm-scc-enet". And then create SCC1-4 twice, and let the board code delete the devices that aren't going to be used.
Andy
On Tue, Nov 15, 2005 at 01:34:47PM -0600, Kumar Gala wrote:
quoted
You only register the driver once. The individual devices can be bound
to the same driver, right?
quoted
Not registering it in CPM_UART, how the pdev could be obtained?
Maybe this is clear, but platform stuff is cumbersome some times...
Then make it cleaner :)
This is where the confusion is. We have two instances of device A. We
want instance 1 of device A bound to driver "enet" and instance 2 of
device A bound to "serial".
That's different from what was described earlier :)
In this case, you need two different struct devices.
Today both instances are called "deviceA". However we can't register two
different drivers as "deviceA".
Nor would you want to.
Not sure if that clarifies the issue any.
A bit. I think it still sounds messy...
thanks,
greg k-h
From: Grant Likely <hidden> Date: 2005-11-17 23:52:33
On 11/15/05, Greg KH [off-list ref] wrote:
On Tue, Nov 15, 2005 at 01:34:47PM -0600, Kumar Gala wrote:
quoted
This is where the confusion is. We have two instances of device A. We
want instance 1 of device A bound to driver "enet" and instance 2 of
device A bound to "serial".
That's different from what was described earlier :)
In this case, you need two different struct devices.
Which is what we have.
quoted
Today both instances are called "deviceA". However we can't register t=
wo
quoted
different drivers as "deviceA".
Nor would you want to.
quoted
Not sure if that clarifies the issue any.
A bit. I think it still sounds messy...
Does this help? (We also discussed this a bit at the PPC BoF at OLS this y=
ear)
For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
- 6 PSC devices on chip;
- (struct platform_device) for each device has: .name=3D'mpc52xx-psc';
- However, SCC1 may be driven by the Ethernet driver but PSC2 and
PSC6 may be serial
- problem then is: How do you get only PSC1 bound to the
psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?
Possible solution; Modify the naming scheme slightly from what is
currently used.
1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
2. Make the serial driver register the name "mpc52xx-psc:uart"
3. In the board-specific platform code, modify the .name field in
struct platform_device *before* the device is registered with the
platform device. (possibly by extending ppc_sys_device_fixup callback)
- The board specific code would set PSC1 to "mpc52xx-psc:eth",
PSC2&6 to "mpc52xx-psc:uart". PSC3-5 would stick with "mpc52xx-psc"
and so would not get bound to anything.
Q: Can the .name field be modified *after* platform_device is
registered w/ the platform bus?
g.
On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
On 11/15/05, Greg KH [off-list ref] wrote:
quoted
On Tue, Nov 15, 2005 at 01:34:47PM -0600, Kumar Gala wrote:
quoted
This is where the confusion is. We have two instances of device A. We
want instance 1 of device A bound to driver "enet" and instance 2 of
device A bound to "serial".
That's different from what was described earlier :)
In this case, you need two different struct devices.
Which is what we have.
quoted
quoted
Today both instances are called "deviceA". However we can't register two
different drivers as "deviceA".
Nor would you want to.
quoted
Not sure if that clarifies the issue any.
A bit. I think it still sounds messy...
Does this help? (We also discussed this a bit at the PPC BoF at OLS this year)
For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
- 6 PSC devices on chip;
- (struct platform_device) for each device has: .name='mpc52xx-psc';
- However, SCC1 may be driven by the Ethernet driver but PSC2 and
PSC6 may be serial
- problem then is: How do you get only PSC1 bound to the
psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?
I really do not know, sorry.
Possible solution; Modify the naming scheme slightly from what is
currently used.
1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
2. Make the serial driver register the name "mpc52xx-psc:uart"
3. In the board-specific platform code, modify the .name field in
struct platform_device *before* the device is registered with the
platform device. (possibly by extending ppc_sys_device_fixup callback)
- The board specific code would set PSC1 to "mpc52xx-psc:eth",
PSC2&6 to "mpc52xx-psc:uart". PSC3-5 would stick with "mpc52xx-psc"
and so would not get bound to anything.
Q: Can the .name field be modified *after* platform_device is
registered w/ the platform bus?
From: Grant Likely <hidden> Date: 2005-11-19 02:37:03
On 11/18/05, Greg KH [off-list ref] wrote:
On Thu, Nov 17, 2005 at 04:46:17PM -0700, Grant Likely wrote:
quoted
Does this help? (We also discussed this a bit at the PPC BoF at OLS th=
is year)
quoted
For example on the mpc52xx (see arch/ppc/syslib/mpc52xx_devices.c);
- 6 PSC devices on chip;
- (struct platform_device) for each device has: .name=3D'mpc52xx-psc=
';
quoted
- However, SCC1 may be driven by the Ethernet driver but PSC2 and
PSC6 may be serial
- problem then is: How do you get only PSC1 bound to the
psc-ethernet driver and only PSC2 & PSC6 bound to the serial driver?
I really do not know, sorry.
quoted
Possible solution; Modify the naming scheme slightly from what is
currently used.
1. Make the Ethernet driver register the name "mpc52xx-psc:eth"
2. Make the serial driver register the name "mpc52xx-psc:uart"
3. In the board-specific platform code, modify the .name field in
struct platform_device *before* the device is registered with the
platform device. (possibly by extending ppc_sys_device_fixup callback)
- The board specific code would set PSC1 to "mpc52xx-psc:eth",
PSC2&6 to "mpc52xx-psc:uart". PSC3-5 would stick with "mpc52xx-psc"
and so would not get bound to anything.
Ignoring the question below, do you see any problem with the above solution=
?
quoted
Q: Can the .name field be modified *after* platform_device is
registered w/ the platform bus?
No, it can not, sorry.
Not a big deal, that question was a bit of an aside. If the name
could be changed, then the device function could change at runtime by
unbinding one function driver, changing the name and rebind
another.... But now that I think about it for more that 2ms, a
solution to this would be to just unregister, change .name, and
reregister the struct platform_device.
g.