RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-13 Thread Derek Cheung
OK, hope this patch can satisfy everyone :-)

The following is the diffstat of the enclosed patch file:

 drivers/i2c/busses/Kconfig   |   10 
 drivers/i2c/busses/Makefile  |1 
 drivers/i2c/busses/i2c-mcf5282.c |  414
+++
 drivers/i2c/busses/i2c-mcf5282.h |   46 
 include/asm-m68knommu/m528xsim.h |   42 +++
 5 files changed, 513 insertions(+)

I did:

a) remove all trailing spaces in the files
b) re-align the switch statement
c) change a return statement
d) change some white space intents to TABs
e) insert a break for the I2C_SMBUS_PROC_CALL, thanks for spotting it
f) fix the mcf5282lite wording in Kconfig

I did not:

g) use the ioremap. This is because Coldfire is a CPU without MMU and
there is no difference between virtual and physical memory. In fact, the
ioremap routine in the m68knommu is simply a stub routine that returns
the input address argument for compatibility reason. Also, all other
Coldfire CPU include files such as the m5307sim.h uses the volatile
declaration method. 
So, I hope this is acceptable to the Linux kernel maintainers

Please let me know if there is any question.

Regards
Derek


-Original Message-
From: Greg KH [mailto:[EMAIL PROTECTED] 
Sent: April 11, 2005 4:03 PM
To: Derek Cheung
Cc: 'Randy.Dunlap'; 'Andrew Morton'; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

On Sun, Apr 10, 2005 at 12:47:42PM -0400, Derek Cheung wrote:
> Enclosed please find the updated patch that incorporates changes for
all
> the comments I received.

You did not cc: the sensors mailing list, nor fix all of the coding
style issues.

> The volatile declaration in the m528xsim.h is needed because the
> declaration refers to the ColdFire 5282 register mapping.

Shouldn't you be calling ioremap, and not directly accessing a specific
register location through a pointer?  That's how all other arches do
this.

thanks,

greg k-h


linux_patch_submit3
Description: Binary data


RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-13 Thread Derek Cheung
OK, hope this patch can satisfy everyone :-)

The following is the diffstat of the enclosed patch file:

 drivers/i2c/busses/Kconfig   |   10 
 drivers/i2c/busses/Makefile  |1 
 drivers/i2c/busses/i2c-mcf5282.c |  414
+++
 drivers/i2c/busses/i2c-mcf5282.h |   46 
 include/asm-m68knommu/m528xsim.h |   42 +++
 5 files changed, 513 insertions(+)

I did:

a) remove all trailing spaces in the files
b) re-align the switch statement
c) change a return statement
d) change some white space intents to TABs
e) insert a break for the I2C_SMBUS_PROC_CALL, thanks for spotting it
f) fix the mcf5282lite wording in Kconfig

I did not:

g) use the ioremap. This is because Coldfire is a CPU without MMU and
there is no difference between virtual and physical memory. In fact, the
ioremap routine in the m68knommu is simply a stub routine that returns
the input address argument for compatibility reason. Also, all other
Coldfire CPU include files such as the m5307sim.h uses the volatile
declaration method. 
So, I hope this is acceptable to the Linux kernel maintainers

Please let me know if there is any question.

Regards
Derek


