Skip to contentSkip to conversation

86xx: Enable the AC97 interface on 8641D board.

PATCH Applied Jon Loeliger 5 participants 16 messages May 2, 2007 – May 10, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 86xx: Enable the AC97 interface on 8641D board.

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at the same time, In order to use AC97 interface, we need to disable the HD interface first.

---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +6 -1
index 3d3d98f..13a14dd 100644
@@ -168,7 +168,7 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
 {
 	unsigned short temp;
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-	unsigned char irq2pin[16];
+	unsigned char irq2pin[16], c;
 	unsigned long pirq_map_word = 0;
 	u32 irq;
 	int i;
@@ -288,6 +288,11 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
 	outb(0x1e, 0x4d1);
 
 #undef ULI1575_SET_DEV_IRQ
+
+	/* Disable the HD interface and enable the AC97 interface. */
+	pci_read_config_byte(dev, 0xb8, &c);
+	c &= 0x7f;
+	pci_write_config_byte(dev, 0xb8, c);
 }
 
 static void __devinit quirk_uli5288(struct pci_dev *dev)
Signature · 1 line
1.5.0.3
#1 lore raw
Quoted 11 lines · Jon Loeliger

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at the same time, In order to use AC97 interface, we need to disable the HD interface first.

---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Is the HD feature not used at all? Is there a AC97 Driver CONFIG_ that makes sense to wrap that with? Just wondering about the mutual exclusion (and how to provide flexibility to the user).

- k

Quoted 37 lines
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +1 -1
index 3d3d98f..13a14dd 100644
@@ -168,7 +168,7 @@ static void __devinit quirk_uli1575(struct  
 pci_dev *dev)
 {
 	unsigned short temp;
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-	unsigned char irq2pin[16];
+	unsigned char irq2pin[16], c;
 	unsigned long pirq_map_word = 0;
 	u32 irq;
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +5 -0
 	int i;
@@ -288,6 +288,11 @@ static void __devinit quirk_uli1575(struct  
 pci_dev *dev)
 	outb(0x1e, 0x4d1);
 
 #undef ULI1575_SET_DEV_IRQ
+
+	/* Disable the HD interface and enable the AC97 interface. */
+	pci_read_config_byte(dev, 0xb8, &c);
+	c &= 0x7f;
+	pci_write_config_byte(dev, 0xb8, c);
 }
 

static void __devinit quirk_uli5288(struct pci_dev *dev)

Signature · 8 lines
1.5.0.3



_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
#2 lore raw
Quoted 16 lines · Kumar Gala
Quoted 8 lines · Jon Loeliger

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at
the same time, In order to use AC97 interface, we need to disable the HD
interface first.

Quoted 5 lines
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 5 lines

Is the HD feature not used at all? Is there a AC97 Driver CONFIG_ that makes sense to wrap that with? Just wondering about the mutual exclusion (and how to provide flexibility to the user).

- k

The ULI supports both the HD and AC97 interfaces, but the 8641 only supports the AC97 interface. Thus we can straight disable the HD and convert/configure the shared pins to be AC97. Thus, there is no real CONFIG_ need at all. It's only AC97. And then ultimately, the presence of sound support is controlled by the ALSA config options as per normal.

Thanks,
jdl

#3 lore raw
Quoted 24 lines · Jon Loeliger
Quoted 16 lines · Kumar Gala
Quoted 8 lines · Jon Loeliger

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at
the same time, In order to use AC97 interface, we need to disable the HD
interface first.

Quoted 5 lines
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 5 lines

Is the HD feature not used at all? Is there a AC97 Driver CONFIG_ that makes sense to wrap that with? Just wondering about the mutual exclusion (and how to provide flexibility to the user).

- k

Quoted 6 lines

The ULI supports both the HD and AC97 interfaces, but the 8641 only supports the AC97 interface. Thus we can straight disable the HD and convert/configure the shared pins to be AC97. Thus, there is no real CONFIG_ need at all. It's only AC97. And then ultimately, the presence of sound support is controlled by the ALSA config options as per normal.

Ok. I'm guessing HD here isn't hard disk, but some audio thing.

- k

#4 lore raw
Quoted 1 line · Kumar Gala

Ok. I'm guessing HD here isn't hard disk, but some audio thing.

That is correct.

jdl

#5 lore raw
In reply to Jon Loeliger
Quoted 24 lines · Jon Loeliger
Quoted 16 lines · Kumar Gala
Quoted 8 lines · Jon Loeliger

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at
the same time, In order to use AC97 interface, we need to disable the HD
interface first.

Quoted 5 lines
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Quoted 5 lines

Is the HD feature not used at all? Is there a AC97 Driver CONFIG_ that makes sense to wrap that with? Just wondering about the mutual exclusion (and how to provide flexibility to the user).

- k

Quoted 6 lines

The ULI supports both the HD and AC97 interfaces, but the 8641 only supports the AC97 interface. Thus we can straight disable the HD and convert/configure the shared pins to be AC97. Thus, there is no real CONFIG_ need at all. It's only AC97. And then ultimately, the presence of sound support is controlled by the ALSA config options as per normal.

This sounds like something that firmware should take care of, not hardcoded in the board code. Seems like the device is just a PCI device that doesn't have a device tree entry.

Why not do this in u-boot instead?

-Olof

#6 lore raw
Quoted 4 lines · Olof Johansson

This sounds like something that firmware should take care of, not hardcoded in the board code. Seems like the device is just a PCI device that doesn't have a device tree entry.

Well, it's not a PCI device at all.

Quoted 1 line

Why not do this in u-boot instead?

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

jdl

#7 lore raw
Quoted 7 lines · Jon Loeliger
Quoted 4 lines · Olof Johansson

This sounds like something that firmware should take care of, not hardcoded in the board code. Seems like the device is just a PCI device that doesn't have a device tree entry.

Quoted 6 lines

Well, it's not a PCI device at all.

Quoted 1 line

Why not do this in u-boot instead?

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

I agree with Jon here. This is in board specific code so I don't see any issue with it.

- k

#11 lore raw
In reply to Jon Loeliger
Quoted 8 lines · Jon Loeliger
Quoted 4 lines · Olof Johansson

This sounds like something that firmware should take care of, not hardcoded in the board code. Seems like the device is just a PCI device that doesn't have a device tree entry.

Well, it's not a PCI device at all.

Really? You use a PCI quirk to manipulate it.

Quoted 4 lines
Quoted 1 line

Why not do this in u-boot instead?

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

The same argument could be used to motivate not doing any kind of board inits in any firmware and do it all from the board code in linux.

Don't you guys use M1575 on other eval boards too, so you'll need the same board quirk duplicated?

-Olof

#8 lore raw
In reply to Kumar Gala
Quoted 9 lines · Kumar Gala
Quoted 4 lines · Jon Loeliger
Quoted 1 line

Why not do this in u-boot instead?

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

I agree with Jon here. This is in board specific code so I don't see any issue with it.

Good to know. I'll keep that in mind myself for future reference, no need to waste effort trying to get clean board ports.

-Olof

#12 lore raw
In reply to Olof Johansson
Quoted 6 lines · Olof Johansson
Quoted 2 lines · Jon Loeliger

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

The same argument could be used to motivate not doing any kind of board inits in any firmware and do it all from the board code in linux.

Not to mention that it's more likely that someone will use a different OS than different firmware, and then they'd have to duplicate the board code *there*.

-Scott

#13 lore raw
In reply to Jon Loeliger
Quoted 7 lines · Jon Loeliger
Quoted 3 lines · Olof Johansson

This sounds like something that firmware should take care of, not hardcoded in the board code. Seems like the device is just a PCI device that doesn't have a device tree entry.

Well, it's not a PCI device at all.

A PCI Express southbridge - not much difference really is there?

Quoted 4 lines
Quoted 1 line

Why not do this in u-boot instead?

Why do it there? We'd have to do it _again_ in Linux if we didn't come in from U-Boot anyway.

Because the firmware should configure the board specifics if possible, Linux should only be tweaking Northbridge/Southbridge settings if it is truly configurable at runtime or boot. If the difference is between whether an AC97 or Azalia codec is installed and soldered to the board, and it is not possible to have both, really the firmware should be setting up the chip so that only one is obviously usable.

Ostensibly Linux and any drivers should be able to check which is enabled on the board - one revision may have AC97 and one may have Azalia HD audio. If this can be swapped by simply having each driver check the enabled codec mode on init, and dropping out if not correct, then it's starting to get to be Plug And Play.

The alternative is that every revision of the board has it Hardcoded Into A Board Support Package, with different device trees and strange quirks which may or may not be easily determined, cluttering Kconfigs and so on.

In theory; the firmware should do it, and if not, it should be done as early in Linux boot (platform init, device tree fixup) as possible. That's how we agreed to do it on the Efika after much, much discussion and argument :D

Signature · 2 lines
Matt Sealey <[email protected]>
Genesi, Manager, Developer Relations
#9 lore raw
In reply to Kumar Gala
Quoted 2 lines · Kumar Gala

I agree with Jon here. This is in board specific code so I don't see any issue with it.

Hi Kumar,

So, bottom line, will you pick this patch up and
pass it along to Paul?

Thanks,
jdl

#10 lore raw
Quoted 10 lines · Jon Loeliger
Quoted 2 lines · Kumar Gala

I agree with Jon here. This is in board specific code so I don't see any issue with it.

Hi Kumar,

So, bottom line, will you pick this patch up and
pass it along to Paul?

will do.

- k

Applied
#14 lore raw
In reply to Jon Loeliger
Quoted 6 lines · Jon Loeliger

From: Jason Jin <[email protected]>

HD interface and AC97 interface share some pins and they are enabled at the same time, In order to use AC97 interface, we need to disable the HD interface first.

Quoted 6 lines
---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

applied.

- k

#15 lore raw
Quoted 4 lines · Kumar Gala
Quoted 2 lines · Jon Loeliger

From: Jason Jin <[email protected]>

Quoted 8 lines
Quoted 4 lines

HD interface and AC97 interface share some pins and they are enabled at the same time, In order to use AC97 interface, we need to disable the HD interface first.

applied.

- k

Thank you!

jdl