* [PATCH] driver/FSL SATA:Fix wrong Device Error Register usage
From: Prabhakar Kushwaha @ 2011-02-18 5:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Ashish Kalra, Prabhakar Kushwaha
When a single device error is detected, the device under the error is indicated
by the error bit set in the DER. There is a one to one mapping between register
bit and devices on Port multiplier(PMP) i.e. bit 0 represents PMP device 0 and
bit 1 represents PMP device 1 etc.
Current implementation treats Device error register value as device number not
set of bits representing multiple device on PMP. It is changed to consider bit
level.
No need to check for each set bit as all command is going to be aborted.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Ashish Kalra <B00888@freescale.com>
---
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git (branch master)
drivers/ata/sata_fsl.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 2546f38..8ad335f 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1047,8 +1047,9 @@ static void sata_fsl_error_intr(struct ata_port *ap)
iowrite32(dereg, hcr_base + DE);
iowrite32(cereg, hcr_base + CE);
- if (dereg < ap->nr_pmp_links) {
- link = &ap->pmp_link[dereg];
+ if ((ffs(dereg)-1) < ap->nr_pmp_links) {
+ /* array start from 0 */
+ link = &ap->pmp_link[ffs(dereg)-1];
ehi = &link->eh_info;
qc = ata_qc_from_tag(ap, link->active_tag);
/*
--
1.7.3
^ permalink raw reply related
* RE: [PATCH] driver/FSL SATA:Fix wrong Device Error Register usage
From: David Laight @ 2011-02-18 8:41 UTC (permalink / raw)
To: Prabhakar Kushwaha, linuxppc-dev; +Cc: Ashish Kalra
In-Reply-To: <1298007298-12511-1-git-send-email-prabhakar@freescale.com>
=20
> + if ((ffs(dereg)-1) < ap->nr_pmp_links) {
> + /* array start from 0 */
> + link =3D &ap->pmp_link[ffs(dereg)-1];
I'd only call ffs() once - it could be a slow library function.
Any comment should note that ffs() returns 0 when no bits
are set - rather than anything about array indexes.
David
^ permalink raw reply
* RE: [PATCH] driver/FSL SATA:Fix wrong Device Error Register usage
From: Kushwaha Prabhakar-B32579 @ 2011-02-18 9:59 UTC (permalink / raw)
To: David Laight; +Cc: Kalra Ashish-B00888, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AC57@saturn3.aculab.com>
Thanks David for review comments!!
Please find my reply in-lined
> -----Original Message-----
> From: David Laight [mailto:David.Laight@ACULAB.COM]
> Sent: Friday, February 18, 2011 2:12 PM
> To: Kushwaha Prabhakar-B32579; linuxppc-dev@lists.ozlabs.org
> Cc: Kalra Ashish-B00888
> Subject: RE: [PATCH] driver/FSL SATA:Fix wrong Device Error Register
> usage
>=20
>=20
> > + if ((ffs(dereg)-1) < ap->nr_pmp_links) {
> > + /* array start from 0 */
> > + link =3D &ap->pmp_link[ffs(dereg)-1];
>=20
> I'd only call ffs() once - it could be a slow library function.
This function is called during error handling. So it won't matter.=20
Anyway, I will update the patch for singe usage of ffs().=20
> Any comment should note that ffs() returns 0 when no bits are set -
> rather than anything about array indexes.
>=20
sata_fsl_error_intr() is called during device error.
The mentioned scenario will never comes. It can be observed via code:-
if (cereg) { --> cereg is set on command error. Means there is at least =
1 device present.
abort =3D 1;
---
---
---
/* find out the offending link and qc */
if (ap->nr_pmp_links) { --> if Port multiplier=20
---
---
if ((ffs(dereg)-1) < ap->nr_pmp_links) {
---
---
} else { --> Single device
dereg =3D ioread32(hcr_base + DE);
iowrite32(dereg, hcr_base + DE);
iowrite32(cereg, hcr_base + CE);
^ permalink raw reply
* RE: [PATCH] driver/FSL SATA:Fix wrong Device Error Register usage
From: Kushwaha Prabhakar-B32579 @ 2011-02-18 10:17 UTC (permalink / raw)
To: David Laight, linuxppc-dev@lists.ozlabs.org; +Cc: Kalra Ashish-B00888
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AC57@saturn3.aculab.com>
Thanks David for review comments!!
Please find my reply in-lined
> -----Original Message-----
> From: David Laight [mailto:David.Laight@ACULAB.COM]
> Sent: Friday, February 18, 2011 2:12 PM
> To: Kushwaha Prabhakar-B32579; linuxppc-dev@lists.ozlabs.org
> Cc: Kalra Ashish-B00888
> Subject: RE: [PATCH] driver/FSL SATA:Fix wrong Device Error Register=20
> usage
>=20
>=20
> > + if ((ffs(dereg)-1) < ap->nr_pmp_links) {
> > + /* array start from 0 */
> > + link =3D &ap->pmp_link[ffs(dereg)-1];
>=20
> I'd only call ffs() once - it could be a slow library function.
This function is called during error handling. So it won't matter.=20
Anyway, I will update the patch for singe usage of ffs().=20
> Any comment should note that ffs() returns 0 when no bits are set -=20
> rather than anything about array indexes.
>=20
sata_fsl_error_intr() is called during device error.
The mentioned scenario will never comes. It can be observed via code:-
if (cereg) { --> cereg is set on command error. Means there is at least =
1 device present.
abort =3D 1;
---
---
---
/* find out the offending link and qc */
if (ap->nr_pmp_links) { --> if Port multiplier=20
---
---
if ((ffs(dereg)-1) < ap->nr_pmp_links) {
---
---
} else { --> Single device
dereg =3D ioread32(hcr_base + DE);
iowrite32(dereg, hcr_base + DE);
iowrite32(cereg, hcr_base + CE);
^ permalink raw reply
* MPC866, Help, SPI blocked at startup
From: LEROY Christophe @ 2011-02-18 15:26 UTC (permalink / raw)
To: spi-devel-general, LinuxPPC-dev
Hello,
Sometimes (but rather often) I get SPI tasks hanging.
I get the following trace, as if both tasks where blocking each other,
or they are waiting for a third task ?
Can someone help or tell what I should look at ?
[ 240.939898] INFO: task ff000a80.spi:197 blocked for more than 120 seconds.
[ 240.946495] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
disables this message.
[ 240.954416] ff000a80.spi D 00000000 0 197 2 0x00000000
[ 240.960474] Call Trace:
[ 240.962816] [c1961d20] [c009cd80] d_free+0x68/0x7c (unreliable)
[ 240.968668] [c1961de0] [c00076fc] __switch_to+0x54/0x70
[ 240.974175] [c1961df0] [c0235c8c] schedule+0x42c/0x4d4
[ 240.979058] [c1961e40] [c0235fb8] schedule_timeout+0x30/0x1cc
[ 240.984759] [c1961e80] [c0235714] wait_for_common+0xe0/0x18c
[ 240.990392] [c1961ec0] [c017a480] mpc8xxx_spi_bufs+0x3d0/0x4c8
[ 240.996365] [c1961ee0] [c017a6a8] mpc8xxx_spi_work+0x130/0x290
[ 241.001987] [c1961f50] [c0035240] worker_thread+0x14c/0x200
[ 241.007713] [c1961fb0] [c003960c] kthread+0x7c/0x80
[ 241.012755] [c1961ff0] [c000e660] kernel_thread+0x4c/0x68
[ 241.017947] INFO: task firmware/mcr300:244 blocked for more than 120
seconds.
[ 241.025131] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
disables this message.
[ 241.032846] firmware/mcr3 D 00000000 0 244 2 0x00000000
[ 241.038833] Call Trace:
[ 241.041462] [c198fd90] [0000000f] 0xf (unreliable)
[ 241.046043] [c198fe50] [c00076fc] __switch_to+0x54/0x70
[ 241.051198] [c198fe60] [c0235c8c] schedule+0x42c/0x4d4
[ 241.056253] [c198feb0] [c0235fb8] schedule_timeout+0x30/0x1cc
[ 241.061957] [c198fef0] [c0235714] wait_for_common+0xe0/0x18c
[ 241.067797] [c198ff30] [c0178f7c] spi_sync+0x8c/0xb4
[ 241.072586] [c198ff70] [c0185704] fpga_fw_load+0x15c/0x3b8
[ 241.077968] [c198ff90] [c015da9c] request_firmware_work_func+0x58/0x84
[ 241.084434] [c198ffb0] [c003960c] kthread+0x7c/0x80
[ 241.089228] [c198fff0] [c000e660] kernel_thread+0x4c/0x68
Regards
C. Leroy
^ permalink raw reply
* fsl_udc_core not initializing properly?
From: Matthew L. Creech @ 2011-02-18 22:03 UTC (permalink / raw)
To: linuxppc-dev
Hi,
I'm upgrading from 2.6.36 to 2.6.37 on a MPC8313 ERDB-like board. On
the new kernel, it seems like the USB gadget driver (fsl_usb2_udc) is
never initialized, so USB no longer works.
Adding some printks to the code shows that udc_init() is being run,
which calls platform_driver_probe(). However, fsl_udc_probe() is
never actually called afterward. As a result, 'udc_controller' is
left NULL, and the subsequent call to usb_gadget_probe_driver()
returns -ENODEV.
I'm not familiar with the USB driver model, and tracing backward
through the call chains didn't reveal much, so I was hoping someone
here would have a better idea what could've changed between 2.6.36 and
2.6.37 that broke fsl_udc_core/fsl_usb2_udc. Thanks!
--
Matthew L. Creech
^ permalink raw reply
* Re: fsl_udc_core not initializing properly?
From: Anatolij Gustschin @ 2011-02-19 8:52 UTC (permalink / raw)
To: Matthew L. Creech; +Cc: linuxppc-dev
In-Reply-To: <AANLkTikaH6=8JgX6wfqLu0fCFBO0A1hHDTpw7Xb64uKS@mail.gmail.com>
Hi,
On Fri, 18 Feb 2011 17:03:12 -0500
"Matthew L. Creech" <mlcreech@gmail.com> wrote:
...
> I'm upgrading from 2.6.36 to 2.6.37 on a MPC8313 ERDB-like board. On
> the new kernel, it seems like the USB gadget driver (fsl_usb2_udc) is
> never initialized, so USB no longer works.
>
> Adding some printks to the code shows that udc_init() is being run,
> which calls platform_driver_probe(). However, fsl_udc_probe() is
> never actually called afterward. As a result, 'udc_controller' is
> left NULL, and the subsequent call to usb_gadget_probe_driver()
> returns -ENODEV.
Look at the USB node in the device tree for your board. Does it
contain the "dr_mode" property? For USB gadget the value of this
property should be "peripheral".
The device tree for MPC8313 ERDB in mainline tree doesn't specify
this property, so the host mode is the default operation mode here.
Therefore the platform device "fsl-usb2-udc" won't be created
while booting and since there is no appropriate platform device,
the probing is not done. This might be the case on your board,
too. Try with dr_mode = "peripheral"; in the usb node in your
device tree.
Anatolij
^ permalink raw reply
* [PATCH] Add support for PowerMac3,5 in snd-aoa ALSA sound module
From: Linux User #330250 @ 2011-02-19 14:53 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Takashi Iwai, Johannes Berg
Hello!
About two years ago Johannes Berg wrote support for the PowerMac3,6 aka G4 =
MDD=20
which I was using as a desktop computer then. Johannes wrote all the code, =
and=20
I tested it.
I now have a PowerMac3,5 =E2=80=93 yes, an earlier model.
This patch makes the snd-aoa ALSA sound module support the TAS3001C codec o=
f=20
my Apple Power Mac G4 "Quicksilver" (2001 model). I suppose it will also wo=
rk=20
for the "Quicksilver 2002", since both identify as PowerMac3,5.
The patch also changes a few comments to name the exact Power Mac model mor=
e=20
accurately in sound/aoa/fabrics/layout.c.
This is my first contribution to the linux kernel ever, so I hope you will =
be=20
kind to me. I am not a programmer, but adding already supported devices was=
a=20
task even I could accomplish.
Thanks,
Andreas aka Linux User #330250
=2D--
diff -Naur linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c linux-2.6.38-rc=
5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c
=2D-- linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c 2011-01-05 01:50:=
19.000000000 +0100
+++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c 201=
1-02-17 18:43:26.000000000 +0100
@@ -111,6 +111,7 @@
MODULE_ALIAS("sound-layout-100");
=20
MODULE_ALIAS("aoa-device-id-14");
+MODULE_ALIAS("aoa-device-id-21");
MODULE_ALIAS("aoa-device-id-22");
MODULE_ALIAS("aoa-device-id-35");
=20
@@ -333,14 +334,14 @@
.connections =3D topaz_input,
},
},
=2D /* Quad PowerMac (analog in, analog/digital out) */
+ /* PowerMac11,2 (G5 Dual-Core and Quad) (analog in, analog/digital =
out) */
{ .layout_id =3D 68,
.codecs[0] =3D {
.name =3D "onyx",
.connections =3D onyx_connections_nomic,
},
},
=2D /* Quad PowerMac (digital in) */
+ /* PowerMac11,2 (G5 Dual-Core and Quad) (digital in) */
{ .layout_id =3D 69,
.codecs[0] =3D {
.name =3D "topaz",
@@ -521,14 +522,21 @@
.connections =3D onyx_connections_noheadphones,
},
},---
=2D /* PowerMac3,4 */
+ /* PowerMac3,4 (Digital Audio) */
{ .device_id =3D 14,
.codecs[0] =3D {
.name =3D "tas",
.connections =3D tas_connections_noline,
},
},
=2D /* PowerMac3,6 */
+ /* PowerMac3,5 (Quicksilver) */
+ { .device_id =3D 21,
+ .codecs[0] =3D {
+ .name =3D "tas",
+ .connections =3D tas_connections_noline,
+ },
+ },
+ /* PowerMac3,6 (Mirrored Drive Doors) */
{ .device_id =3D 22,
.codecs[0] =3D {
.name =3D "tas",
diff -Naur linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c linux-2.6=
=2E38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c
=2D-- linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c 2011-01-0=
5 01:50:19.000000000 +0100
+++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c =
2011-02-17 18:44:36.000000000 +0100
@@ -200,7 +200,7 @@
* We probably cannot handle all device-id machines,
* so restrict to those we do handle for now.
*/
=2D if (id && (*id =3D=3D 22 || *id =3D=3D 14 || *id =
=3D=3D 35)) {
+ if (id && (*id =3D=3D 22 || *id =3D=3D 21 || *id =
=3D=3D 14 || *id =3D=3D 35)) {
snprintf(dev->sound.modalias, 32,
"aoa-device-id-%d", *id);
ok =3D 1;
^ permalink raw reply
* Re: fsl_udc_core not initializing properly?
From: Matthew L. Creech @ 2011-02-19 18:01 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linuxppc-dev
In-Reply-To: <20110219095253.39540a57@wker>
On Sat, Feb 19, 2011 at 3:52 AM, Anatolij Gustschin <agust@denx.de> wrote:
>
> Look at the USB node in the device tree for your board. Does it
> contain the "dr_mode" property? For USB gadget the value of this
> property should be "peripheral".
> The device tree for MPC8313 ERDB in mainline tree doesn't specify
> this property, so the host mode is the default operation mode here.
> Therefore the platform device "fsl-usb2-udc" won't be created
> while booting and since there is no appropriate platform device,
> the probing is not done. This might be the case on your board,
> too. Try with dr_mode = "peripheral"; in the usb node in your
> device tree.
>
Yes, it's there. Here's the DTS entry in case anything else sticks out:
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
phy_type = "utmi_wide";
dr_mode = "peripheral";
sleep = <&pmc 0x00300000>;
};
I think dr_mode was required in past kernel versions as well (since I
seem to recall bumping in to the problem you describe a long time ago
when we first tried to get device-mode USB working). :)
Thanks
--
Matthew L. Creech
^ permalink raw reply
* Re: [PATCH] Add support for PowerMac3,5 in snd-aoa ALSA sound module
From: Takashi Iwai @ 2011-02-20 9:13 UTC (permalink / raw)
To: Linux User #330250; +Cc: Johannes Berg, linuxppc-dev
In-Reply-To: <201102191553.46708.linuxuser330250@gmx.net>
At Sat, 19 Feb 2011 15:53:46 +0100,
Linux User #330250 wrote:
>
> Hello!
>
> About two years ago Johannes Berg wrote support for the PowerMac3,6 aka G4 MDD
> which I was using as a desktop computer then. Johannes wrote all the code, and
> I tested it.
>
> I now have a PowerMac3,5 – yes, an earlier model.
>
> This patch makes the snd-aoa ALSA sound module support the TAS3001C codec of
> my Apple Power Mac G4 "Quicksilver" (2001 model). I suppose it will also work
> for the "Quicksilver 2002", since both identify as PowerMac3,5.
>
> The patch also changes a few comments to name the exact Power Mac model more
> accurately in sound/aoa/fabrics/layout.c.
>
> This is my first contribution to the linux kernel ever, so I hope you will be
> kind to me. I am not a programmer, but adding already supported devices was a
> task even I could accomplish.
Thanks for the patch. The changes look good to me.
The only missing piece is your sign-off. Could you give it?
See $LINUX/Documentation/SubmittingPatches section "Sign your work"
for details.
Takashi
>
> Thanks,
> Andreas aka Linux User #330250
>
> ---
>
> diff -Naur linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c
> --- linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c 2011-01-05 01:50:19.000000000 +0100
> +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c 2011-02-17 18:43:26.000000000 +0100
> @@ -111,6 +111,7 @@
> MODULE_ALIAS("sound-layout-100");
>
> MODULE_ALIAS("aoa-device-id-14");
> +MODULE_ALIAS("aoa-device-id-21");
> MODULE_ALIAS("aoa-device-id-22");
> MODULE_ALIAS("aoa-device-id-35");
>
> @@ -333,14 +334,14 @@
> .connections = topaz_input,
> },
> },
> - /* Quad PowerMac (analog in, analog/digital out) */
> + /* PowerMac11,2 (G5 Dual-Core and Quad) (analog in, analog/digital out) */
> { .layout_id = 68,
> .codecs[0] = {
> .name = "onyx",
> .connections = onyx_connections_nomic,
> },
> },
> - /* Quad PowerMac (digital in) */
> + /* PowerMac11,2 (G5 Dual-Core and Quad) (digital in) */
> { .layout_id = 69,
> .codecs[0] = {
> .name = "topaz",
> @@ -521,14 +522,21 @@
> .connections = onyx_connections_noheadphones,
> },
> },---
> - /* PowerMac3,4 */
> + /* PowerMac3,4 (Digital Audio) */
> { .device_id = 14,
> .codecs[0] = {
> .name = "tas",
> .connections = tas_connections_noline,
> },
> },
> - /* PowerMac3,6 */
> + /* PowerMac3,5 (Quicksilver) */
> + { .device_id = 21,
> + .codecs[0] = {
> + .name = "tas",
> + .connections = tas_connections_noline,
> + },
> + },
> + /* PowerMac3,6 (Mirrored Drive Doors) */
> { .device_id = 22,
> .codecs[0] = {
> .name = "tas",
> diff -Naur linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c
> --- linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c 2011-01-05 01:50:19.000000000 +0100
> +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c 2011-02-17 18:44:36.000000000 +0100
> @@ -200,7 +200,7 @@
> * We probably cannot handle all device-id machines,
> * so restrict to those we do handle for now.
> */
> - if (id && (*id == 22 || *id == 14 || *id == 35)) {
> + if (id && (*id == 22 || *id == 21 || *id == 14 || *id == 35)) {
> snprintf(dev->sound.modalias, 32,
> "aoa-device-id-%d", *id);
> ok = 1;
>
^ permalink raw reply
* Info : Using a PowerMac G5 as a server
From: Romain Goyet @ 2011-02-20 11:59 UTC (permalink / raw)
To: linuxppc-dev
Hi everyone,
I've this PowerMac G5 machine I'd like to use as a server. It makes
perfect sense to install Linux on it for several reasons :
- OS X isn't maintained on this hardware anymore
- Those machine are still reasonnably fast. They sure aren't the
latest and greatest, but they still do a decent job.
- Support of those in other OSes (NetBSD or FreeBSD for instance) is
pretty bad (no fan control for example).
To make a decent server though, there are two things that are pretty
important IMHO :
- Being able to boot headless (w/o a screen attached)
- Being able to reboot automagically after a power failure
Surprisingly, the Linux kernel does a very good job on this machine in
terms of hardware support and stability : everything works perfectly.
But the global OS fails pathetically in the two said points.
Here are my findings so far, I hope it will help people in the same situati=
on :
1/ Booting a PowerMac G5 headless
This hasn't so much to do with Linux per se, but rather with Yaboot
which seems to be the de-facto standard bootloader on the OpenFirmware
platform.
For some reason, at some point in the booting process, yaboot relies
on a screen being present. If no screen is attached, it will hang. So
much for headless booting.
Now I've figured out several workarounds :
-> Fake a screen by plugging in a resistor into your VGA port (or to
your DVI port using an adapter). This sure works, but it's rather
redneck
-> For some reason, the part of yaboot that actually depends on the
script is the "ofboot.b" forth script. This scripts' purpose is to
give you an option of booting off of a CD. I really don't get it since
OpenFirmware itself lets you boot off of a CD just by pressing "C" on
boot. So basically if you skip ofboot.b, you're good to go. When
installing yaboot with ybin, ybin sets the "boot-device" variable in
OpenFirmware to point to ofboot.b. So if you point boot-device
straight to the yaboo binary, you should be able to boot headless
without any issue. Here are several ways to do it :
- Go to the OpenFirmware prompt (Command-Option-O-F on boot),
and type "setenv boot-device=3Dhd:2,yaboot" (modify the hd:2
accordingly), then "boot"
- You might be able to achieve the same effect using the
"nvram" tool straight from linux
- I think simply removing the "magicboot" line off of
yaboot.conf might fix it as well
IOW, it _is_ possible to boot a PowerMac G5 headless on Linux without
any hardware modification.
2/ Rebooting automagically after a power failure
Now this is less fun : I still don't have any solution to offer. To
understand the situation, you should know that this has to be set in
the power-management chip.
Previous PowerMacs used a "PMU" chip, which was fully supported. All
you had to do was to echo "server_mode=3D1" to /proc/pmu/options.
Thing is, G5's use a new chip, named "SMU". And AFAIK, there's no such
option for those machines=E2=80=A6
So if anyone ever knows any element of answer on this, I'd be really
interested !
Kind regards,
- Romain
^ permalink raw reply
* Re: Info : Using a PowerMac G5 as a server
From: Benjamin Herrenschmidt @ 2011-02-20 20:05 UTC (permalink / raw)
To: Romain Goyet; +Cc: Tony Breeds, linuxppc-dev
In-Reply-To: <AANLkTi=bkvv0E6VhHtq9vEvADhPxWfQROkfUMaBqZq4f@mail.gmail.com>
> Surprisingly, the Linux kernel does a very good job on this machine in
> terms of hardware support and stability : everything works perfectly.
> But the global OS fails pathetically in the two said points.
> Here are my findings so far, I hope it will help people in the same situation :
>
> 1/ Booting a PowerMac G5 headless
>
> This hasn't so much to do with Linux per se, but rather with Yaboot
> which seems to be the de-facto standard bootloader on the OpenFirmware
> platform.
> For some reason, at some point in the booting process, yaboot relies
> on a screen being present. If no screen is attached, it will hang. So
> much for headless booting.
> Now I've figured out several workarounds :
> -> Fake a screen by plugging in a resistor into your VGA port (or to
> your DVI port using an adapter). This sure works, but it's rather
> redneck
> -> For some reason, the part of yaboot that actually depends on the
> script is the "ofboot.b" forth script. This scripts' purpose is to
> give you an option of booting off of a CD. I really don't get it since
> OpenFirmware itself lets you boot off of a CD just by pressing "C" on
> boot. So basically if you skip ofboot.b, you're good to go. When
> installing yaboot with ybin, ybin sets the "boot-device" variable in
> OpenFirmware to point to ofboot.b. So if you point boot-device
> straight to the yaboo binary, you should be able to boot headless
> without any issue. Here are several ways to do it :
You may want to Tony Breeds. I'm not sure what happen when ofboot.b
tries to "fixup" the input/output devices, but we could certainly make
it easier for ofboot.b to be optional.
> - Go to the OpenFirmware prompt (Command-Option-O-F on boot),
> and type "setenv boot-device=hd:2,yaboot" (modify the hd:2
> accordingly), then "boot"
> - You might be able to achieve the same effect using the
> "nvram" tool straight from linux
> - I think simply removing the "magicboot" line off of
> yaboot.conf might fix it as well
>
> IOW, it _is_ possible to boot a PowerMac G5 headless on Linux without
> any hardware modification.
Yeah but I think OF gets into all kind of funny state if you try to open
the graphics device with nothing connected, and that's an OF bug, it
shouldn't happen.
> 2/ Rebooting automagically after a power failure
>
> Now this is less fun : I still don't have any solution to offer. To
> understand the situation, you should know that this has to be set in
> the power-management chip.
> Previous PowerMacs used a "PMU" chip, which was fully supported. All
> you had to do was to echo "server_mode=1" to /proc/pmu/options.
>
> Thing is, G5's use a new chip, named "SMU". And AFAIK, there's no such
> option for those machines…
Yes, there is. We reverse engineered that a while back and somebody even
wrote a little tool to control it, though I don't remember where that
can be found... If necessary, we can try to dig again, the RE wasn't
that hard.
Cheers,
Ben.
> So if anyone ever knows any element of answer on this, I'd be really
> interested !
>
> Kind regards,
>
> - Romain
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: Info : Using a PowerMac G5 as a server
From: Benjamin Herrenschmidt @ 2011-02-20 21:36 UTC (permalink / raw)
To: Romain Goyet; +Cc: Tony Breeds, linuxppc-dev
In-Reply-To: <1298232300.8833.20.camel@pasglop>
On Mon, 2011-02-21 at 07:05 +1100, Benjamin Herrenschmidt wrote:
> Yes, there is. We reverse engineered that a while back and somebody even
> wrote a little tool to control it, though I don't remember where that
> can be found... If necessary, we can try to dig again, the RE wasn't
> that hard.
a quick look seems to indicate that a bunch of the necessary command
definitions are present in smu.h already. Search for SMU_POWER_EVENTS
and below.
You probably need to send a SMU_CMD_POWER_EVENTS_COMMAND with
SET_POWERUP_EVENTS and SMU_PWR_WAKEUP_AC_INSERT as arguments.
You can find examples of how to send SMU commands there:
http://gate.crashing.org/~benh/smu_wink.c
Fell free to submit your resulting new utility to powerpc-utils :-)
Cheers,
Ben.
^ permalink raw reply
* [PATCH] Add support for PowerMac3,5 in snd-aoa ALSA sound module
From: Linux User #330250 @ 2011-02-20 21:38 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Takashi Iwai, Johannes Berg
Hello again!
Sorry for sending the patch three times. (This is the fourth...)
About the sign-off: I use the name I've been using since I started
participating. The document $LINUX/Documentation/SubmittingPatches clearly
states that one has to use real names. I'm breaking this rule, but I'm not
ready to reveal my real name here or at any other place at this time. Sorry.
If this patch is not accepted due to this, well=E2=80=A6 that's life. BTW m=
y real
given name is Andreas.
So, here's the patch, this time with a (pseudonym) sign-off:
This patch makes the snd-aoa ALSA sound module support the TAS3001C codec o=
f=20
my Apple Power Mac G4 "Quicksilver" (2001 model). I suppose it will also wo=
rk=20
for the "Quicksilver 2002", since both identify as PowerMac3,5.
The patch also changes a few comments to name the exact Power Mac model mor=
e=20
accurately in sound/aoa/fabrics/layout.c.
Signed-off-by: Andreas aka Linux User #330250 <linuxuser330250@gmx.net>
=2D--
diff -Naur linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c linux-2.6.38-rc=
5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c
=2D-- linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c 2011-01-05 01:50:=
19.000000000 +0100
+++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c 201=
1-02-17 18:43:26.000000000 +0100
@@ -111,6 +111,7 @@
MODULE_ALIAS("sound-layout-100");
=20
MODULE_ALIAS("aoa-device-id-14");
+MODULE_ALIAS("aoa-device-id-21");
MODULE_ALIAS("aoa-device-id-22");
MODULE_ALIAS("aoa-device-id-35");
=20
@@ -333,14 +334,14 @@
.connections =3D topaz_input,
},
},
=2D /* Quad PowerMac (analog in, analog/digital out) */
+ /* PowerMac11,2 (G5 Dual-Core and Quad) (analog in, analog/digital =
out) */
{ .layout_id =3D 68,
.codecs[0] =3D {
.name =3D "onyx",
.connections =3D onyx_connections_nomic,
},
},
=2D /* Quad PowerMac (digital in) */
+ /* PowerMac11,2 (G5 Dual-Core and Quad) (digital in) */
{ .layout_id =3D 69,
.codecs[0] =3D {
.name =3D "topaz",
@@ -521,14 +522,21 @@
.connections =3D onyx_connections_noheadphones,
},
},---
=2D /* PowerMac3,4 */
+ /* PowerMac3,4 (Digital Audio) */
{ .device_id =3D 14,
.codecs[0] =3D {
.name =3D "tas",
.connections =3D tas_connections_noline,
},
},
=2D /* PowerMac3,6 */
+ /* PowerMac3,5 (Quicksilver) */
+ { .device_id =3D 21,
+ .codecs[0] =3D {
+ .name =3D "tas",
+ .connections =3D tas_connections_noline,
+ },
+ },
+ /* PowerMac3,6 (Mirrored Drive Doors) */
{ .device_id =3D 22,
.codecs[0] =3D {
.name =3D "tas",
diff -Naur linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c linux-2.6=
=2E38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c
=2D-- linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c 2011-01-0=
5 01:50:19.000000000 +0100
+++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c =
2011-02-17 18:44:36.000000000 +0100
@@ -200,7 +200,7 @@
* We probably cannot handle all device-id machines,
* so restrict to those we do handle for now.
*/
=2D if (id && (*id =3D=3D 22 || *id =3D=3D 14 || *id =
=3D=3D 35)) {
+ if (id && (*id =3D=3D 22 || *id =3D=3D 21 || *id =
=3D=3D 14 || *id =3D=3D 35)) {
snprintf(dev->sound.modalias, 32,
"aoa-device-id-%d", *id);
ok =3D 1;
^ permalink raw reply
* Re: Per process DSCR + somefixes (try#3)
From: Alexey Kardashevskiy @ 2011-02-21 2:44 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <4D5B62F2.3020709@au1.ibm.com>
RHEL6 problem was that it crashed when doing
echo 3 > /sys/devices/system/cpu/dscr_default
because access methods for SYSDEV_ATTR and SYSDEV_CLASS_ATTR have
different number of parameters in RHEL6. It was not correct for 2.6.36
either but the parameters number is the same for both SYSDEV_ATTR and
SYSDEV_CLASS_ATTR and 2.6.36 simply forgave me.
--
Alexey Kardashevskiy
IBM OzLabs, LTC Team
e-mail/sametime: aik@au1.ibm.com
notes: Alexey Kardashevskiy/Australia/IBM
^ permalink raw reply
* [PATCH][v1] driver/FSL SATA:Fix wrong Device Error Register usage
From: Prabhakar Kushwaha @ 2011-02-21 3:31 UTC (permalink / raw)
To: linuxppc-dev; +Cc: meet2prabhu, Ashish Kalra, Prabhakar Kushwaha
When a single device error is detected, the device under the error is indicated
by the error bit set in the DER. There is a one to one mapping between register
bit and devices on Port multiplier(PMP) i.e. bit 0 represents PMP device 0 and
bit 1 represents PMP device 1 etc.
Current implementation treats Device error register value as device number not
set of bits representing multiple device on PMP. It is changed to consider bit
level.
No need to check for each set bit as all command is going to be aborted.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Ashish Kalra <B00888@freescale.com>
---
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git (branch master)
Changes for v1: Incorporated David Laight's comment
- Single usage of ffs()
drivers/ata/sata_fsl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b0214d0..895771c 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1040,12 +1040,14 @@ static void sata_fsl_error_intr(struct ata_port *ap)
/* find out the offending link and qc */
if (ap->nr_pmp_links) {
+ int dev_num;
dereg = ioread32(hcr_base + DE);
iowrite32(dereg, hcr_base + DE);
iowrite32(cereg, hcr_base + CE);
- if (dereg < ap->nr_pmp_links) {
- link = &ap->pmp_link[dereg];
+ dev_num = ffs(dereg)-1;
+ if (dev_num < ap->nr_pmp_links) {
+ link = &ap->pmp_link[dev_num];
ehi = &link->eh_info;
qc = ata_qc_from_tag(ap, link->active_tag);
/*
--
1.7.3
^ permalink raw reply related
* [PATCH] driver/FSL SATA: Update RX_WATER_MARK for TRANSCFG
From: Prabhakar Kushwaha @ 2011-02-21 3:32 UTC (permalink / raw)
To: linuxppc-dev; +Cc: meet2prabhu, Prabhakar Kushwaha
RX_WATER_MARK sets the number of locations in Rx FIFO that can be used before
the transport layer instructs the link layer to transmit HOLDS. Note that it
can take some time for the HOLDs to get to the other end, and that in the
interim there must be enough room in the FIFO to absorb all data that could
arrive.
Update the new recommended value to 16.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git (branch master)
drivers/ata/sata_fsl.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 895771c..29d2f29 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -186,6 +186,11 @@ enum {
COMMANDSTAT = 0x20,
};
+/* TRANSCFG (transport-layer) configuration control */
+enum {
+ TRANSCFG_RX_WATER_MARK = (1 << 4),
+};
+
/* PHY (link-layer) configuration control */
enum {
PHY_BIST_ENABLE = 0x01,
@@ -1305,6 +1310,7 @@ static int sata_fsl_probe(struct platform_device *ofdev,
struct sata_fsl_host_priv *host_priv = NULL;
int irq;
struct ata_host *host;
+ u32 temp;
struct ata_port_info pi = sata_fsl_port_info[0];
const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1319,6 +1325,12 @@ static int sata_fsl_probe(struct platform_device *ofdev,
ssr_base = hcr_base + 0x100;
csr_base = hcr_base + 0x140;
+ if (!of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc8315-sata")) {
+ temp = ioread32(csr_base + TRANSCFG);
+ temp = temp & 0xffffffe0;
+ iowrite32(temp | TRANSCFG_RX_WATER_MARK, csr_base + TRANSCFG);
+ }
+
DPRINTK("@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG));
DPRINTK("sizeof(cmd_desc) = %d\n", sizeof(struct command_desc));
DPRINTK("sizeof(#define cmd_desc) = %d\n", SATA_FSL_CMD_DESC_SIZE);
--
1.7.3
^ permalink raw reply related
* Re: [PATCH] Add support for PowerMac3,5 in snd-aoa ALSA sound module
From: Takashi Iwai @ 2011-02-21 8:37 UTC (permalink / raw)
To: Linux User #330250; +Cc: Johannes Berg, linuxppc-dev
In-Reply-To: <201102202238.28517.linuxuser330250@gmx.net>
At Sun, 20 Feb 2011 22:38:28 +0100,
Linux User #330250 wrote:
>
> Hello again!
>
> Sorry for sending the patch three times. (This is the fourth...)
>
> About the sign-off: I use the name I've been using since I started
> participating. The document $LINUX/Documentation/SubmittingPatches clearly
> states that one has to use real names. I'm breaking this rule, but I'm not
> ready to reveal my real name here or at any other place at this time. Sorry.
> If this patch is not accepted due to this, well… that's life. BTW my real
> given name is Andreas.
Well, we need really the full name for sign-off.
In general, it's not acceptable with the proper sign-off...
Takashi
>
>
> So, here's the patch, this time with a (pseudonym) sign-off:
>
> This patch makes the snd-aoa ALSA sound module support the TAS3001C codec of
> my Apple Power Mac G4 "Quicksilver" (2001 model). I suppose it will also work
> for the "Quicksilver 2002", since both identify as PowerMac3,5.
>
> The patch also changes a few comments to name the exact Power Mac model more
> accurately in sound/aoa/fabrics/layout.c.
>
> Signed-off-by: Andreas aka Linux User #330250 <linuxuser330250@gmx.net>
>
> ---
>
> diff -Naur linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c
> --- linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c 2011-01-05 01:50:19.000000000 +0100
> +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c 2011-02-17 18:43:26.000000000 +0100
> @@ -111,6 +111,7 @@
> MODULE_ALIAS("sound-layout-100");
>
> MODULE_ALIAS("aoa-device-id-14");
> +MODULE_ALIAS("aoa-device-id-21");
> MODULE_ALIAS("aoa-device-id-22");
> MODULE_ALIAS("aoa-device-id-35");
>
> @@ -333,14 +334,14 @@
> .connections = topaz_input,
> },
> },
> - /* Quad PowerMac (analog in, analog/digital out) */
> + /* PowerMac11,2 (G5 Dual-Core and Quad) (analog in, analog/digital out) */
> { .layout_id = 68,
> .codecs[0] = {
> .name = "onyx",
> .connections = onyx_connections_nomic,
> },
> },
> - /* Quad PowerMac (digital in) */
> + /* PowerMac11,2 (G5 Dual-Core and Quad) (digital in) */
> { .layout_id = 69,
> .codecs[0] = {
> .name = "topaz",
> @@ -521,14 +522,21 @@
> .connections = onyx_connections_noheadphones,
> },
> },---
> - /* PowerMac3,4 */
> + /* PowerMac3,4 (Digital Audio) */
> { .device_id = 14,
> .codecs[0] = {
> .name = "tas",
> .connections = tas_connections_noline,
> },
> },
> - /* PowerMac3,6 */
> + /* PowerMac3,5 (Quicksilver) */
> + { .device_id = 21,
> + .codecs[0] = {
> + .name = "tas",
> + .connections = tas_connections_noline,
> + },
> + },
> + /* PowerMac3,6 (Mirrored Drive Doors) */
> { .device_id = 22,
> .codecs[0] = {
> .name = "tas",
> diff -Naur linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c
> --- linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c 2011-01-05 01:50:19.000000000 +0100
> +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c 2011-02-17 18:44:36.000000000 +0100
> @@ -200,7 +200,7 @@
> * We probably cannot handle all device-id machines,
> * so restrict to those we do handle for now.
> */
> - if (id && (*id == 22 || *id == 14 || *id == 35)) {
> + if (id && (*id == 22 || *id == 21 || *id == 14 || *id == 35)) {
> snprintf(dev->sound.modalias, 32,
> "aoa-device-id-%d", *id);
> ok = 1;
>
^ permalink raw reply
* RE: [PATCH][v1] driver/FSL SATA:Fix wrong Device Error Register usage
From: David Laight @ 2011-02-21 9:21 UTC (permalink / raw)
To: Prabhakar Kushwaha, linuxppc-dev; +Cc: meet2prabhu, Ashish Kalra
In-Reply-To: <1298259096-3426-1-git-send-email-prabhakar@freescale.com>
The patch changes the code to:
> if (ap->nr_pmp_links) {
> + int dev_num;
> dereg =3D ioread32(hcr_base + DE);
...
> + dev_num =3D ffs(dereg)-1;
> + if (dev_num < ap->nr_pmp_links) {
> + link =3D &ap->pmp_link[dev_num];
On the off chance that no bits are set in 'DE' this
code depends on nr_pmp_links being unsigned (since
dev_num becomes -1.
Changing 'dev_num' to 'unsigned int' would be better.
David
^ permalink raw reply
* [PATCH][v2] driver/FSL SATA:Fix wrong Device Error Register usage
From: Prabhakar Kushwaha @ 2011-02-21 9:57 UTC (permalink / raw)
To: linuxppc-dev; +Cc: meet2prabhu, B00888, Prabhakar Kushwaha
When a single device error is detected, the device under the error is indicated
by the error bit set in the DER. There is a one to one mapping between register
bit and devices on Port multiplier(PMP) i.e. bit 0 represents PMP device 0 and
bit 1 represents PMP device 1 etc.
Current implementation treats Device error register value as device number not
set of bits representing multiple device on PMP. It is changed to consider bit
level.
No need to check for each set bit as all command is going to be aborted.
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Ashish Kalra <B00888@freescale.com>
---
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git (branch master)
Changes for v1: Incorporated David Laight's comment
- Single usage of ffs()
Changes for v2: Incorporated David Laight's comment
- Changed type of dev_num to unsigned
drivers/ata/sata_fsl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b0214d0..895771c 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1040,12 +1040,14 @@ static void sata_fsl_error_intr(struct ata_port *ap)
/* find out the offending link and qc */
if (ap->nr_pmp_links) {
+ unsigned int dev_num;
dereg = ioread32(hcr_base + DE);
iowrite32(dereg, hcr_base + DE);
iowrite32(cereg, hcr_base + CE);
- if (dereg < ap->nr_pmp_links) {
- link = &ap->pmp_link[dereg];
+ dev_num = ffs(dereg)-1;
+ if (dev_num < ap->nr_pmp_links) {
+ link = &ap->pmp_link[dev_num];
ehi = &link->eh_info;
qc = ata_qc_from_tag(ap, link->active_tag);
/*
--
1.7.3
^ permalink raw reply related
* Re: [PATCH] Add support for PowerMac3,5 in snd-aoa ALSA sound module
From: Benjamin Herrenschmidt @ 2011-02-21 22:20 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Johannes Berg, linuxppc-dev
In-Reply-To: <s5hd3mlbx6x.wl%tiwai@suse.de>
On Mon, 2011-02-21 at 09:37 +0100, Takashi Iwai wrote:
> At Sun, 20 Feb 2011 22:38:28 +0100,
> Linux User #330250 wrote:
> >
> > Hello again!
> >
> > Sorry for sending the patch three times. (This is the fourth...)
> >
> > About the sign-off: I use the name I've been using since I started
> > participating. The document $LINUX/Documentation/SubmittingPatches clearly
> > states that one has to use real names. I'm breaking this rule, but I'm not
> > ready to reveal my real name here or at any other place at this time. Sorry.
> > If this patch is not accepted due to this, well… that's life. BTW my real
> > given name is Andreas.
>
> Well, we need really the full name for sign-off.
> In general, it's not acceptable with the proper sign-off...
So somebody else can just pick the "documentation" that layout ID 21
works just like 22 for us, and write an "acceptable" patch...
Cheers,
Ben.
>
> Takashi
>
>
> >
> >
> > So, here's the patch, this time with a (pseudonym) sign-off:
> >
> > This patch makes the snd-aoa ALSA sound module support the TAS3001C codec of
> > my Apple Power Mac G4 "Quicksilver" (2001 model). I suppose it will also work
> > for the "Quicksilver 2002", since both identify as PowerMac3,5.
> >
> > The patch also changes a few comments to name the exact Power Mac model more
> > accurately in sound/aoa/fabrics/layout.c.
> >
> > Signed-off-by: Andreas aka Linux User #330250 <linuxuser330250@gmx.net>
> >
> > ---
> >
> > diff -Naur linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c
> > --- linux-2.6.38-rc5-git2/sound/aoa/fabrics/layout.c 2011-01-05 01:50:19.000000000 +0100
> > +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/fabrics/layout.c 2011-02-17 18:43:26.000000000 +0100
> > @@ -111,6 +111,7 @@
> > MODULE_ALIAS("sound-layout-100");
> >
> > MODULE_ALIAS("aoa-device-id-14");
> > +MODULE_ALIAS("aoa-device-id-21");
> > MODULE_ALIAS("aoa-device-id-22");
> > MODULE_ALIAS("aoa-device-id-35");
> >
> > @@ -333,14 +334,14 @@
> > .connections = topaz_input,
> > },
> > },
> > - /* Quad PowerMac (analog in, analog/digital out) */
> > + /* PowerMac11,2 (G5 Dual-Core and Quad) (analog in, analog/digital out) */
> > { .layout_id = 68,
> > .codecs[0] = {
> > .name = "onyx",
> > .connections = onyx_connections_nomic,
> > },
> > },
> > - /* Quad PowerMac (digital in) */
> > + /* PowerMac11,2 (G5 Dual-Core and Quad) (digital in) */
> > { .layout_id = 69,
> > .codecs[0] = {
> > .name = "topaz",
> > @@ -521,14 +522,21 @@
> > .connections = onyx_connections_noheadphones,
> > },
> > },---
> > - /* PowerMac3,4 */
> > + /* PowerMac3,4 (Digital Audio) */
> > { .device_id = 14,
> > .codecs[0] = {
> > .name = "tas",
> > .connections = tas_connections_noline,
> > },
> > },
> > - /* PowerMac3,6 */
> > + /* PowerMac3,5 (Quicksilver) */
> > + { .device_id = 21,
> > + .codecs[0] = {
> > + .name = "tas",
> > + .connections = tas_connections_noline,
> > + },
> > + },
> > + /* PowerMac3,6 (Mirrored Drive Doors) */
> > { .device_id = 22,
> > .codecs[0] = {
> > .name = "tas",
> > diff -Naur linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c
> > --- linux-2.6.38-rc5-git2/sound/aoa/soundbus/i2sbus/core.c 2011-01-05 01:50:19.000000000 +0100
> > +++ linux-2.6.38-rc5-git2-aoa-PowerMac3,5/sound/aoa/soundbus/i2sbus/core.c 2011-02-17 18:44:36.000000000 +0100
> > @@ -200,7 +200,7 @@
> > * We probably cannot handle all device-id machines,
> > * so restrict to those we do handle for now.
> > */
> > - if (id && (*id == 22 || *id == 14 || *id == 35)) {
> > + if (id && (*id == 22 || *id == 21 || *id == 14 || *id == 35)) {
> > snprintf(dev->sound.modalias, 32,
> > "aoa-device-id-%d", *id);
> > ok = 1;
> >
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* powerpc/ptrace: Fix bug in signal handling
From: Michael Wolf @ 2011-02-22 20:30 UTC (permalink / raw)
To: linuxppc-dev; +Cc: anton
In some cases during a threaded core dump not all
the threads will have a full register set. This
will cause problems when the sigkill is sent to
the thread
Signed-off-by: Mike Wolf <mjw@linux.vnet.ibm.com>
-------
--- ptrace-signal.orig/arch/powerpc/kernel/ptrace.c 2011-02-20 12:15:57.000000000 -0600
+++ ptrace-signal/arch/powerpc/kernel/ptrace.c 2011-02-21 12:39:17.000000000 -0600
@@ -234,11 +234,23 @@
if (target->thread.regs == NULL)
return -EIO;
- CHECK_FULL_REGS(target->thread.regs);
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
- target->thread.regs,
- 0, offsetof(struct pt_regs, msr));
+ if (!FULL_REGS(target->thread.regs)) {
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+ target->thread.regs,
+ 0, sizeof(long)*PT_R14);
+ if (!ret)
+ ret = user_regset_copyout_poison(&pos, &count, &kbuf, &ubuf,
+ sizeof(long)*PT_R14, offsetof(struct pt_regs, nip));
+ if (!ret)
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+ target->thread.regs,
+ offsetof(struct pt_regs, nip), offsetof(struct pt_regs, msr));
+
+ } else
+ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+ target->thread.regs,
+ 0, offsetof(struct pt_regs, msr));
if (!ret) {
unsigned long msr = get_user_msr(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &msr,
@@ -645,11 +657,24 @@
if (target->thread.regs == NULL)
return -EIO;
- CHECK_FULL_REGS(target->thread.regs);
-
pos /= sizeof(reg);
count /= sizeof(reg);
+ if(!FULL_REGS(target->thread.regs)) {
+ if (kbuf) {
+ for (; count > 0 && pos < PT_R14; --count)
+ *k++ = regs[pos++];
+ for (; count > 0 && pos < PT_R31; --count,pos++)
+ *k++ = 0xdeadbeef;
+ } else {
+ for (; count > 0 && pos < PT_R14; --count)
+ if (__put_user((compat_ulong_t) regs[pos++], u++))
+ return -EFAULT;
+ for (; count > 0 && pos < PT_R31; --count,pos++)
+ if (__put_user((compat_ulong_t) 0xdeadbeef, u++))
+ return -EFAULT;
+ }
+ }
if (kbuf)
for (; count > 0 && pos < PT_MSR; --count)
*k++ = regs[pos++];
--- ptrace-signal.orig/include/linux/regset.h 2011-02-20 12:15:57.000000000 -0600
+++ ptrace-signal/include/linux/regset.h 2011-02-21 12:39:17.000000000 -0600
@@ -240,6 +240,32 @@
}
return 0;
}
+static inline int user_regset_copyout_poison(unsigned int *pos,
+ unsigned int *count,
+ void **kbuf, void __user **ubuf,
+ const int start_pos,
+ const int end_pos)
+{
+ long poison_data[17] = { [0 ... 16] = 0xdeadbeefdeadbeefUL };
+
+ if (*count == 0)
+ return 0;
+ BUG_ON(*pos < start_pos);
+ if (end_pos < 0 || *pos < end_pos) {
+ unsigned int copy = (end_pos < 0 ? *count
+ : min(*count, end_pos - *pos));
+ if (*kbuf) {
+ memset(*kbuf, 0xdeadbeef, copy);
+ *kbuf += copy;
+ } else if (__copy_to_user(*ubuf,poison_data, copy))
+ return -EFAULT;
+ else
+ *ubuf += copy;
+ *pos += copy;
+ *count -= copy;
+ }
+ return 0;
+}
static inline int user_regset_copyin(unsigned int *pos, unsigned int *count,
const void **kbuf,
^ permalink raw reply
* [RFC PATCH 00/15] Remove last remains of of_platform_bus_type
From: Grant Likely @ 2011-02-23 4:33 UTC (permalink / raw)
To: Benjamin Herrenschmidt, devicetree-discuss, sfr, linux-kernel,
davem
Cc: sparclinux, linuxppc-dev
This series finally removes all the remaining users of the
of_platform_{,un}register_driver() functions that used to be sued with
the of_platform_bus_type. All the cool kids are using the platform
bus now. At the end of this series the ugly stop-gap shim code is finally
removed.
g.
---
Grant Likely (15):
dt/powerpc: move of_bus_type infrastructure to ibmebus
dt: add a match table pointer to struct device
dt/powerpc: Eliminate users of of_platform_{,un}register_driver
dt/sparc: Eliminate users of of_platform_{,un}register_driver
leds/leds-gpio: merge platform_driver with of_platform_driver
dt: xilinx_hwicap: merge platform and of_platform driver bindings
dt: uartlite: merge platform and of_platform driver bindings
dt/spi: Eliminate users of of_platform_{,un}register_driver
dt/sound: Eliminate users of of_platform_{,un}register_driver
dt/net: Eliminate users of of_platform_{,un}register_driver
dt/video: Eliminate users of of_platform_{,un}register_driver
dt/usb: Eliminate users of of_platform_{,un}register_driver
dt/serial: Eliminate users of of_platform_{,un}register_driver
dt: Eliminate of_platform_{,un}register_driver
dt: eliminate of_platform_driver shim code
arch/powerpc/kernel/ibmebus.c | 404 ++++++++++++++++++++++
arch/powerpc/kernel/of_platform.c | 7
arch/powerpc/platforms/52xx/mpc52xx_gpio.c | 14 -
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 10 -
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 11 -
arch/powerpc/platforms/82xx/ep8248e.c | 7
arch/powerpc/platforms/83xx/suspend.c | 14 -
arch/powerpc/platforms/cell/axon_msi.c | 11 -
arch/powerpc/platforms/pasemi/gpio_mdio.c | 9
arch/powerpc/sysdev/axonram.c | 11 -
arch/powerpc/sysdev/bestcomm/bestcomm.c | 9
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 9
arch/powerpc/sysdev/fsl_msi.c | 13 -
arch/powerpc/sysdev/fsl_pmc.c | 7
arch/powerpc/sysdev/fsl_rio.c | 7
arch/powerpc/sysdev/pmi.c | 9
arch/powerpc/sysdev/qe_lib/qe.c | 7
arch/sparc/include/asm/parport.h | 6
arch/sparc/kernel/apc.c | 7
arch/sparc/kernel/auxio_64.c | 7
arch/sparc/kernel/central.c | 14 -
arch/sparc/kernel/chmc.c | 19 -
arch/sparc/kernel/pci_fire.c | 7
arch/sparc/kernel/pci_psycho.c | 7
arch/sparc/kernel/pci_sabre.c | 9
arch/sparc/kernel/pci_schizo.c | 11 -
arch/sparc/kernel/pci_sun4v.c | 7
arch/sparc/kernel/pmc.c | 7
arch/sparc/kernel/power.c | 6
arch/sparc/kernel/time_32.c | 6
arch/sparc/kernel/time_64.c | 18 -
drivers/ata/pata_mpc52xx.c | 8
drivers/ata/pata_of_platform.c | 9
drivers/ata/sata_dwc_460ex.c | 9
drivers/ata/sata_fsl.c | 9
drivers/atm/fore200e.c | 17 +
drivers/block/xsysace.c | 11 -
drivers/char/hw_random/n2-drv.c | 16 -
drivers/char/hw_random/pasemi-rng.c | 9
drivers/char/ipmi/ipmi_si_intf.c | 18 +
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 129 +++----
drivers/crypto/amcc/crypto4xx_core.c | 9
drivers/crypto/n2_core.c | 20 -
drivers/crypto/talitos.c | 9
drivers/dma/fsldma.c | 14 -
drivers/dma/mpc512x_dma.c | 9
drivers/dma/ppc4xx/adma.c | 11 -
drivers/edac/mpc85xx_edac.c | 27 +
drivers/edac/ppc4xx_edac.c | 23 -
drivers/hwmon/ultra45_env.c | 9
drivers/i2c/busses/i2c-cpm.c | 9
drivers/i2c/busses/i2c-ibm_iic.c | 9
drivers/i2c/busses/i2c-mpc.c | 22 -
drivers/input/misc/sparcspkr.c | 22 +
drivers/input/serio/i8042-sparcio.h | 8
drivers/input/serio/xilinx_ps2.c | 9
drivers/leds/leds-gpio.c | 206 +++++------
drivers/macintosh/smu.c | 7
drivers/macintosh/therm_pm72.c | 8
drivers/macintosh/therm_windtunnel.c | 9
drivers/media/video/fsl-viu.c | 9
drivers/mmc/host/sdhci-of-core.c | 12 -
drivers/mtd/maps/physmap_of.c | 15 -
drivers/mtd/maps/sun_uflash.c | 8
drivers/mtd/nand/fsl_upm.c | 9
drivers/mtd/nand/mpc5121_nfc.c | 9
drivers/mtd/nand/ndfc.c | 9
drivers/mtd/nand/pasemi_nand.c | 9
drivers/mtd/nand/socrates_nand.c | 9
drivers/net/can/mscan/mpc5xxx_can.c | 15 -
drivers/net/can/sja1000/sja1000_of_platform.c | 9
drivers/net/fec_mpc52xx.c | 13 -
drivers/net/fec_mpc52xx.h | 2
drivers/net/fec_mpc52xx_phy.c | 5
drivers/net/fs_enet/fs_enet-main.c | 16 -
drivers/net/fs_enet/mii-bitbang.c | 9
drivers/net/fs_enet/mii-fec.c | 15 -
drivers/net/fsl_pq_mdio.c | 9
drivers/net/gianfar.c | 12 -
drivers/net/greth.c | 8
drivers/net/ibm_newemac/core.c | 9
drivers/net/ibm_newemac/mal.c | 9
drivers/net/ibm_newemac/rgmii.c | 9
drivers/net/ibm_newemac/tah.c | 9
drivers/net/ibm_newemac/zmii.c | 9
drivers/net/ll_temac_main.c | 9
drivers/net/myri_sbus.c | 8
drivers/net/niu.c | 11 -
drivers/net/phy/mdio-gpio.c | 9
drivers/net/sunbmac.c | 9
drivers/net/sunhme.c | 14 -
drivers/net/sunlance.c | 8
drivers/net/sunqe.c | 8
drivers/net/ucc_geth.c | 8
drivers/net/xilinx_emaclite.c | 9
drivers/of/device.c | 34 --
drivers/of/platform.c | 461 -------------------------
drivers/parport/parport_sunbpp.c | 8
drivers/pcmcia/electra_cf.c | 9
drivers/pcmcia/m8xx_pcmcia.c | 9
drivers/rtc/rtc-mpc5121.c | 9
drivers/sbus/char/bbc_i2c.c | 9
drivers/sbus/char/display7seg.c | 9
drivers/sbus/char/envctrl.c | 9
drivers/sbus/char/flash.c | 9
drivers/sbus/char/uctrl.c | 9
drivers/scsi/qlogicpti.c | 14 -
drivers/scsi/sun_esp.c | 8
drivers/spi/mpc512x_psc_spi.c | 9
drivers/spi/mpc52xx_psc_spi.c | 9
drivers/spi/mpc52xx_spi.c | 9
drivers/spi/spi_fsl_espi.c | 11 -
drivers/spi/spi_fsl_lib.c | 3
drivers/spi/spi_fsl_lib.h | 3
drivers/spi/spi_fsl_spi.c | 11 -
drivers/spi/spi_ppc4xx.c | 9
drivers/tty/serial/apbuart.c | 11 -
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 9
drivers/tty/serial/mpc52xx_uart.c | 13 -
drivers/tty/serial/of_serial.c | 14 -
drivers/tty/serial/sunhv.c | 8
drivers/tty/serial/sunsab.c | 8
drivers/tty/serial/sunsu.c | 6
drivers/tty/serial/sunzilog.c | 10 -
drivers/tty/serial/uartlite.c | 103 +-----
drivers/tty/serial/ucc_uart.c | 9
drivers/usb/gadget/fsl_qe_udc.c | 14 -
drivers/usb/host/ehci-hcd.c | 12 -
drivers/usb/host/ehci-ppc-of.c | 9
drivers/usb/host/ehci-xilinx-of.c | 6
drivers/usb/host/fhci-hcd.c | 9
drivers/usb/host/isp1760-if.c | 9
drivers/usb/host/ohci-hcd.c | 6
drivers/usb/host/ohci-ppc-of.c | 9
drivers/video/bw2.c | 8
drivers/video/cg14.c | 8
drivers/video/cg3.c | 9
drivers/video/cg6.c | 9
drivers/video/ffb.c | 9
drivers/video/fsl-diu-fb.c | 9
drivers/video/leo.c | 9
drivers/video/mb862xx/mb862xxfb.c | 9
drivers/video/p9100.c | 8
drivers/video/platinumfb.c | 9
drivers/video/sunxvr1000.c | 9
drivers/video/tcx.c | 9
drivers/video/xilinxfb.c | 11 -
drivers/watchdog/cpwd.c | 9
drivers/watchdog/gef_wdt.c | 9
drivers/watchdog/mpc8xxx_wdt.c | 15 -
drivers/watchdog/riowd.c | 9
include/linux/device.h | 1
include/linux/of_device.h | 5
include/linux/of_platform.h | 18 -
sound/soc/fsl/fsl_dma.c | 9
sound/soc/fsl/fsl_ssi.c | 9
sound/soc/fsl/mpc5200_dma.c | 24 +
sound/soc/fsl/mpc5200_psc_ac97.c | 9
sound/soc/fsl/mpc5200_psc_i2s.c | 9
sound/sparc/amd7930.c | 8
sound/sparc/cs4231.c | 16 -
sound/sparc/dbri.c | 8
162 files changed, 1278 insertions(+), 1627 deletions(-)
--
Signature
^ permalink raw reply
* [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus
From: Grant Likely @ 2011-02-23 4:33 UTC (permalink / raw)
To: Benjamin Herrenschmidt, devicetree-discuss, sfr, linux-kernel,
davem
Cc: sparclinux, linuxppc-dev
In-Reply-To: <20110223043015.20795.37090.stgit@localhost6.localdomain6>
arch/powerpc/kernel/ibmebus.c is the only remaining user of the
of_bus_type support code for initializing the bus and registering
drivers. All others have either been switched to the vanilla platform
bus or already have their own infrastructure.
This patch moves the functionality that ibmebus is using out of
drivers/of/{platform,device}.c and into ibmebus.c where it is actually
used. Also renames the moved symbols from of_platform_* to
ibmebus_bus_* to reflect the actual usage.
This patch is part of moving all of the of_platform_bus_type users
over to the platform_bus_type.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/kernel/ibmebus.c | 404 +++++++++++++++++++++++++++++++++++++++++
drivers/of/device.c | 34 ---
drivers/of/platform.c | 393 ----------------------------------------
include/linux/of_platform.h | 6 -
4 files changed, 400 insertions(+), 437 deletions(-)
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index f62efdf..c00d4ca 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -201,13 +201,14 @@ int ibmebus_register_driver(struct of_platform_driver *drv)
/* If the driver uses devices that ibmebus doesn't know, add them */
ibmebus_create_devices(drv->driver.of_match_table);
- return of_register_driver(drv, &ibmebus_bus_type);
+ drv->driver.bus = &ibmebus_bus_type;
+ return driver_register(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_register_driver);
void ibmebus_unregister_driver(struct of_platform_driver *drv)
{
- of_unregister_driver(drv);
+ driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_unregister_driver);
@@ -308,15 +309,410 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
}
}
+
static struct bus_attribute ibmebus_bus_attrs[] = {
__ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
__ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
__ATTR_NULL
};
+static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
+{
+ const struct of_device_id *matches = drv->of_match_table;
+
+ if (!matches)
+ return 0;
+
+ return of_match_device(matches, dev) != NULL;
+}
+
+static int ibmebus_bus_device_probe(struct device *dev)
+{
+ int error = -ENODEV;
+ struct of_platform_driver *drv;
+ struct platform_device *of_dev;
+ const struct of_device_id *match;
+
+ drv = to_of_platform_driver(dev->driver);
+ of_dev = to_platform_device(dev);
+
+ if (!drv->probe)
+ return error;
+
+ of_dev_get(of_dev);
+
+ match = of_match_device(drv->driver.of_match_table, dev);
+ if (match)
+ error = drv->probe(of_dev, match);
+ if (error)
+ of_dev_put(of_dev);
+
+ return error;
+}
+
+static int ibmebus_bus_device_remove(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+
+ if (dev->driver && drv->remove)
+ drv->remove(of_dev);
+ return 0;
+}
+
+static void ibmebus_bus_device_shutdown(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+
+ if (dev->driver && drv->shutdown)
+ drv->shutdown(of_dev);
+}
+
+/*
+ * ibmebus_bus_device_attrs
+ */
+static ssize_t devspec_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *ofdev;
+
+ ofdev = to_platform_device(dev);
+ return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
+}
+
+static ssize_t name_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *ofdev;
+
+ ofdev = to_platform_device(dev);
+ return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
+}
+
+static ssize_t modalias_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
+ buf[len] = '\n';
+ buf[len+1] = 0;
+ return len+1;
+}
+
+struct device_attribute ibmebus_bus_device_attrs[] = {
+ __ATTR_RO(devspec),
+ __ATTR_RO(name),
+ __ATTR_RO(modalias),
+ __ATTR_NULL
+};
+
+#ifdef CONFIG_PM_SLEEP
+static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+ int ret = 0;
+
+ if (dev->driver && drv->suspend)
+ ret = drv->suspend(of_dev, mesg);
+ return ret;
+}
+
+static int ibmebus_bus_legacy_resume(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+ int ret = 0;
+
+ if (dev->driver && drv->resume)
+ ret = drv->resume(of_dev);
+ return ret;
+}
+
+static int ibmebus_bus_pm_prepare(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (drv && drv->pm && drv->pm->prepare)
+ ret = drv->pm->prepare(dev);
+
+ return ret;
+}
+
+static void ibmebus_bus_pm_complete(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+
+ if (drv && drv->pm && drv->pm->complete)
+ drv->pm->complete(dev);
+}
+
+#ifdef CONFIG_SUSPEND
+
+static int ibmebus_bus_pm_suspend(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend)
+ ret = drv->pm->suspend(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend_noirq)
+ ret = drv->pm->suspend_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_resume(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->resume)
+ ret = drv->pm->resume(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_resume_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->resume_noirq)
+ ret = drv->pm->resume_noirq(dev);
+ }
+
+ return ret;
+}
+
+#else /* !CONFIG_SUSPEND */
+
+#define ibmebus_bus_pm_suspend NULL
+#define ibmebus_bus_pm_resume NULL
+#define ibmebus_bus_pm_suspend_noirq NULL
+#define ibmebus_bus_pm_resume_noirq NULL
+
+#endif /* !CONFIG_SUSPEND */
+
+#ifdef CONFIG_HIBERNATION
+
+static int ibmebus_bus_pm_freeze(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->freeze)
+ ret = drv->pm->freeze(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->freeze_noirq)
+ ret = drv->pm->freeze_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_thaw(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->thaw)
+ ret = drv->pm->thaw(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->thaw_noirq)
+ ret = drv->pm->thaw_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_poweroff(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->poweroff)
+ ret = drv->pm->poweroff(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->poweroff_noirq)
+ ret = drv->pm->poweroff_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_restore(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->restore)
+ ret = drv->pm->restore(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_restore_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->restore_noirq)
+ ret = drv->pm->restore_noirq(dev);
+ }
+
+ return ret;
+}
+
+#else /* !CONFIG_HIBERNATION */
+
+#define ibmebus_bus_pm_freeze NULL
+#define ibmebus_bus_pm_thaw NULL
+#define ibmebus_bus_pm_poweroff NULL
+#define ibmebus_bus_pm_restore NULL
+#define ibmebus_bus_pm_freeze_noirq NULL
+#define ibmebus_bus_pm_thaw_noirq NULL
+#define ibmebus_bus_pm_poweroff_noirq NULL
+#define ibmebus_bus_pm_restore_noirq NULL
+
+#endif /* !CONFIG_HIBERNATION */
+
+static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
+ .prepare = ibmebus_bus_pm_prepare,
+ .complete = ibmebus_bus_pm_complete,
+ .suspend = ibmebus_bus_pm_suspend,
+ .resume = ibmebus_bus_pm_resume,
+ .freeze = ibmebus_bus_pm_freeze,
+ .thaw = ibmebus_bus_pm_thaw,
+ .poweroff = ibmebus_bus_pm_poweroff,
+ .restore = ibmebus_bus_pm_restore,
+ .suspend_noirq = ibmebus_bus_pm_suspend_noirq,
+ .resume_noirq = ibmebus_bus_pm_resume_noirq,
+ .freeze_noirq = ibmebus_bus_pm_freeze_noirq,
+ .thaw_noirq = ibmebus_bus_pm_thaw_noirq,
+ .poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
+ .restore_noirq = ibmebus_bus_pm_restore_noirq,
+};
+
+#define IBMEBUS_BUS_PM_OPS_PTR (&ibmebus_bus_dev_pm_ops)
+
+#else /* !CONFIG_PM_SLEEP */
+
+#define IBMEBUS_BUS_PM_OPS_PTR NULL
+
+#endif /* !CONFIG_PM_SLEEP */
+
struct bus_type ibmebus_bus_type = {
+ .name = "ibmebus",
.uevent = of_device_uevent,
- .bus_attrs = ibmebus_bus_attrs
+ .bus_attrs = ibmebus_bus_attrs,
+ .match = ibmebus_bus_bus_match,
+ .probe = ibmebus_bus_device_probe,
+ .remove = ibmebus_bus_device_remove,
+ .shutdown = ibmebus_bus_device_shutdown,
+ .dev_attrs = ibmebus_bus_device_attrs,
+ .pm = IBMEBUS_BUS_PM_OPS_PTR,
};
EXPORT_SYMBOL(ibmebus_bus_type);
@@ -326,7 +722,7 @@ static int __init ibmebus_bus_init(void)
printk(KERN_INFO "IBM eBus Device Driver\n");
- err = of_bus_type_init(&ibmebus_bus_type, "ibmebus");
+ err = bus_register(&ibmebus_bus_type);
if (err) {
printk(KERN_ERR "%s: failed to register IBM eBus.\n",
__func__);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 45d8653..62b4b32 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -47,40 +47,6 @@ void of_dev_put(struct platform_device *dev)
}
EXPORT_SYMBOL(of_dev_put);
-static ssize_t devspec_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct platform_device *ofdev;
-
- ofdev = to_platform_device(dev);
- return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
-}
-
-static ssize_t name_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct platform_device *ofdev;
-
- ofdev = to_platform_device(dev);
- return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
-}
-
-static ssize_t modalias_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
- buf[len] = '\n';
- buf[len+1] = 0;
- return len+1;
-}
-
-struct device_attribute of_platform_device_attrs[] = {
- __ATTR_RO(devspec),
- __ATTR_RO(name),
- __ATTR_RO(modalias),
- __ATTR_NULL
-};
-
int of_device_add(struct platform_device *ofdev)
{
BUG_ON(ofdev->dev.of_node == NULL);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c01cd1a..b71d0cd 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -114,399 +114,6 @@ EXPORT_SYMBOL(of_unregister_platform_driver);
#include <asm/dcr.h>
#endif
-extern struct device_attribute of_platform_device_attrs[];
-
-static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
-{
- const struct of_device_id *matches = drv->of_match_table;
-
- if (!matches)
- return 0;
-
- return of_match_device(matches, dev) != NULL;
-}
-
-static int of_platform_device_probe(struct device *dev)
-{
- int error = -ENODEV;
- struct of_platform_driver *drv;
- struct platform_device *of_dev;
- const struct of_device_id *match;
-
- drv = to_of_platform_driver(dev->driver);
- of_dev = to_platform_device(dev);
-
- if (!drv->probe)
- return error;
-
- of_dev_get(of_dev);
-
- match = of_match_device(drv->driver.of_match_table, dev);
- if (match)
- error = drv->probe(of_dev, match);
- if (error)
- of_dev_put(of_dev);
-
- return error;
-}
-
-static int of_platform_device_remove(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
-
- if (dev->driver && drv->remove)
- drv->remove(of_dev);
- return 0;
-}
-
-static void of_platform_device_shutdown(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
-
- if (dev->driver && drv->shutdown)
- drv->shutdown(of_dev);
-}
-
-#ifdef CONFIG_PM_SLEEP
-
-static int of_platform_legacy_suspend(struct device *dev, pm_message_t mesg)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
- int ret = 0;
-
- if (dev->driver && drv->suspend)
- ret = drv->suspend(of_dev, mesg);
- return ret;
-}
-
-static int of_platform_legacy_resume(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
- int ret = 0;
-
- if (dev->driver && drv->resume)
- ret = drv->resume(of_dev);
- return ret;
-}
-
-static int of_platform_pm_prepare(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (drv && drv->pm && drv->pm->prepare)
- ret = drv->pm->prepare(dev);
-
- return ret;
-}
-
-static void of_platform_pm_complete(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
-
- if (drv && drv->pm && drv->pm->complete)
- drv->pm->complete(dev);
-}
-
-#ifdef CONFIG_SUSPEND
-
-static int of_platform_pm_suspend(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->suspend)
- ret = drv->pm->suspend(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_SUSPEND);
- }
-
- return ret;
-}
-
-static int of_platform_pm_suspend_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->suspend_noirq)
- ret = drv->pm->suspend_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_resume(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->resume)
- ret = drv->pm->resume(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_resume_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->resume_noirq)
- ret = drv->pm->resume_noirq(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_SUSPEND */
-
-#define of_platform_pm_suspend NULL
-#define of_platform_pm_resume NULL
-#define of_platform_pm_suspend_noirq NULL
-#define of_platform_pm_resume_noirq NULL
-
-#endif /* !CONFIG_SUSPEND */
-
-#ifdef CONFIG_HIBERNATION
-
-static int of_platform_pm_freeze(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->freeze)
- ret = drv->pm->freeze(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_FREEZE);
- }
-
- return ret;
-}
-
-static int of_platform_pm_freeze_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->freeze_noirq)
- ret = drv->pm->freeze_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_thaw(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->thaw)
- ret = drv->pm->thaw(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_thaw_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->thaw_noirq)
- ret = drv->pm->thaw_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_poweroff(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->poweroff)
- ret = drv->pm->poweroff(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_HIBERNATE);
- }
-
- return ret;
-}
-
-static int of_platform_pm_poweroff_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->poweroff_noirq)
- ret = drv->pm->poweroff_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_restore(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->restore)
- ret = drv->pm->restore(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_restore_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->restore_noirq)
- ret = drv->pm->restore_noirq(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_HIBERNATION */
-
-#define of_platform_pm_freeze NULL
-#define of_platform_pm_thaw NULL
-#define of_platform_pm_poweroff NULL
-#define of_platform_pm_restore NULL
-#define of_platform_pm_freeze_noirq NULL
-#define of_platform_pm_thaw_noirq NULL
-#define of_platform_pm_poweroff_noirq NULL
-#define of_platform_pm_restore_noirq NULL
-
-#endif /* !CONFIG_HIBERNATION */
-
-static struct dev_pm_ops of_platform_dev_pm_ops = {
- .prepare = of_platform_pm_prepare,
- .complete = of_platform_pm_complete,
- .suspend = of_platform_pm_suspend,
- .resume = of_platform_pm_resume,
- .freeze = of_platform_pm_freeze,
- .thaw = of_platform_pm_thaw,
- .poweroff = of_platform_pm_poweroff,
- .restore = of_platform_pm_restore,
- .suspend_noirq = of_platform_pm_suspend_noirq,
- .resume_noirq = of_platform_pm_resume_noirq,
- .freeze_noirq = of_platform_pm_freeze_noirq,
- .thaw_noirq = of_platform_pm_thaw_noirq,
- .poweroff_noirq = of_platform_pm_poweroff_noirq,
- .restore_noirq = of_platform_pm_restore_noirq,
-};
-
-#define OF_PLATFORM_PM_OPS_PTR (&of_platform_dev_pm_ops)
-
-#else /* !CONFIG_PM_SLEEP */
-
-#define OF_PLATFORM_PM_OPS_PTR NULL
-
-#endif /* !CONFIG_PM_SLEEP */
-
-int of_bus_type_init(struct bus_type *bus, const char *name)
-{
- bus->name = name;
- bus->match = of_platform_bus_match;
- bus->probe = of_platform_device_probe;
- bus->remove = of_platform_device_remove;
- bus->shutdown = of_platform_device_shutdown;
- bus->dev_attrs = of_platform_device_attrs;
- bus->pm = OF_PLATFORM_PM_OPS_PTR;
- return bus_register(bus);
-}
-
-int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
-{
- /*
- * Temporary: of_platform_bus used to be distinct from the platform
- * bus. It isn't anymore, and so drivers on the platform bus need
- * to be registered in a special way.
- *
- * After all of_platform_bus_type drivers are converted to
- * platform_drivers, this exception can be removed.
- */
- if (bus == &platform_bus_type)
- return of_register_platform_driver(drv);
-
- /* register with core */
- drv->driver.bus = bus;
- return driver_register(&drv->driver);
-}
-EXPORT_SYMBOL(of_register_driver);
-
-void of_unregister_driver(struct of_platform_driver *drv)
-{
- if (drv->driver.bus == &platform_bus_type)
- of_unregister_platform_driver(drv);
- else
- driver_unregister(&drv->driver);
-}
-EXPORT_SYMBOL(of_unregister_driver);
-
#if !defined(CONFIG_SPARC)
/*
* The following routines scan a subtree and registers a device for
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716a..048949f 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -47,10 +47,6 @@ struct of_platform_driver
#define to_of_platform_driver(drv) \
container_of(drv,struct of_platform_driver, driver)
-extern int of_register_driver(struct of_platform_driver *drv,
- struct bus_type *bus);
-extern void of_unregister_driver(struct of_platform_driver *drv);
-
/* Platform drivers register/unregister */
extern int of_register_platform_driver(struct of_platform_driver *drv);
extern void of_unregister_platform_driver(struct of_platform_driver *drv);
@@ -60,8 +56,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
struct device *parent);
extern struct platform_device *of_find_device_by_node(struct device_node *np);
-extern int of_bus_type_init(struct bus_type *bus, const char *name);
-
#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
/* Platform devices and busses creation */
extern struct platform_device *of_platform_device_create(struct device_node *np,
^ permalink raw reply related
* [RFC PATCH 02/15] dt: add a match table pointer to struct device
From: Grant Likely @ 2011-02-23 4:33 UTC (permalink / raw)
To: Benjamin Herrenschmidt, devicetree-discuss, sfr, linux-kernel,
davem
Cc: sparclinux, linuxppc-dev
In-Reply-To: <20110223043015.20795.37090.stgit@localhost6.localdomain6>
Add a new .of_match field to struct device which points at the
matching device driver .of_match_table entry when a device is probed
via the device tree
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
include/linux/device.h | 1 +
include/linux/of_device.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/device.h b/include/linux/device.h
index ca5d252..8d8e267 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -441,6 +441,7 @@ struct device {
struct dev_archdata archdata;
struct device_node *of_node; /* associated device tree node */
+ const struct of_device_id *of_match; /* matching of_device_id from driver */
dev_t devt; /* dev_t, creates the sysfs "dev" */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347..8bfe6c1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev);
* @drv: the device_driver structure to test
* @dev: the device structure to match against
*/
-static inline int of_driver_match_device(const struct device *dev,
+static inline int of_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
- return of_match_device(drv->of_match_table, dev) != NULL;
+ dev->of_match = of_match_device(drv->of_match_table, dev);
+ return dev->of_match != NULL;
}
extern struct platform_device *of_dev_get(struct platform_device *dev);
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox