Skip to contentSkip to conversation

fix ucb1x00 support on collie

PATCH In review Pavel Machek 3 participants 5 messages Jul 31, 2005 – Aug 12, 2005 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix ucb1x00 support on collie

Collie is slightly strange; it does not seem to have proper ucb1x00 ID. With this patch, basic ucb support seems to work and I can get interrupts from battery.

---
commit 7247714847e6e3eebcdd71c58a4f730e12f0e56b tree 555a0b987efd7b625097032bf894620574472f2c parent 5a5269552a832668451518423ab7c1ece8d814e8 author <pavel@amd.(none)> Sun, 31 Jul 2005 15:45:30 +0200 committer <pavel@amd.(none)> Sun, 31 Jul 2005 15:45:30 +0200

 drivers/misc/mcp-sa1100.c   |   13 +++++++++++--
 drivers/misc/ucb1x00-core.c |   15 ++++++++++-----
 2 files changed, 21 insertions(+), 7 deletions(-)
drivers/misc/mcp-sa1100.c +11 -2
@@ -149,7 +149,7 @@ static int mcp_sa1100_probe(struct devic
 	    !machine_is_graphicsmaster() && !machine_is_lart()           &&
 	    !machine_is_omnimeter()      && !machine_is_pfs168()         &&
 	    !machine_is_shannon()        && !machine_is_simpad()         &&
-	    !machine_is_yopy())
+	    !machine_is_yopy()		 && !machine_is_collie())
 		return -ENODEV;
 
 	if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp"))
@@ -170,6 +170,12 @@ static int mcp_sa1100_probe(struct devic
 		ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
 	}
 
+	if (machine_is_collie()) {
+		GAFR &= ~(GPIO_GPIO(16));
+		GPDR |= GPIO_GPIO(16);
+		GPSR |= GPIO_GPIO(16);
+	}
+
 	/*
 	 * Setup the PPC unit correctly.
 	 */
@@ -181,7 +187,10 @@ static int mcp_sa1100_probe(struct devic
 
 	Ser4MCSR = -1;
 	Ser4MCCR1 = 0;
-	Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;
+	if (machine_is_collie()) 
+		Ser4MCCR0 = MCCR0_ADM | MCCR0_ExtClk;
+	else
+		Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;
 
 	/*
 	 * Calculate the read/write timeout (us) from the bit clock
drivers/misc/ucb1x00-core.c +10 -5
@@ -28,6 +28,7 @@
 #include <asm/dma.h>
 #include <asm/hardware.h>
 #include <asm/irq.h>
+#include <asm/mach-types.h>
 
 #include <asm/arch/ucb1x00.h>
 
@@ -461,15 +462,19 @@ static int ucb1x00_probe(struct mcp *mcp
 {
 	struct ucb1x00 *ucb;
 	struct ucb1x00_driver *drv;
-	unsigned int id;
+	unsigned int id = UCB_ID_1200;
 	int ret = -ENODEV;
 
 	mcp_enable(mcp);
-	id = mcp_reg_read(mcp, UCB_ID);
 
-	if (id != UCB_ID_1200 && id != UCB_ID_1300) {
-		printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id);
-		goto err_disable;
+	if (!machine_is_collie()) {
+		id = mcp_reg_read(mcp, UCB_ID);
+
+		/* Ouch? Collie produces basically random numbers. */
+		if (id != UCB_ID_1200 && id != UCB_ID_1300) {
+			printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id);
+			goto err_disable;
+		}
 	}
 
 	ucb = kmalloc(sizeof(struct ucb1x00), GFP_KERNEL);
Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#1 lore raw
Quoted 3 lines · Pavel Machek

Collie is slightly strange; it does not seem to have proper ucb1x00 ID. With this patch, basic ucb support seems to work and I can get interrupts from battery.

Out of interest, what ID does it appear to have?

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 152

Quoted 9 lines
drivers/misc/mcp-sa1100.c +1 -1
@@ -149,7 +149,7 @@ static int mcp_sa1100_probe(struct devic
 	    !machine_is_graphicsmaster() && !machine_is_lart()           &&
 	    !machine_is_omnimeter()      && !machine_is_pfs168()         &&
 	    !machine_is_shannon()        && !machine_is_simpad()         &&
-	    !machine_is_yopy())
+	    !machine_is_yopy()		 && !machine_is_collie())

I think it's about time we did something better with this, like only registering the platform device on those which use it.

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 193

Quoted 9 lines
drivers/misc/mcp-sa1100.c +4 -1
@@ -181,7 +187,10 @@ static int mcp_sa1100_probe(struct devic
 
 	Ser4MCSR = -1;
 	Ser4MCCR1 = 0;
-	Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;
+	if (machine_is_collie()) 
+		Ser4MCCR0 = MCCR0_ADM | MCCR0_ExtClk;
+	else
+		Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;

And this setup should probably be passed as part of the platform device data.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 22 lines · Russell King
Quoted 3 lines · Pavel Machek

Collie is slightly strange; it does not seem to have proper ucb1x00 ID. With this patch, basic ucb support seems to work and I can get interrupts from battery.

Out of interest, what ID does it appear to have?

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 152

Quoted 9 lines
drivers/misc/mcp-sa1100.c +1 -1
@@ -149,7 +149,7 @@ static int mcp_sa1100_probe(struct devic
 	    !machine_is_graphicsmaster() && !machine_is_lart()           &&
 	    !machine_is_omnimeter()      && !machine_is_pfs168()         &&
 	    !machine_is_shannon()        && !machine_is_simpad()         &&
-	    !machine_is_yopy())
+	    !machine_is_yopy()		 && !machine_is_collie())

I think it's about time we did something better with this, like only registering the platform device on those which use it.

Quoted 2 lines
drivers/misc/mcp-sa1100.c +0 -0
@@ -181,7 +187,10 @@ static int mcp_sa1100_probe(struct devic
 
Quoted 10 lines

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 193

Quoted 7 lines
drivers/misc/mcp-sa1100.c +4 -1
 	Ser4MCSR = -1;
 	Ser4MCCR1 = 0;
-	Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;
+	if (machine_is_collie()) 
+		Ser4MCCR0 = MCCR0_ADM | MCCR0_ExtClk;
+	else
+		Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;

And this setup should probably be passed as part of the platform device data.

Ok, new set of patches on the ftp site with the above two items resolved. I've also moved it into drivers/mfd and linked that directory into kbuild.

Of course, the audio driver isn't expected to build without Nico's sa11x0 audio support.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#3 lore raw

Hi!

Quoted 27 lines
Quoted 16 lines

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 152

Quoted 10 lines
drivers/misc/mcp-sa1100.c +1 -1
@@ -149,7 +149,7 @@ static int mcp_sa1100_probe(struct devic
 	    !machine_is_graphicsmaster() && !machine_is_lart()           &&
 	    !machine_is_omnimeter()      && !machine_is_pfs168()         &&
 	    !machine_is_shannon()        && !machine_is_simpad()         &&
-	    !machine_is_yopy())
+	    !machine_is_yopy()		 && !machine_is_collie())

I think it's about time we did something better with this, like only registering the platform device on those which use it.

Quoted 2 lines
drivers/misc/mcp-sa1100.c +0 -0
@@ -181,7 +187,10 @@ static int mcp_sa1100_probe(struct devic
 
Quoted 10 lines

drivers/misc/mcp-sa1100.c static int mcp_sa1100_probe(struct devic · line 193

Quoted 7 lines
drivers/misc/mcp-sa1100.c +4 -1
 	Ser4MCSR = -1;
 	Ser4MCCR1 = 0;
-	Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;
+	if (machine_is_collie()) 
+		Ser4MCCR0 = MCCR0_ADM | MCCR0_ExtClk;
+	else
+		Ser4MCCR0 = 0x00007f7f | MCCR0_ADM;

And this setup should probably be passed as part of the platform device data.

Quoted 3 lines

Ok, new set of patches on the ftp site with the above two items resolved. I've also moved it into drivers/mfd and linked that directory into kbuild.

Thanks, it seems to work okay here.

You still do:

Ser4MCCR0 = data->mccr0 | 0x7f7f;

...I'm not sure, but it seems to me I want MMCR0 to be set to 0x60000. Would it be better to move 7f7f constant (what is it, anyway) to machine-specific code?

Pavel

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#4 lore raw
Quoted 7 lines · Pavel Machek

You still do:

Ser4MCCR0 = data->mccr0 | 0x7f7f;

...I'm not sure, but it seems to me I want MMCR0 to be set to 0x60000. Would it be better to move 7f7f constant (what is it, anyway) to machine-specific code?

I do this because we want the MCP bus running at the lowest sample speed initially. When the drivers have initialised, they will call mcp_sa1100_set_telecom_divisor() and mcp_sa1100_set_audio_divisor() to set these fields appropriately.

They aren't machine specific.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core