Skip to contentSkip to conversation

au1xxx: make linux-mips more useful for au1200 users

PATCH Applied Domen Puncer 4 participants 22 messages Jun 23, 2006 – Jun 24, 2006

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover au1xxx: make linux-mips more useful for au1200 users

Hi Ralf, list!

I would like the following patches merged:
[patch 1/8] au1xxx: psc fixes + add au1200 adresses [patch 2/8] au1xxx: I2C fixes
[patch 3/8] au1xxx: I2C support for au1200
[patch 4/8] au1xxx: dbdma, no sleeping under spin_lock [patch 5/8] au1xxx: export dbdma functions
[patch 6/8] au1xxx: oss sound support for au1200 [patch 7/8] au1xxx: compile fixes for OHCI for au1200 [patch 8/8] au1xxx: pcmcia: fix __init called from non-init

You might have a problem with 7/8, others should be fine.

Oh... and the diffstat:

 arch/mips/au1000/common/dbdma.c           |    6 +++++-
 drivers/i2c/busses/Kconfig                |    6 +++---
 drivers/i2c/busses/i2c-au1550.c           |   18 ++++++++++++------
 drivers/pcmcia/au1000_db1x00.c            |    2 +-
 drivers/usb/host/ohci-au1xxx.c            |    6 ++++--
 include/asm-mips/mach-au1x00/au1xxx_psc.h |    9 +++++++--
 sound/oss/Kconfig                         |    5 +++--
 sound/oss/au1550_ac97.c                   |    2 ++
 8 files changed, 37 insertions(+), 17 deletions(-)

Comments, flames?

Domen

#1 lore raw

PATCH 1/8 au1xxx: psc fixes + add au1200 adresses

Based on Jordan Crusoe's i2c patch:
- fix PSC3_BASE_ADDR to match au1550 databook
- fix PSC_SMBTXRX_RSR
- add PSC addresses for au1200

include/asm-mips/mach-au1x00/au1xxx_psc.h +7 -2
Index: linux-mailed/include/asm-mips/mach-au1x00/au1xxx_psc.h
===================================================================
@@ -40,7 +40,12 @@
 #define PSC0_BASE_ADDR		0xb1a00000
 #define PSC1_BASE_ADDR		0xb1b00000
 #define PSC2_BASE_ADDR		0xb0a00000
-#define PSC3_BASE_ADDR		0xb0d00000
+#define PSC3_BASE_ADDR		0xb0b00000
+#endif
+
+#ifdef CONFIG_SOC_AU1200
+#define PSC0_BASE_ADDR		0xb1a00000
+#define PSC1_BASE_ADDR		0xb1b00000
 #endif
 
 /* The PSC select and control registers are common to
@@ -506,7 +511,7 @@ typedef struct	psc_smb {
 
 /* Transmit register control.
 */
-#define PSC_SMBTXRX_RSR		(1 << 30)
+#define PSC_SMBTXRX_RSR		(1 << 28)
 #define PSC_SMBTXRX_STP		(1 << 29)
 #define PSC_SMBTXRX_DATAMASK	(0xff)
 
Applied
#2 lore raw

Re: [patch 1/8] au1xxx: psc fixes + add au1200 adresses

On Fri, Jun 23, 2006 at 11:58:31AM +0200, Domen Puncer wrote:

Applied.

Ralf

#3 lore raw

Re: [patch 1/8] au1xxx: psc fixes + add au1200 adresses

In reply to Domen Puncer

Hello.

Quoted 4 lines · Domen Puncer

Based on Jordan Crusoe's i2c patch:
- fix PSC3_BASE_ADDR to match au1550 databook
- fix PSC_SMBTXRX_RSR
- add PSC addresses for au1200

That was my patch, originally. And (surprise!) it just went from the -mm
tree to Linus. Congrats, now we're going to have a patch conflict. :-)

Quoted 21 lines

Index: linux-mailed/include/asm-mips/mach-au1x00/au1xxx_psc.h
===================================================================

include/asm-mips/mach-au1x00/au1xxx_psc.h +6 -1
@@ -40,7 +40,12 @@
 #define PSC0_BASE_ADDR		0xb1a00000
 #define PSC1_BASE_ADDR		0xb1b00000
 #define PSC2_BASE_ADDR		0xb0a00000
-#define PSC3_BASE_ADDR		0xb0d00000
+#define PSC3_BASE_ADDR		0xb0b00000
+#endif
+
+#ifdef CONFIG_SOC_AU1200
+#define PSC0_BASE_ADDR		0xb1a00000
+#define PSC1_BASE_ADDR		0xb1b00000
 #endif
 
 /* The PSC select and control registers are common to

include/asm-mips/mach-au1x00/au1xxx_psc.h typedef struct psc_smb { · line 516

Quoted 7 lines
include/asm-mips/mach-au1x00/au1xxx_psc.h +1 -1
@@ -506,7 +511,7 @@ typedef struct	psc_smb {
 
 /* Transmit register control.
 */
-#define PSC_SMBTXRX_RSR		(1 << 30)
+#define PSC_SMBTXRX_RSR		(1 << 28)
 #define PSC_SMBTXRX_STP		(1 << 29)
 #define PSC_SMBTXRX_DATAMASK	(0xff)

WBR, Sergei

#4 lore raw

Re: [patch 1/8] au1xxx: psc fixes + add au1200 adresses

Quoted 10 lines · Sergei Shtylyov

Hello.

Quoted 4 lines · Domen Puncer

Based on Jordan Crusoe's i2c patch:
- fix PSC3_BASE_ADDR to match au1550 databook
- fix PSC_SMBTXRX_RSR
- add PSC addresses for au1200

That was my patch, originally. And (surprise!) it just went from the -mm
tree to Linus. Congrats, now we're going to have a patch conflict. :-)

Oh... sorry.

I guess waiting sometimes does solve the problem :-)

Domen

#5 lore raw

Re: [patch 1/8] au1xxx: psc fixes + add au1200 adresses

In reply to Sergei Shtylyov
Quoted 2 lines · Sergei Shtylyov

That was my patch, originally. And (surprise!) it just went from the -mm
tree to Linus. Congrats, now we're going to have a patch conflict. :-)

Shit happens - but it's annoying have to sort that out so better be avoided ...

Ralf

#6 lore raw

PATCH 2/8 au1xxx: I2C fixes

In reply to Domen Puncer

- I2C fixes from Jordan Crusoe
- add SMBUS functionality flags

drivers/i2c/busses/i2c-au1550.c +12 -6
Index: linux-mailed/drivers/i2c/busses/i2c-au1550.c
===================================================================
@@ -35,7 +35,7 @@
 #include <linux/i2c.h>
 
 #include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-pb1x00/pb1550.h>
+#include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1xxx_psc.h>
 
 #include "i2c-au1550.h"
@@ -118,13 +118,19 @@ do_address(struct i2c_au1550_data *adap,
 
 	/* Reset the FIFOs, clear events.
 	*/
-	sp->psc_smbpcr = PSC_SMBPCR_DC;
+	stat = sp->psc_smbstat;
 	sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR;
 	au_sync();
-	do {
-		stat = sp->psc_smbpcr;
+
+	if (!(stat & PSC_SMBSTAT_TE) || !(stat & PSC_SMBSTAT_RE)) {
+		sp->psc_smbpcr = PSC_SMBPCR_DC;
 		au_sync();
-	} while ((stat & PSC_SMBPCR_DC) != 0);
+		do {
+			stat = sp->psc_smbpcr;
+			au_sync();
+		} while ((stat & PSC_SMBPCR_DC) != 0);
+		udelay(50);
+	}
 
 	/* Write out the i2c chip address and specify operation
 	*/
@@ -279,7 +285,7 @@ au1550_xfer(struct i2c_adapter *i2c_adap
 static u32
 au1550_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_I2C;
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
 }
 
 static struct i2c_algorithm au1550_algo = {
#7 lore raw

Re: [patch 2/8] au1xxx: I2C fixes

Forwarded to the I2C maintainer.

Ralf

#8 lore raw

Re: [patch 2/8] au1xxx: I2C fixes

In reply to Domen Puncer

Hello.

drivers/i2c/busses/i2c-au1550.c line 37

Quoted 13 lines · Domen Puncer

- I2C fixes from Jordan Crusoe
- add SMBUS functionality flags

Index: linux-mailed/drivers/i2c/busses/i2c-au1550.c
===================================================================

drivers/i2c/busses/i2c-au1550.c +0 -0
@@ -35,7 +35,7 @@
 #include <linux/i2c.h>
 
 #include <asm/mach-au1x00/au1000.h>

<asm/mach-au1x00/au1xxx.h> also #include's that file, BTW. So, could be
omitted here...

drivers/i2c/busses/i2c-au1550.c line 41

Quoted 5 lines
drivers/i2c/busses/i2c-au1550.c +1 -1
-#include <asm/mach-pb1x00/pb1550.h>
+#include <asm/mach-au1x00/au1xxx.h>
 #include <asm/mach-au1x00/au1xxx_psc.h>
 
 #include "i2c-au1550.h"

WBR, Sergei

#9 lore raw

PATCH 3/8 au1xxx: I2C support for au1200

In reply to Domen Puncer

Add I2C support for au1200.

drivers/i2c/busses/Kconfig +3 -3
Index: linux-mailed/drivers/i2c/busses/Kconfig
===================================================================
@@ -75,11 +75,11 @@ config I2C_AMD8111
 	  will be called i2c-amd8111.
 
 config I2C_AU1550
-	tristate "Au1550 SMBus interface"
-	depends on I2C && SOC_AU1550
+	tristate "Au1550/Au1200 SMBus interface"
+	depends on I2C && (SOC_AU1550 || SOC_AU1200)
 	help
 	  If you say yes to this option, support will be included for the
-	  Au1550 SMBus interface.
+	  Au1550 and Au1200 SMBus interface.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-au1550.
#10 lore raw

Re: [patch 3/8] au1xxx: I2C support for au1200

Forwarded to the I2C maintainer.

Ralf

#11 lore raw

PATCH 4/8 au1xxx: dbdma, no sleeping under spin_lock

In reply to Domen Puncer

kmalloc under spin_lock can't sleep.

arch/mips/au1000/common/dbdma.c +1 -1
Index: linux-mailed/arch/mips/au1000/common/dbdma.c
===================================================================
@@ -290,7 +290,7 @@ au1xxx_dbdma_chan_alloc(u32 srcid, u32 d
 				/* If kmalloc fails, it is caught below same
 				 * as a channel not available.
 				 */
-				ctp = kmalloc(sizeof(chan_tab_t), GFP_KERNEL);
+				ctp = kmalloc(sizeof(chan_tab_t), GFP_ATOMIC);
 				chan_tab_ptr[i] = ctp;
 				break;
 			}
Applied
#12 lore raw

Re: [patch 4/8] au1xxx: dbdma, no sleeping under spin_lock

Quoted 1 line · Domen Puncer

kmalloc under spin_lock can't sleep.

Applied.

Ralf

#13 lore raw

PATCH 5/8 au1xxx: export dbdma functions

In reply to Domen Puncer

These are needed for au1550_ac97 module.

 arch/mips/au1000/common/dbdma.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/mips/au1000/common/dbdma.c +4 -0
Index: linux-mailed/arch/mips/au1000/common/dbdma.c
===================================================================
@@ -730,6 +730,8 @@ au1xxx_dbdma_get_dest(u32 chanid, void *
 	return rv;
 }
 
+EXPORT_SYMBOL(au1xxx_dbdma_get_dest);
+
 void
 au1xxx_dbdma_stop(u32 chanid)
 {
@@ -821,6 +823,8 @@ au1xxx_get_dma_residue(u32 chanid)
 	return rv;
 }
 
+EXPORT_SYMBOL(au1xxx_get_dma_residue);
+
 void
 au1xxx_dbdma_chan_free(u32 chanid)
 {
#15 lore raw

Re: [patch 5/8] au1xxx: export dbdma functions

These are needed for au1550_ac97 module.

arch/mips/au1000/common/dbdma.c +4 -0
Index: linux-mailed/arch/mips/au1000/common/dbdma.c
===================================================================
@@ -730,6 +730,8 @@ au1xxx_dbdma_get_dest(u32 chanid, void *
 	return rv;
 }
 
+EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest);
+
 void
 au1xxx_dbdma_stop(u32 chanid)
 {
@@ -821,6 +823,8 @@ au1xxx_get_dma_residue(u32 chanid)
 	return rv;
 }
 
+EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue);
+
 void
 au1xxx_dbdma_chan_free(u32 chanid)
 {
#16 lore raw

Re: [patch 5/8] au1xxx: export dbdma functions

Hello.

Quoted 18 lines · Domen Puncer

These are needed for au1550_ac97 module.

Index: linux-mailed/arch/mips/au1000/common/dbdma.c
===================================================================

arch/mips/au1000/common/dbdma.c +2 -0
@@ -730,6 +730,8 @@ au1xxx_dbdma_get_dest(u32 chanid, void *
 	return rv;
 }
 
+EXPORT_SYMBOL_GPL(au1xxx_dbdma_get_dest);
+
 void
 au1xxx_dbdma_stop(u32 chanid)
 {

arch/mips/au1000/common/dbdma.c au1xxx_get_dma_residue(u32 chanid) · line 830

Quoted 8 lines
arch/mips/au1000/common/dbdma.c +2 -0
@@ -821,6 +823,8 @@ au1xxx_get_dma_residue(u32 chanid)
 	return rv;
 }
 
+EXPORT_SYMBOL_GPL(au1xxx_get_dma_residue);
+
 void
 au1xxx_dbdma_chan_free(u32 chanid)
 {

I should note that without patch 6 applied (which marks the module as
GPL), this patch doesn't help. BTW, the other exports in this module are not GPL only...

WBR, Sergei

#17 lore raw

PATCH 6/8 au1xxx: oss sound support for au1200

In reply to Domen Puncer

au1550 ac97 driver works fine on au1200 too.

Comments at the top of file state this code is GPL, so lets mark it as GPL too.

sound/oss/Kconfig +3 -2
Index: linux-mailed/sound/oss/Kconfig
===================================================================
@@ -114,8 +114,9 @@ config SOUND_VRC5477
 	  with the AC97 codec.
 
 config SOUND_AU1550_AC97
-	tristate "Au1550 AC97 Sound"
-	depends on SOUND_PRIME && SOC_AU1550
+	tristate "Au1550/Au1200 AC97 Sound"
+	select SND_AC97_CODEC
+	depends on SOUND_PRIME && (SOC_AU1550 || SOC_AU1200)
 
 config SOUND_AU1550_I2S
 	tristate "Au1550 I2S Sound"
sound/oss/au1550_ac97.c +2 -0
Index: linux-mailed/sound/oss/au1550_ac97.c
===================================================================
@@ -1893,6 +1893,8 @@ static /*const */ struct file_operations
 
 MODULE_AUTHOR("Advanced Micro Devices (AMD), [email protected]");
 MODULE_DESCRIPTION("Au1550 AC97 Audio Driver");
+MODULE_LICENSE("GPL");
+
 
 static int __devinit
 au1550_probe(void)
#18 lore raw

PATCH 7/8 au1xxx: compile fixes for OHCI for au1200

In reply to Domen Puncer

Compile fixes for au1200 ohci.

First part looks a bit hackish... but it works for me.

drivers/usb/host/ohci-au1xxx.c +4 -2
Index: linux-mailed/drivers/usb/host/ohci-au1xxx.c
===================================================================
@@ -101,9 +101,11 @@ static void au1xxx_start_ohc(struct plat
 
 #endif  /* Au1200 */
 
+#ifndef CONFIG_SOC_AU1200
 	/* wait for reset complete (read register twice; see au1500 errata) */
 	while (au_readl(USB_HOST_CONFIG),
 		!(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
+#endif
 		udelay(1000);
 
 	printk(KERN_DEBUG __FILE__
@@ -157,9 +159,9 @@ static int usb_ohci_au1xxx_probe(const s
 	/* Au1200 AB USB does not support coherent memory */
 	if (!(read_c0_prid() & 0xff)) {
 		pr_info("%s: this is chip revision AB !!\n",
-			dev->dev.name);
+			dev->name);
 		pr_info("%s: update your board or re-configure the kernel\n",
-			dev->dev.name);
+			dev->name);
 		return -ENODEV;
 	}
 #endif
#19 lore raw

Re: [patch 7/8] au1xxx: compile fixes for OHCI for au1200

Quoted 3 lines · Domen Puncer

Compile fixes for au1200 ohci.

First part looks a bit hackish... but it works for me.

That very much represents the character of the Alchemy code, I'm afaird. Which in turn probably is the result of a few too many hardware variants.

Forwarded to the USB maintainer & list.

Ralf

#20 lore raw

PATCH 8/8 au1xxx: pcmcia: fix __init called from non-init

In reply to Domen Puncer

This must not be marked __init, as it is called from au1x00_drv_pcmcia_probe.

drivers/pcmcia/au1000_db1x00.c +1 -1
Index: linux-mailed/drivers/pcmcia/au1000_db1x00.c
===================================================================
@@ -296,7 +296,7 @@ struct pcmcia_low_level db1x00_pcmcia_op
 	.socket_suspend		= db1x00_socket_suspend
 };
 
-int __init au1x_board_init(struct device *dev)
+int au1x_board_init(struct device *dev)
 {
 	int ret = -ENODEV;
 	bcsr->pcmcia = 0; /* turn off power, if it's not already off */
#21 lore raw

Re: [patch 8/8] au1xxx: pcmcia: fix __init called from non-init

Forwarded to the PCMCIA list.

Ralf