-Original Message-
From: Greg KH [mailto:[EMAIL PROTECTED] 
Sent: April 11, 2005 4:03 PM
To: Derek Cheung
Cc: 'Randy.Dunlap'; 'Andrew Morton'; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

On Sun, Apr 10, 2005 at 12:47:42PM -0400, Derek Cheung wrote:
 Enclosed please find the updated patch that incorporates changes for
all
 the comments I received.

You did not cc: the sensors mailing list, nor fix all of the coding
style issues.

 The volatile declaration in the m528xsim.h is needed because the
 declaration refers to the ColdFire 5282 register mapping.

Shouldn't you be calling ioremap, and not directly accessing a specific
register location through a pointer?  That's how all other arches do
this.

thanks,

greg k-h


linux_patch_submit3
Description: Binary data


RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-10 Thread Derek Cheung
Enclosed please find the updated patch that incorporates changes for all
the comments I received.

The volatile declaration in the m528xsim.h is needed because the
declaration refers to the ColdFire 5282 register mapping. The volatile
declaration is actually not needed in my I2C driver but someone may
include the m528xsim.h file in his/her applications and we need to force
the compiler not to do any optimization on the register mapping.

Regards
Derek

-Original Message-
From: Randy.Dunlap [mailto:[EMAIL PROTECTED] 
Sent: April 5, 2005 11:44 PM
To: Derek Cheung
Cc: 'Andrew Morton'; [EMAIL PROTECTED]; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

Derek Cheung wrote:
> 
>> Below please find the patch file I "diff" against Linux 2.6.11.6. It
>> contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
> CPU
>> shares the same I2C register set, the code can be easily adopted for
>> other ColdFire CPUs for I2C operations.
>>
>> I have tested the code on a ColdFire 5282Lite CPU board
>> (http://www.axman.com/Pages/cml-5282LITE.html) running uClinux 2.6.9
>> with LM75 and DS1621 temperature sensor chips. As advised by David
>> McCullough, the code will be incorporated in the next uClinux
> release.
> 
>> The patch contains:
>>
>> linux/drivers/i2c/busses
>>  i2c-mcf5282.c (new file)

Limit source code lines to 80 characters (including comment lines).

+static int mcf5282_read_data():

+   if (ackType == NACK)
+   *MCF5282_I2C_I2CR |= MCF5282_I2C_I2CR_TXAK; //
generate NA
+   else
+*MCF5282_I2C_I2CR &= ~MCF5282_I2C_I2CR_TXAK;// 
generate ACK

The 2 assignments above should begin in the same column.
Also, kernel comment style is C /* ... */, not C++ (or C99) // style.

+if (timeout <= 0)
+printk("%s - I2C IIF never set. Timeout is %d \n", 
__FUNCTION__, timeout);

All printk() calls should have a KERN_WARNING or KERN_ERR or
KERN_DEBUG level used in it...

+   if (timeout <= 0 )

No space before the closing ')'.

+static int mcf5282_write_data():

+if (timeout <=0)
should be (add a space)
+if (timeout <= 0)

+   if (timeout <= 0 )
Drop space before ')'

Drop the debugging printk's and DEREK_DEBUG blocks.

+switch (size) {
+case I2C_SMBUS_QUICK:
We usually don't indent the 'case' line to save one indent level.
It helps when using 8-space tabs.

+   // this is not yet ready!!!
Put blocks like this inside
#if 0
or
#if NOT_READY_YET
#endif
blocks.

+static u32 mcf5282_func(struct i2c_adapter *adapter)
+{
+   return(I2C_FUNC_SMBUS_QUICK |
+  I2C_FUNC_SMBUS_BYTE |
+  I2C_FUNC_SMBUS_PROC_CALL |
+  I2C_FUNC_SMBUS_BYTE_DATA |
+  I2C_FUNC_SMBUS_WORD_DATA |
+  I2C_FUNC_SMBUS_BLOCK_DATA);
+};
Don't use parens on return statements.


+static int __init i2c_mcf5282_init():
is not driver registration needed?  I don't know the I2C
subsystem, so maybe not...



Big Question:  does most Coldfire or I2C use volatile so heavily,
or is it just this one driver that does that?  Volatile here
semms very overused.


-- 
~Randy


linux_patch_submit2
Description: Binary data


RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-10 Thread Derek Cheung
Enclosed please find the updated patch that incorporates changes for all
the comments I received.

The volatile declaration in the m528xsim.h is needed because the
declaration refers to the ColdFire 5282 register mapping. The volatile
declaration is actually not needed in my I2C driver but someone may
include the m528xsim.h file in his/her applications and we need to force
the compiler not to do any optimization on the register mapping.

Regards
Derek

-Original Message-
From: Randy.Dunlap [mailto:[EMAIL PROTECTED] 
Sent: April 5, 2005 11:44 PM
To: Derek Cheung
Cc: 'Andrew Morton'; [EMAIL PROTECTED]; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

Derek Cheung wrote:
 
 Below please find the patch file I diff against Linux 2.6.11.6. It
 contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
 CPU
 shares the same I2C register set, the code can be easily adopted for
 other ColdFire CPUs for I2C operations.

 I have tested the code on a ColdFire 5282Lite CPU board
 (http://www.axman.com/Pages/cml-5282LITE.html) running uClinux 2.6.9
 with LM75 and DS1621 temperature sensor chips. As advised by David
 McCullough, the code will be incorporated in the next uClinux
 release.
 
 The patch contains:

 linux/drivers/i2c/busses
  i2c-mcf5282.c (new file)

Limit source code lines to 80 characters (including comment lines).

+static int mcf5282_read_data():

+   if (ackType == NACK)
+   *MCF5282_I2C_I2CR |= MCF5282_I2C_I2CR_TXAK; //
generate NA
+   else
+*MCF5282_I2C_I2CR = ~MCF5282_I2C_I2CR_TXAK;// 
generate ACK

The 2 assignments above should begin in the same column.
Also, kernel comment style is C /* ... */, not C++ (or C99) // style.

+if (timeout = 0)
+printk(%s - I2C IIF never set. Timeout is %d \n, 
__FUNCTION__, timeout);

All printk() calls should have a KERN_WARNING or KERN_ERR or
KERN_DEBUG level used in it...

+   if (timeout = 0 )

No space before the closing ')'.

+static int mcf5282_write_data():

+if (timeout =0)
should be (add a space)
+if (timeout = 0)

+   if (timeout = 0 )
Drop space before ')'

Drop the debugging printk's and DEREK_DEBUG blocks.

+switch (size) {
+case I2C_SMBUS_QUICK:
We usually don't indent the 'case' line to save one indent level.
It helps when using 8-space tabs.

+   // this is not yet ready!!!
Put blocks like this inside
#if 0
or
#if NOT_READY_YET
#endif
blocks.

+static u32 mcf5282_func(struct i2c_adapter *adapter)
+{
+   return(I2C_FUNC_SMBUS_QUICK |
+  I2C_FUNC_SMBUS_BYTE |
+  I2C_FUNC_SMBUS_PROC_CALL |
+  I2C_FUNC_SMBUS_BYTE_DATA |
+  I2C_FUNC_SMBUS_WORD_DATA |
+  I2C_FUNC_SMBUS_BLOCK_DATA);
+};
Don't use parens on return statements.


+static int __init i2c_mcf5282_init():
is not driver registration needed?  I don't know the I2C
subsystem, so maybe not...



Big Question:  does most Coldfire or I2C use volatile so heavily,
or is it just this one driver that does that?  Volatile here
semms very overused.


-- 
~Randy


linux_patch_submit2
Description: Binary data


RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-05 Thread Derek Cheung
Thanks Andrew. Enclosed please find the patch file.

Regards, 
Derek

-Original Message-
From: Andrew Morton [mailto:[EMAIL PROTECTED] 
Sent: April 5, 2005 10:22 PM
To: Derek Cheung
Cc: [EMAIL PROTECTED]; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

"Derek Cheung" <[EMAIL PROTECTED]> wrote:
>
>  Below please find the patch file I "diff" against Linux 2.6.11.6. It
>  contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
CPU
>  shares the same I2C register set, the code can be easily adopted for
>  other ColdFire CPUs for I2C operations.
> 
>  I have tested the code on a ColdFire 5282Lite CPU board
>  (http://www.axman.com/Pages/cml-5282LITE.html) running uClinux 2.6.9
>  with LM75 and DS1621 temperature sensor chips. As advised by David
>  McCullough, the code will be incorporated in the next uClinux
release.
> 
>  The patch contains:
> 
>  linux/drivers/i2c/busses
>   i2c-mcf5282.c (new file)
>   i2c-mcf5282.h (new file)
>   Kconfig (modified)
>   Makefile (modified)
>   
>  linux/include/asm-m68knommu
>   m528xsim.h (modified)
> 
>  Please let me know if you have any questions.

The patch was very wordwrapped by your email client.  Please fix that up
(first email the patch to yourself and test that the result still
applies OK) or
resend as an email attachment.

Thanks.


linux_patch
Description: Binary data


[PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-05 Thread Derek Cheung
  += i2c-mcf5282.o
+
 
 ifeq ($(CONFIG_I2C_DEBUG_BUS),y)
 EXTRA_CFLAGS += -DDEBUG
diff -uprN -X dontdiff linux-2.6.11.6/drivers/i2c/busses/Makefile.orig
linux_dev/drivers/i2c/busses/Makefile.orig
--- linux-2.6.11.6/drivers/i2c/busses/Makefile.orig 1969-12-31
19:00:00.0 -0500
+++ linux_dev/drivers/i2c/busses/Makefile.orig  2005-04-05
19:09:18.0 -0400
@@ -0,0 +1,46 @@
+#
+# Makefile for the i2c bus drivers.
+#
+
+obj-$(CONFIG_I2C_ALI1535)  += i2c-ali1535.o
+obj-$(CONFIG_I2C_ALI1563)  += i2c-ali1563.o
+obj-$(CONFIG_I2C_ALI15X3)  += i2c-ali15x3.o
+obj-$(CONFIG_I2C_AMD756)   += i2c-amd756.o
+obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o
+obj-$(CONFIG_I2C_AMD8111)  += i2c-amd8111.o
+obj-$(CONFIG_I2C_AU1550)   += i2c-au1550.o
+obj-$(CONFIG_I2C_ELEKTOR)  += i2c-elektor.o
+obj-$(CONFIG_I2C_HYDRA)+= i2c-hydra.o
+obj-$(CONFIG_I2C_I801) += i2c-i801.o
+obj-$(CONFIG_I2C_I810) += i2c-i810.o
+obj-$(CONFIG_I2C_IBM_IIC)  += i2c-ibm_iic.o
+obj-$(CONFIG_I2C_IOP3XX)   += i2c-iop3xx.o
+obj-$(CONFIG_I2C_ISA)  += i2c-isa.o
+obj-$(CONFIG_I2C_ITE)  += i2c-ite.o
+obj-$(CONFIG_I2C_IXP2000)  += i2c-ixp2000.o
+obj-$(CONFIG_I2C_IXP4XX)   += i2c-ixp4xx.o
+obj-$(CONFIG_I2C_KEYWEST)  += i2c-keywest.o
+obj-$(CONFIG_I2C_MPC)  += i2c-mpc.o
+obj-$(CONFIG_I2C_NFORCE2)  += i2c-nforce2.o
+obj-$(CONFIG_I2C_PARPORT)  += i2c-parport.o
+obj-$(CONFIG_I2C_PARPORT_LIGHT)+= i2c-parport-light.o
+obj-$(CONFIG_I2C_PCA_ISA)  += i2c-pca-isa.o
+obj-$(CONFIG_I2C_PIIX4)+= i2c-piix4.o
+obj-$(CONFIG_I2C_PROSAVAGE)+= i2c-prosavage.o
+obj-$(CONFIG_I2C_RPXLITE)  += i2c-rpx.o
+obj-$(CONFIG_I2C_S3C2410)  += i2c-s3c2410.o
+obj-$(CONFIG_I2C_SAVAGE4)  += i2c-savage4.o
+obj-$(CONFIG_I2C_SIBYTE)   += i2c-sibyte.o
+obj-$(CONFIG_I2C_SIS5595)  += i2c-sis5595.o
+obj-$(CONFIG_I2C_SIS630)   += i2c-sis630.o
+obj-$(CONFIG_I2C_SIS96X)   += i2c-sis96x.o
+obj-$(CONFIG_I2C_STUB) += i2c-stub.o
+obj-$(CONFIG_I2C_VIA)  += i2c-via.o
+obj-$(CONFIG_I2C_VIAPRO)   += i2c-viapro.o
+obj-$(CONFIG_I2C_VOODOO3)  += i2c-voodoo3.o
+obj-$(CONFIG_SCx200_ACB)   += scx200_acb.o
+obj-$(CONFIG_SCx200_I2C)   += scx200_i2c.o
+
+ifeq ($(CONFIG_I2C_DEBUG_BUS),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
diff -uprN -X dontdiff linux-2.6.11.6/include/asm-m68knommu/m528xsim.h
linux_dev/include/asm-m68knommu/m528xsim.h
--- linux-2.6.11.6/include/asm-m68knommu/m528xsim.h 2005-03-25
22:28:13.0 -0500
+++ linux_dev/include/asm-m68knommu/m528xsim.h  2005-04-05
19:17:45.0 -0400
@@ -41,5 +41,117 @@
 #defineMCFSIM_DACR10x50/* SDRAM base
address 1 */
 #defineMCFSIM_DMR1 0x54/* SDRAM address
mask 1 */
 
+/*
+ * Derek Cheung - 6 Feb 2005
+ * add I2C and QSPI register definition using Freescale's
MCF5282
+ */
+/* set Port AS pin for I2C or UART */
+#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR +
0x00100056)
+
+/* Interrupt Mask Register Register Low */ 
+#define MCF5282_INTC0_IMRL  (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
+/* Interrupt Control Register 7 */
+#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51)
+
+
+
+/*
+*
+* Inter-IC (I2C) Module
+*
+*/
+/* Read/Write access macros for general use */
+#define MCF5282_I2C_I2ADR   (volatile u8 *) (MCF_IPSBAR + 0x0300)
// Address 
+#define MCF5282_I2C_I2FDR   (volatile u8 *) (MCF_IPSBAR + 0x0304)
// Freq Divider
+#define MCF5282_I2C_I2CR(volatile u8 *) (MCF_IPSBAR + 0x0308)
// Control
+#define MCF5282_I2C_I2SR(volatile u8 *) (MCF_IPSBAR + 0x030C)
// Status
+#define MCF5282_I2C_I2DR(volatile u8 *) (MCF_IPSBAR + 0x0310)
// Data I/O
+
+/* Bit level definitions and macros */
+#define MCF5282_I2C_I2ADR_ADDR(x)
(((x)&0x7F)<<0x01)
+
+#define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F))
+
+#define MCF5282_I2C_I2CR_IEN(0x80) // I2C enable
+#define MCF5282_I2C_I2CR_IIEN   (0x40)  // interrupt enable
+#define MCF5282_I2C_I2CR_MSTA   (0x20)  // master/slave mode
+#define MCF5282_I2C_I2CR_MTX(0x10)  // transmit/receive mode
+#define MCF5282_I2C_I2CR_TXAK   (0x08)  // transmit acknowledge enable
+#define MCF5282_I2C_I2CR_RSTA   (0x04)  // repeat start
+
+#define MCF5282_I2C_I2SR_ICF(0x80)  // data transfer bit
+#define MCF5282_I2C_I2SR_IAAS   (0x40)  // I2C addressed as a slave
+#define MCF5282_I2C_I2SR_IBB(0x20)  // I2C bus busy
+#define MCF5282_I2C_I2SR_IAL(0x10)  // aribitration lost
+#define MCF5282_I2C_I2SR_SRW(0x04)  // slave read/write
+#define MCF5282_I2C_I2SR_IIF(0x02)  // I2C interrupt
+#define MCF5282_I2C_I2SR_RXAK   (0x01)  // received acknowledge
+
+
+
+/**

[PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-05 Thread Derek Cheung
-rpx.o
+obj-$(CONFIG_I2C_S3C2410)  += i2c-s3c2410.o
+obj-$(CONFIG_I2C_SAVAGE4)  += i2c-savage4.o
+obj-$(CONFIG_I2C_SIBYTE)   += i2c-sibyte.o
+obj-$(CONFIG_I2C_SIS5595)  += i2c-sis5595.o
+obj-$(CONFIG_I2C_SIS630)   += i2c-sis630.o
+obj-$(CONFIG_I2C_SIS96X)   += i2c-sis96x.o
+obj-$(CONFIG_I2C_STUB) += i2c-stub.o
+obj-$(CONFIG_I2C_VIA)  += i2c-via.o
+obj-$(CONFIG_I2C_VIAPRO)   += i2c-viapro.o
+obj-$(CONFIG_I2C_VOODOO3)  += i2c-voodoo3.o
+obj-$(CONFIG_SCx200_ACB)   += scx200_acb.o
+obj-$(CONFIG_SCx200_I2C)   += scx200_i2c.o
+
+ifeq ($(CONFIG_I2C_DEBUG_BUS),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
diff -uprN -X dontdiff linux-2.6.11.6/include/asm-m68knommu/m528xsim.h
linux_dev/include/asm-m68knommu/m528xsim.h
--- linux-2.6.11.6/include/asm-m68knommu/m528xsim.h 2005-03-25
22:28:13.0 -0500
+++ linux_dev/include/asm-m68knommu/m528xsim.h  2005-04-05
19:17:45.0 -0400
@@ -41,5 +41,117 @@
 #defineMCFSIM_DACR10x50/* SDRAM base
address 1 */
 #defineMCFSIM_DMR1 0x54/* SDRAM address
mask 1 */
 
+/*
+ * Derek Cheung - 6 Feb 2005
+ * add I2C and QSPI register definition using Freescale's
MCF5282
+ */
+/* set Port AS pin for I2C or UART */
+#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR +
0x00100056)
+
+/* Interrupt Mask Register Register Low */ 
+#define MCF5282_INTC0_IMRL  (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
+/* Interrupt Control Register 7 */
+#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51)
+
+
+
+/*
+*
+* Inter-IC (I2C) Module
+*
+*/
+/* Read/Write access macros for general use */
+#define MCF5282_I2C_I2ADR   (volatile u8 *) (MCF_IPSBAR + 0x0300)
// Address 
+#define MCF5282_I2C_I2FDR   (volatile u8 *) (MCF_IPSBAR + 0x0304)
// Freq Divider
+#define MCF5282_I2C_I2CR(volatile u8 *) (MCF_IPSBAR + 0x0308)
// Control
+#define MCF5282_I2C_I2SR(volatile u8 *) (MCF_IPSBAR + 0x030C)
// Status
+#define MCF5282_I2C_I2DR(volatile u8 *) (MCF_IPSBAR + 0x0310)
// Data I/O
+
+/* Bit level definitions and macros */
+#define MCF5282_I2C_I2ADR_ADDR(x)
(((x)0x7F)0x01)
+
+#define MCF5282_I2C_I2FDR_IC(x) (((x)0x3F))
+
+#define MCF5282_I2C_I2CR_IEN(0x80) // I2C enable
+#define MCF5282_I2C_I2CR_IIEN   (0x40)  // interrupt enable
+#define MCF5282_I2C_I2CR_MSTA   (0x20)  // master/slave mode
+#define MCF5282_I2C_I2CR_MTX(0x10)  // transmit/receive mode
+#define MCF5282_I2C_I2CR_TXAK   (0x08)  // transmit acknowledge enable
+#define MCF5282_I2C_I2CR_RSTA   (0x04)  // repeat start
+
+#define MCF5282_I2C_I2SR_ICF(0x80)  // data transfer bit
+#define MCF5282_I2C_I2SR_IAAS   (0x40)  // I2C addressed as a slave
+#define MCF5282_I2C_I2SR_IBB(0x20)  // I2C bus busy
+#define MCF5282_I2C_I2SR_IAL(0x10)  // aribitration lost
+#define MCF5282_I2C_I2SR_SRW(0x04)  // slave read/write
+#define MCF5282_I2C_I2SR_IIF(0x02)  // I2C interrupt
+#define MCF5282_I2C_I2SR_RXAK   (0x01)  // received acknowledge
+
+
+
+/*
+*
+* Queued Serial Peripheral Interface (QSPI) Module
+*
+*/
+/* Derek - 21 Feb 2005 */
+/* change to the format used in I2C */
+/* Read/Write access macros for general use */
+#define MCF5282_QSPI_QMRMCF_IPSBAR + 0x0340
+#define MCF5282_QSPI_QDLYR  MCF_IPSBAR + 0x0344
+#define MCF5282_QSPI_QWRMCF_IPSBAR + 0x0348
+#define MCF5282_QSPI_QIRMCF_IPSBAR + 0x034C
+#define MCF5282_QSPI_QARMCF_IPSBAR + 0x0350
+#define MCF5282_QSPI_QDRMCF_IPSBAR + 0x0354
+#define MCF5282_QSPI_QCRMCF_IPSBAR + 0x0354
+
+/* Bit level definitions and macros */
+#define MCF5282_QSPI_QMR_MSTR   (0x8000)
+#define MCF5282_QSPI_QMR_DOHIE  (0x4000)
+#define MCF5282_QSPI_QMR_BITS_16(0x)
+#define MCF5282_QSPI_QMR_BITS_8 (0x2000)
+#define MCF5282_QSPI_QMR_BITS_9 (0x2400)
+#define MCF5282_QSPI_QMR_BITS_10(0x2800)
+#define MCF5282_QSPI_QMR_BITS_11(0x2C00)
+#define MCF5282_QSPI_QMR_BITS_12(0x3000)
+#define MCF5282_QSPI_QMR_BITS_13(0x3400)
+#define MCF5282_QSPI_QMR_BITS_14(0x3800)
+#define MCF5282_QSPI_QMR_BITS_15(0x3C00)
+#define MCF5282_QSPI_QMR_CPOL   (0x0200)
+#define MCF5282_QSPI_QMR_CPHA   (0x0100)
+#define MCF5282_QSPI_QMR_BAUD(x)(((x)0x00FF))
+
+#define MCF5282_QSPI_QDLYR_SPE  (0x80)
+#define MCF5282_QSPI_QDLYR_QCD(x)
(((x)0x007F)8)
+#define

RE: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

2005-04-05 Thread Derek Cheung
Thanks Andrew. Enclosed please find the patch file.

Regards, 
Derek

-Original Message-
From: Andrew Morton [mailto:[EMAIL PROTECTED] 
Sent: April 5, 2005 10:22 PM
To: Derek Cheung
Cc: [EMAIL PROTECTED]; Linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel 2.6.11.6 - I2C adaptor for ColdFire 5282 CPU

Derek Cheung [EMAIL PROTECTED] wrote:

  Below please find the patch file I diff against Linux 2.6.11.6. It
  contains the I2C adaptor for ColdFire 5282 CPU. Since most ColdFire
CPU
  shares the same I2C register set, the code can be easily adopted for
  other ColdFire CPUs for I2C operations.
 
  I have tested the code on a ColdFire 5282Lite CPU board
  (http://www.axman.com/Pages/cml-5282LITE.html) running uClinux 2.6.9
  with LM75 and DS1621 temperature sensor chips. As advised by David
  McCullough, the code will be incorporated in the next uClinux
release.
 
  The patch contains:
 
  linux/drivers/i2c/busses
   i2c-mcf5282.c (new file)
   i2c-mcf5282.h (new file)
   Kconfig (modified)
   Makefile (modified)
   
  linux/include/asm-m68knommu
   m528xsim.h (modified)
 
  Please let me know if you have any questions.

The patch was very wordwrapped by your email client.  Please fix that up
(first email the patch to yourself and test that the result still
applies OK) or
resend as an email attachment.

Thanks.


linux_patch
Description: Binary data