public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] fix ucb1x00 support on collie
@ 2005-07-31 13:46 Pavel Machek
  2005-07-31 15:42 ` Russell King
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2005-07-31 13:46 UTC (permalink / raw)
  To: rpurdie, lenz, kernel list, rmk

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.

Signed-off-by: Pavel Machek <pavel@suse.cz>

---
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(-)

diff --git a/drivers/misc/mcp-sa1100.c b/drivers/misc/mcp-sa1100.c
--- a/drivers/misc/mcp-sa1100.c
+++ b/drivers/misc/mcp-sa1100.c
@@ -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
diff --git a/drivers/misc/ucb1x00-core.c b/drivers/misc/ucb1x00-core.c
--- a/drivers/misc/ucb1x00-core.c
+++ b/drivers/misc/ucb1x00-core.c
@@ -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);

-- 
if you have sharp zaurus hardware you don't need... you know my address

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix ucb1x00 support on collie
  2005-07-31 13:46 [patch] fix ucb1x00 support on collie Pavel Machek
@ 2005-07-31 15:42 ` Russell King
  2005-08-07 14:08   ` Russell King
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King @ 2005-07-31 15:42 UTC (permalink / raw)
  To: Pavel Machek; +Cc: rpurdie, lenz, kernel list

On Sun, Jul 31, 2005 at 03:46:17PM +0200, Pavel Machek wrote:
> 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?

> diff --git a/drivers/misc/mcp-sa1100.c b/drivers/misc/mcp-sa1100.c
> --- a/drivers/misc/mcp-sa1100.c
> +++ b/drivers/misc/mcp-sa1100.c
> @@ -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.

> @@ -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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix ucb1x00 support on collie
  2005-07-31 15:42 ` Russell King
@ 2005-08-07 14:08   ` Russell King
  2005-08-12 11:11     ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King @ 2005-08-07 14:08 UTC (permalink / raw)
  To: Pavel Machek, rpurdie, lenz, kernel list

On Sun, Jul 31, 2005 at 04:42:45PM +0100, Russell King wrote:
> On Sun, Jul 31, 2005 at 03:46:17PM +0200, Pavel Machek wrote:
> > 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?
> 
> > diff --git a/drivers/misc/mcp-sa1100.c b/drivers/misc/mcp-sa1100.c
> > --- a/drivers/misc/mcp-sa1100.c
> > +++ b/drivers/misc/mcp-sa1100.c
> > @@ -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.
> 
> > @@ -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.

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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix ucb1x00 support on collie
  2005-08-07 14:08   ` Russell King
@ 2005-08-12 11:11     ` Pavel Machek
  2005-08-12 19:49       ` Russell King
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2005-08-12 11:11 UTC (permalink / raw)
  To: rpurdie, lenz, kernel list

Hi!

> > 
> > > diff --git a/drivers/misc/mcp-sa1100.c b/drivers/misc/mcp-sa1100.c
> > > --- a/drivers/misc/mcp-sa1100.c
> > > +++ b/drivers/misc/mcp-sa1100.c
> > > @@ -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.
> > 
> > > @@ -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.
> 
> 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
-- 
if you have sharp zaurus hardware you don't need... you know my address

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix ucb1x00 support on collie
  2005-08-12 11:11     ` Pavel Machek
@ 2005-08-12 19:49       ` Russell King
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King @ 2005-08-12 19:49 UTC (permalink / raw)
  To: Pavel Machek; +Cc: rpurdie, lenz, kernel list

On Fri, Aug 12, 2005 at 01:11:03PM +0200, Pavel Machek wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-08-12 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-31 13:46 [patch] fix ucb1x00 support on collie Pavel Machek
2005-07-31 15:42 ` Russell King
2005-08-07 14:08   ` Russell King
2005-08-12 11:11     ` Pavel Machek
2005-08-12 19:49       ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox