public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support
@ 2008-05-05 12:06 Jens Gehrlein
  2008-05-05 15:19 ` Ben Warren
  2008-05-23  6:25 ` Ben Warren
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Gehrlein @ 2008-05-05 12:06 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jens Gehrlein <sew_s@tqs.de>
---
Hi,

third attempt:
wrapped the long line, fixed typo, extended README
file and avoided e-mail text above the separator :-)

Sorry, I'm not a raw recruit but I didn't issue many
patches so far.

The title should go into the commit text, so it won't
appear twice. Or do you wish a more detailed description?

Perhaps some corrections concerning English wording in the
README file are necessary?


 README                |   15 +++++++++++++++
 drivers/net/smc911x.c |   21 +++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)


diff --git a/README b/README
index 36ae0fb..67e3152 100644
--- a/README
+++ b/README
@@ -787,6 +787,21 @@ The following options need to be configured:
 			Define this to use i/o functions instead of macros
 			(some hardware wont work with macros)
 
+		CONFIG_DRIVER_SMC911X
+		Support for SMSC's LAN911x and LAN921x chips
+
+			CONFIG_DRIVER_SMC911X_BASE
+			Define this to hold the physical address
+			of the device (I/O space)
+
+			CONFIG_DRIVER_SMC911X_32_BIT
+			Define this if data bus is 32 bits
+
+			CONFIG_DRIVER_SMC911X_16_BIT
+			Define this if data bus is 16 bits. If your processor
+			automatically converts one 32 bit word to two 16 bit
+			words you may also try CONFIG_DRIVER_SMC911X_32_BIT.
+
 - USB Support:
 		At the moment only the UHCI host controller is
 		supported (PIP405, MIP405, MPC5200); define
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index d22c889..f978762 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -30,6 +30,12 @@
 #include <net.h>
 #include <miiphy.h>
 
+#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \
+	defined (CONFIG_DRIVER_SMC911X_16_BIT)
+#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \
+	CONFIG_DRIVER_SMC911X_16_BIT shall be set"
+#endif
+
 #ifdef CONFIG_DRIVER_SMC911X_32_BIT
 static inline u32 reg_read(u32 addr)
 {
@@ -39,9 +45,20 @@ static inline void reg_write(u32 addr, u32 val)
 {
 	*(volatile u32*)addr = val;
 }
+#elif CONFIG_DRIVER_SMC911X_16_BIT
+static inline u32 reg_read(u32 addr)
+{
+	volatile u16 *addr_16 = (u16 *)addr;
+	return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
+}
+static inline void reg_write(u32 addr, u32 val)
+{
+	*(volatile u16*)addr = (u16)val;
+	*(volatile u16*)(addr + 2) = (u16)(val >> 16);
+}
 #else
-#error "SMC911X: Only 32-bit bus is supported"
-#endif
+#error "SMC911X: undefined bus width"
+#endif /* CONFIG_DRIVER_SMC911X_16_BIT */
 
 #define mdelay(n)       udelay((n)*1000)
 

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

* [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support
  2008-05-05 12:06 [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support Jens Gehrlein
@ 2008-05-05 15:19 ` Ben Warren
  2008-05-23  6:25 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Warren @ 2008-05-05 15:19 UTC (permalink / raw)
  To: u-boot

Hi Jens,

On Mon, May 5, 2008 at 5:06 AM, Jens Gehrlein <sew_s@tqs.de> wrote:
> Signed-off-by: Jens Gehrlein <sew_s@tqs.de>
>  ---
>  Hi,
>
>  third attempt:
>  wrapped the long line, fixed typo, extended README
>  file and avoided e-mail text above the separator :-)
>
>  Sorry, I'm not a raw recruit but I didn't issue many
>  patches so far.
>
>  The title should go into the commit text, so it won't
>  appear twice. Or do you wish a more detailed description?
>
This looks fine to me.

>  Perhaps some corrections concerning English wording in the
>  README file are necessary?
>
>
>   README                |   15 +++++++++++++++
>   drivers/net/smc911x.c |   21 +++++++++++++++++++--
>   2 files changed, 34 insertions(+), 2 deletions(-)
>
>
>  diff --git a/README b/README
>  index 36ae0fb..67e3152 100644
>  --- a/README
>  +++ b/README
>  @@ -787,6 +787,21 @@ The following options need to be configured:
>                         Define this to use i/o functions instead of macros
>                         (some hardware wont work with macros)
>
>  +               CONFIG_DRIVER_SMC911X
>  +               Support for SMSC's LAN911x and LAN921x chips
>  +
>  +                       CONFIG_DRIVER_SMC911X_BASE
>  +                       Define this to hold the physical address
>  +                       of the device (I/O space)
>  +
>  +                       CONFIG_DRIVER_SMC911X_32_BIT
>  +                       Define this if data bus is 32 bits
>  +
>  +                       CONFIG_DRIVER_SMC911X_16_BIT
>  +                       Define this if data bus is 16 bits. If your processor
>  +                       automatically converts one 32 bit word to two 16 bit
>  +                       words you may also try CONFIG_DRIVER_SMC911X_32_BIT.
>  +
>   - USB Support:
>                 At the moment only the UHCI host controller is
>                 supported (PIP405, MIP405, MPC5200); define
>  diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
>  index d22c889..f978762 100644
>  --- a/drivers/net/smc911x.c
>  +++ b/drivers/net/smc911x.c
>  @@ -30,6 +30,12 @@
>   #include <net.h>
>   #include <miiphy.h>
>
>  +#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \
>  +       defined (CONFIG_DRIVER_SMC911X_16_BIT)
>  +#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \
>  +       CONFIG_DRIVER_SMC911X_16_BIT shall be set"
>  +#endif
>  +
>   #ifdef CONFIG_DRIVER_SMC911X_32_BIT
>   static inline u32 reg_read(u32 addr)
>   {
>  @@ -39,9 +45,20 @@ static inline void reg_write(u32 addr, u32 val)
>   {
>         *(volatile u32*)addr = val;
>   }
>  +#elif CONFIG_DRIVER_SMC911X_16_BIT
>  +static inline u32 reg_read(u32 addr)
>  +{
>  +       volatile u16 *addr_16 = (u16 *)addr;
>  +       return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
>  +}
>  +static inline void reg_write(u32 addr, u32 val)
>  +{
>  +       *(volatile u16*)addr = (u16)val;
>  +       *(volatile u16*)(addr + 2) = (u16)(val >> 16);
>  +}
>   #else
>  -#error "SMC911X: Only 32-bit bus is supported"
>  -#endif
>  +#error "SMC911X: undefined bus width"
>  +#endif /* CONFIG_DRIVER_SMC911X_16_BIT */
>
>   #define mdelay(n)       udelay((n)*1000)
>
>

I haven't tried to apply the patch yet, but as long as it applies
cleanly this will go into 1.3.4 (or whatever Wolfgang chooses to call
it).  Thanks for the contribution!

regards,
Ben

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

* [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support
  2008-05-05 12:06 [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support Jens Gehrlein
  2008-05-05 15:19 ` Ben Warren
@ 2008-05-23  6:25 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Warren @ 2008-05-23  6:25 UTC (permalink / raw)
  To: u-boot

Jens Gehrlein wrote:
> Signed-off-by: Jens Gehrlein <sew_s@tqs.de>
> ---
> Hi,
>
> third attempt:
> wrapped the long line, fixed typo, extended README
> file and avoided e-mail text above the separator :-)
>
> Sorry, I'm not a raw recruit but I didn't issue many
> patches so far.
>
> The title should go into the commit text, so it won't
> appear twice. Or do you wish a more detailed description?
>
> Perhaps some corrections concerning English wording in the
> README file are necessary?
>
>
>  README                |   15 +++++++++++++++
>  drivers/net/smc911x.c |   21 +++++++++++++++++++--
>  2 files changed, 34 insertions(+), 2 deletions(-)
>
>
> diff --git a/README b/README
> index 36ae0fb..67e3152 100644
> --- a/README
> +++ b/README
> @@ -787,6 +787,21 @@ The following options need to be configured:
>  			Define this to use i/o functions instead of macros
>  			(some hardware wont work with macros)
>  
> +		CONFIG_DRIVER_SMC911X
> +		Support for SMSC's LAN911x and LAN921x chips
> +
> +			CONFIG_DRIVER_SMC911X_BASE
> +			Define this to hold the physical address
> +			of the device (I/O space)
> +
> +			CONFIG_DRIVER_SMC911X_32_BIT
> +			Define this if data bus is 32 bits
> +
> +			CONFIG_DRIVER_SMC911X_16_BIT
> +			Define this if data bus is 16 bits. If your processor
> +			automatically converts one 32 bit word to two 16 bit
> +			words you may also try CONFIG_DRIVER_SMC911X_32_BIT.
> +
>  - USB Support:
>  		At the moment only the UHCI host controller is
>  		supported (PIP405, MIP405, MPC5200); define
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index d22c889..f978762 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -30,6 +30,12 @@
>  #include <net.h>
>  #include <miiphy.h>
>  
> +#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \
> +	defined (CONFIG_DRIVER_SMC911X_16_BIT)
> +#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \
> +	CONFIG_DRIVER_SMC911X_16_BIT shall be set"
> +#endif
> +
>  #ifdef CONFIG_DRIVER_SMC911X_32_BIT
>  static inline u32 reg_read(u32 addr)
>  {
> @@ -39,9 +45,20 @@ static inline void reg_write(u32 addr, u32 val)
>  {
>  	*(volatile u32*)addr = val;
>  }
> +#elif CONFIG_DRIVER_SMC911X_16_BIT
> +static inline u32 reg_read(u32 addr)
> +{
> +	volatile u16 *addr_16 = (u16 *)addr;
> +	return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16));
> +}
> +static inline void reg_write(u32 addr, u32 val)
> +{
> +	*(volatile u16*)addr = (u16)val;
> +	*(volatile u16*)(addr + 2) = (u16)(val >> 16);
> +}
>  #else
> -#error "SMC911X: Only 32-bit bus is supported"
> -#endif
> +#error "SMC911X: undefined bus width"
> +#endif /* CONFIG_DRIVER_SMC911X_16_BIT */
>  
>  #define mdelay(n)       udelay((n)*1000)
>  
>
>   
Applied to net repo.

thanks,
Ben

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

end of thread, other threads:[~2008-05-23  6:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-05 12:06 [U-Boot-Users] [PATCH v3] smc911x: add 16 bit support Jens Gehrlein
2008-05-05 15:19 ` Ben Warren
2008-05-23  6:25 ` Ben Warren

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