Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-21 Thread Stefan Roese
On Thursday 03 December 2009 11:23:17 Heiko Schocher wrote:
> commit eb5eb2b0f744f0cba405160c5d01335c40f09acf
> 
> ppc4xx: Cleanup PPC4xx I2C infrastructure
> 
> This patch cleans up the PPC4xx I2C intrastructure:
> 
> - Use C struct to describe the I2C registers instead of defines
> - Coding style cleanup (braces, whitespace, comments, line length)
> - Extract common code from i2c_read() and i2c_write()
> - Remove unneeded IIC defines from ppc405.h & ppc440.h
> 
> breaks comiling for the KAREF and METROBOX boards.
> 
> This patch fixes this issue.

Applied to u-boot-ppc4xx. Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-16 Thread Stefan Roese
Hi Heiko,

On Saturday 05 December 2009 11:41:07 Heiko Schocher wrote:
> >> The board maintainer, Travis Sawyer, doesn't work for Sandburst
> >> (acquired by Broadcom some time ago?) any more. So we can't get his
> >> comments on this. Not sure what to do with those Sandburst boards now.
> >> They are not actively maintained any more. Perhaps we should remove them
> >> some time soon?
> >>
> >> Wolfgang, what do you think? Should we try to carry such unmaintained
> >> boards on for ever?
> >
> > If it's an easy change to do (say, up to 5 minutes work to make it
> > compile) I suggest we clean it up and keep the code. If it starts
> > making real efforts we can remove it, if nobody complains.
> 
> Thats exactly, what my patch did ;-)
> 
> Stefan, would you pick it up?

OK, I'll pick it up soon. Thanks.
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-05 Thread Heiko Schocher
Hello Wolfgang,

Wolfgang Denk wrote:
> In message <200912031154.39962...@denx.de> you wrote:
>> The board maintainer, Travis Sawyer, doesn't work for Sandburst (acquired by 
>> Broadcom some time ago?) any more. So we can't get his comments on this. Not 
>> sure what to do with those Sandburst boards now. They are not actively 
>> maintained any more. Perhaps we should remove them some time soon?
>>
>> Wolfgang, what do you think? Should we try to carry such unmaintained boards 
>> on for ever?
> 
> If it's an easy change to do (say, up to 5 minutes work to make it
> compile) I suggest we clean it up and keep the code. If it starts
> making real efforts we can remove it, if nobody complains.

Thats exactly, what my patch did ;-)

Stefan, would you pick it up?

bye
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-04 Thread Wolfgang Denk
Dear Stefan Roese,

In message <200912031154.39962...@denx.de> you wrote:
> 
> The board maintainer, Travis Sawyer, doesn't work for Sandburst (acquired by 
> Broadcom some time ago?) any more. So we can't get his comments on this. Not 
> sure what to do with those Sandburst boards now. They are not actively 
> maintained any more. Perhaps we should remove them some time soon?
> 
> Wolfgang, what do you think? Should we try to carry such unmaintained boards 
> on for ever?

If it's an easy change to do (say, up to 5 minutes work to make it
compile) I suggest we clean it up and keep the code. If it starts
making real efforts we can remove it, if nobody complains.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Vulcans do not approve of violence.
-- Spock, "Journey to Babel", stardate 3842.4
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-03 Thread Heiko Schocher
Hello Stefan,

Stefan Roese schrieb:
> On Thursday 03 December 2009 11:23:17 Heiko Schocher wrote:
>> commit eb5eb2b0f744f0cba405160c5d01335c40f09acf
>>
>> ppc4xx: Cleanup PPC4xx I2C infrastructure
>>
>> This patch cleans up the PPC4xx I2C intrastructure:
>>
>> - Use C struct to describe the I2C registers instead of defines
>> - Coding style cleanup (braces, whitespace, comments, line length)
>> - Extract common code from i2c_read() and i2c_write()
>> - Remove unneeded IIC defines from ppc405.h & ppc440.h
>>
>> breaks comiling for the KAREF and METROBOX boards.
>>
>> This patch fixes this issue.
> 
> Thanks for catching. Don't know why I missed those two boards.
> 
> But looking at the code (board/sandburst/common/ppc440gx_i2c.c), this seems 
> to 
> be a driver for the PPC4xx I2C bus 1. The common 4xx I2C driver 
> (cpu/ppc4xx/i2c.c) is fully capable of handling I2C bus 0 *and* 1. Perhaps 
> this was not the case when Travis wrote the board support. I would really 
> like 
> to drop this board specific code, as it doesn't seem necessary for me.

In the multibus_v2 approach I dropped it ;-)
I didn;t see any reasons for supporting this board specific i2c driver
any longer ...

bye
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-03 Thread Stefan Roese
Hi Heiko,

On Thursday 03 December 2009 11:23:17 Heiko Schocher wrote:
> commit eb5eb2b0f744f0cba405160c5d01335c40f09acf
> 
> ppc4xx: Cleanup PPC4xx I2C infrastructure
> 
> This patch cleans up the PPC4xx I2C intrastructure:
> 
> - Use C struct to describe the I2C registers instead of defines
> - Coding style cleanup (braces, whitespace, comments, line length)
> - Extract common code from i2c_read() and i2c_write()
> - Remove unneeded IIC defines from ppc405.h & ppc440.h
> 
> breaks comiling for the KAREF and METROBOX boards.
> 
> This patch fixes this issue.

Thanks for catching. Don't know why I missed those two boards.

But looking at the code (board/sandburst/common/ppc440gx_i2c.c), this seems to 
be a driver for the PPC4xx I2C bus 1. The common 4xx I2C driver 
(cpu/ppc4xx/i2c.c) is fully capable of handling I2C bus 0 *and* 1. Perhaps 
this was not the case when Travis wrote the board support. I would really like 
to drop this board specific code, as it doesn't seem necessary for me.

The board maintainer, Travis Sawyer, doesn't work for Sandburst (acquired by 
Broadcom some time ago?) any more. So we can't get his comments on this. Not 
sure what to do with those Sandburst boards now. They are not actively 
maintained any more. Perhaps we should remove them some time soon?

Wolfgang, what do you think? Should we try to carry such unmaintained boards 
on for ever?

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [for next] i2c, ppc4xx: fix compiling KAREF and METROBOX boards.

2009-12-03 Thread Heiko Schocher
commit eb5eb2b0f744f0cba405160c5d01335c40f09acf

ppc4xx: Cleanup PPC4xx I2C infrastructure

This patch cleans up the PPC4xx I2C intrastructure:

- Use C struct to describe the I2C registers instead of defines
- Coding style cleanup (braces, whitespace, comments, line length)
- Extract common code from i2c_read() and i2c_write()
- Remove unneeded IIC defines from ppc405.h & ppc440.h

breaks comiling for the KAREF and METROBOX boards.

This patch fixes this issue.

Signed-off-by: Heiko Schocher 
---
based against git://git.denx.de/u-boot.git next

 board/sandburst/common/ppc440gx_i2c.c |   73 +
 board/sandburst/common/ppc440gx_i2c.h |   30 +++---
 2 files changed, 53 insertions(+), 50 deletions(-)

diff --git a/board/sandburst/common/ppc440gx_i2c.c 
b/board/sandburst/common/ppc440gx_i2c.c
index bc88e5a..35c4e60 100644
--- a/board/sandburst/common/ppc440gx_i2c.c
+++ b/board/sandburst/common/ppc440gx_i2c.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include "ppc440gx_i2c.h"
+#include 

 #ifdef CONFIG_I2C_BUS1

@@ -47,16 +48,18 @@
 static uchar i2c_no_probes[] = CONFIG_SYS_I2C_NOPROBES;
 #endif

+static struct ppc4xx_i2c *i2c = (struct ppc4xx_i2c 
*)I2C_REGISTERS_BUS1_BASE_ADDRESS;
+
 static void _i2c_bus1_reset (void)
 {
int i, status;

/* Reset status register */
/* write 1 in SCMP and IRQA to clear these fields */
-   out8 (IIC_STS1, 0x0A);
+   out_8 (IIC_STS1, 0x0A);

/* write 1 in IRQP IRQD LA ICT XFRA to clear these fields */
-   out8 (IIC_EXTSTS1, 0x8F);
+   out_8 (IIC_EXTSTS1, 0x8F);
__asm__ volatile ("eieio");

/*
@@ -66,36 +69,36 @@ static void _i2c_bus1_reset (void)
i = 10;
do {
/* Get status */
-   status = in8 (IIC_STS1);
+   status = in_8 (IIC_STS1);
udelay (500);   /* 500us */
i--;
} while ((status & IIC_STS_PT) && (i > 0));
/* Soft reset controller */
-   status = in8 (IIC_XTCNTLSS1);
-   out8 (IIC_XTCNTLSS1, (status | IIC_XTCNTLSS_SRST));
+   status = in_8 (IIC_XTCNTLSS1);
+   out_8 (IIC_XTCNTLSS1, (status | IIC_XTCNTLSS_SRST));
__asm__ volatile ("eieio");

/* make sure where in initial state, data hi, clock hi */
-   out8 (IIC_DIRECTCNTL1, 0xC);
+   out_8 (IIC_DIRECTCNTL1, 0xC);
for (i = 0; i < 10; i++) {
-   if ((in8 (IIC_DIRECTCNTL1) & 0x3) != 0x3) {
+   if ((in_8 (IIC_DIRECTCNTL1) & 0x3) != 0x3) {
/* clock until we get to known state */
-   out8 (IIC_DIRECTCNTL1, 0x8);/* clock lo */
+   out_8 (IIC_DIRECTCNTL1, 0x8);   /* clock lo */
udelay (100);   /* 100us */
-   out8 (IIC_DIRECTCNTL1, 0xC);/* clock hi */
+   out_8 (IIC_DIRECTCNTL1, 0xC);   /* clock hi */
udelay (100);   /* 100us */
} else {
break;
}
}
/* send start condition */
-   out8 (IIC_DIRECTCNTL1, 0x4);
+   out_8 (IIC_DIRECTCNTL1, 0x4);
udelay (1000);  /* 1ms */
/* send stop condition */
-   out8 (IIC_DIRECTCNTL1, 0xC);
+   out_8 (IIC_DIRECTCNTL1, 0xC);
udelay (1000);  /* 1ms */
/* Unreset controller */
-   out8 (IIC_XTCNTLSS1, (status & ~IIC_XTCNTLSS_SRST));
+   out_8 (IIC_XTCNTLSS1, (status & ~IIC_XTCNTLSS_SRST));
udelay (1000);  /* 1ms */
 }

@@ -117,16 +120,16 @@ void i2c1_init (int speed, int slaveadd)
_i2c_bus1_reset ();

/* clear lo master address */
-   out8 (IIC_LMADR1, 0);
+   out_8 (IIC_LMADR1, 0);

/* clear hi master address */
-   out8 (IIC_HMADR1, 0);
+   out_8 (IIC_HMADR1, 0);

/* clear lo slave address */
-   out8 (IIC_LSADR1, 0);
+   out_8 (IIC_LSADR1, 0);

/* clear hi slave address */
-   out8 (IIC_HSADR1, 0);
+   out_8 (IIC_HSADR1, 0);

/* Clock divide Register */
/* get OPB frequency */
@@ -136,25 +139,25 @@ void i2c1_init (int speed, int slaveadd)
divisor = (freqOPB - 1) / 1000;
if (divisor == 0)
divisor = 1;
-   out8 (IIC_CLKDIV1, divisor);
+   out_8 (IIC_CLKDIV1, divisor);

/* no interrupts */
-   out8 (IIC_INTRMSK1, 0);
+   out_8 (IIC_INTRMSK1, 0);

/* clear transfer count */
-   out8 (IIC_XFRCNT1, 0);
+   out_8 (IIC_XFRCNT1, 0);

/* clear extended control & stat */
/* write 1 in SRC SRS SWC SWS to clear these fields */
-   out8 (IIC_XTCNTLSS1, 0xF0);
+   out_8 (IIC_XTCNTLSS1, 0xF0);

/* Mode Control Register
   Flush Slave/Master data buffer */
-   out8 (IIC_MDCNTL1, IIC_MDCNTL_FSDB | IIC_MDCNTL_FMDB);
+   out_8 (IIC_MDCNTL1, IIC_MDCN