* [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
@ 2011-09-10 8:40 Greg Ungerer
2011-09-10 14:11 ` Wolfgang Denk
2011-09-11 19:15 ` Mike Frysinger
0 siblings, 2 replies; 4+ messages in thread
From: Greg Ungerer @ 2011-09-10 8:40 UTC (permalink / raw)
To: u-boot
Trivial conversion of the ks8695eth driver to a CONFIG_MULTI_ETH type
driver.
Signed-off-by: Greg Ungerer <greg.ungerer@opengear.com>
---
board/cm4008/cm4008.c | 4 ++++
board/cm41xx/cm41xx.c | 4 ++++
drivers/net/ks8695eth.c | 42 ++++++++++++++++++++++++++++--------------
include/configs/cm4008.h | 1 +
include/configs/cm41xx.h | 1 +
include/netdev.h | 1 +
6 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/board/cm4008/cm4008.c b/board/cm4008/cm4008.c
index 63296f0..2e8d948 100644
--- a/board/cm4008/cm4008.c
+++ b/board/cm4008/cm4008.c
@@ -74,6 +74,10 @@ int board_late_init (void)
return 0;
}
+int board_eth_init(bd_t *bis)
+{
+ return ks8695_eth_initialize();
+}
int board_init (void)
{
diff --git a/board/cm41xx/cm41xx.c b/board/cm41xx/cm41xx.c
index 9a6d89f..72fd64d 100644
--- a/board/cm41xx/cm41xx.c
+++ b/board/cm41xx/cm41xx.c
@@ -74,6 +74,10 @@ int board_late_init (void)
return 0;
}
+int board_eth_init(bd_t *bis)
+{
+ return ks8695_eth_initialize();
+}
int board_init (void)
{
diff --git a/drivers/net/ks8695eth.c b/drivers/net/ks8695eth.c
index 5ea6e7f..cd36880 100644
--- a/drivers/net/ks8695eth.c
+++ b/drivers/net/ks8695eth.c
@@ -99,7 +99,7 @@ void ks8695_getmac(void)
/****************************************************************************/
-void eth_reset(bd_t *bd)
+static int ks8695_eth_init(struct eth_device *dev, bd_t *bd)
{
int i;
@@ -151,21 +151,12 @@ void eth_reset(bd_t *bd)
ks8695_write(KS8695_LAN_DMA_RX_START, 0x1);
printf("KS8695 ETHERNET: %pM\n", eth_mac);
-}
-
-/****************************************************************************/
-
-int eth_init(bd_t *bd)
-{
- debug ("%s(%d): eth_init()\n", __FILE__, __LINE__);
-
- eth_reset(bd);
return 0;
}
/****************************************************************************/
-void eth_halt(void)
+static void ks8695_eth_halt(struct eth_device *dev)
{
debug ("%s(%d): eth_halt()\n", __FILE__, __LINE__);
@@ -176,7 +167,7 @@ void eth_halt(void)
/****************************************************************************/
-int eth_rx(void)
+static int ks8695_eth_recv(struct eth_device *dev)
{
volatile struct ks8695_rxdesc *dp;
int i, len = 0;
@@ -199,7 +190,8 @@ int eth_rx(void)
/****************************************************************************/
-int eth_send(volatile void *packet, int len)
+static int ks8695_eth_send(struct eth_device *dev, volatile void *packet,
+ int len)
{
volatile struct ks8695_txdesc *dp;
static int next = 0;
@@ -224,5 +216,27 @@ int eth_send(volatile void *packet, int len)
if (++next >= TXDESCS)
next = 0;
- return len;
+ return 0;
+}
+
+/****************************************************************************/
+
+int ks8695_eth_initialize(void)
+{
+ struct eth_device *dev;
+
+ dev = malloc(sizeof(*dev));
+ if (dev == NULL)
+ return -1;
+ memset(dev, 0, sizeof(*dev));
+
+ dev->iobase = KS8695_IO_BASE + KS8695_LAN_DMA_TX;
+ dev->init = ks8695_eth_init;
+ dev->halt = ks8695_eth_halt;
+ dev->send = ks8695_eth_send;
+ dev->recv = ks8695_eth_recv;
+ strcpy(dev->name, "ks8695eth");
+
+ eth_register(dev);
+ return 0;
}
diff --git a/include/configs/cm4008.h b/include/configs/cm4008.h
index 81e4de4..5777062 100644
--- a/include/configs/cm4008.h
+++ b/include/configs/cm4008.h
@@ -38,6 +38,7 @@
#define CONFIG_INITRD_TAG 1
#define CONFIG_DRIVER_KS8695ETH /* use KS8695 ethernet driver */
+#define CONFIG_NET_MULTI
/*
* Size of malloc() pool
diff --git a/include/configs/cm41xx.h b/include/configs/cm41xx.h
index 785ab0a..66e689a 100644
--- a/include/configs/cm41xx.h
+++ b/include/configs/cm41xx.h
@@ -38,6 +38,7 @@
#define CONFIG_INITRD_TAG 1
#define CONFIG_DRIVER_KS8695ETH /* use KS8695 ethernet driver */
+#define CONFIG_NET_MULTI
/*
* Size of malloc() pool
diff --git a/include/netdev.h b/include/netdev.h
index 6f0a971..83d7886 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -66,6 +66,7 @@ int ftmac100_initialize(bd_t *bits);
int greth_initialize(bd_t *bis);
void gt6426x_eth_initialize(bd_t *bis);
int inca_switch_initialize(bd_t *bis);
+int ks8695_eth_initialize(bd_t *bis);
int lan91c96_initialize(u8 dev_num, int base_addr);
int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
int mcdmafec_initialize(bd_t *bis);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
2011-09-10 8:40 [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH Greg Ungerer
@ 2011-09-10 14:11 ` Wolfgang Denk
2011-09-11 19:15 ` Mike Frysinger
1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2011-09-10 14:11 UTC (permalink / raw)
To: u-boot
Dear Greg Ungerer,
In message <1315644034-10661-1-git-send-email-greg.ungerer@opengear.com> you wrote:
> Trivial conversion of the ks8695eth driver to a CONFIG_MULTI_ETH type
> driver.
>
> Signed-off-by: Greg Ungerer <greg.ungerer@opengear.com>
> ---
> board/cm4008/cm4008.c | 4 ++++
> board/cm41xx/cm41xx.c | 4 ++++
> drivers/net/ks8695eth.c | 42 ++++++++++++++++++++++++++++--------------
> include/configs/cm4008.h | 1 +
> include/configs/cm41xx.h | 1 +
> include/netdev.h | 1 +
> 6 files changed, 39 insertions(+), 14 deletions(-)
Applied, thanks.
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: wd at denx.de
Include the success of others in your dreams for your own success.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
2011-09-10 8:40 [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH Greg Ungerer
2011-09-10 14:11 ` Wolfgang Denk
@ 2011-09-11 19:15 ` Mike Frysinger
2011-09-12 12:39 ` Greg Ungerer
1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2011-09-11 19:15 UTC (permalink / raw)
To: u-boot
On Saturday, September 10, 2011 04:40:34 Greg Ungerer wrote:
> --- a/include/netdev.h
> +++ b/include/netdev.h
>
> +int ks8695_eth_initialize(bd_t *bis);
so you say the func needs bd_t* ...
> --- a/board/cm4008/cm4008.c
> +++ b/board/cm4008/cm4008.c
> --- a/board/cm41xx/cm41xx.c
> +++ b/board/cm41xx/cm41xx.c
>
> +int board_eth_init(bd_t *bis)
> +{
> + return ks8695_eth_initialize();
> +}
but you dont pass it in the board funcs ...
> --- a/drivers/net/ks8695eth.c
> +++ b/drivers/net/ks8695eth.c
>
> +int ks8695_eth_initialize(void)
nor does the func itself even take it ...
not sure how this compiles ? do none of these files include netdev.h ? if
they don't, i don't see how it compiles cleanly as that means you'd get
warnings about implicit func prototypes ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110911/5faae601/attachment.pgp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH
2011-09-11 19:15 ` Mike Frysinger
@ 2011-09-12 12:39 ` Greg Ungerer
0 siblings, 0 replies; 4+ messages in thread
From: Greg Ungerer @ 2011-09-12 12:39 UTC (permalink / raw)
To: u-boot
On 09/12/2011 05:15 AM, Mike Frysinger wrote:
> On Saturday, September 10, 2011 04:40:34 Greg Ungerer wrote:
>> --- a/include/netdev.h
>> +++ b/include/netdev.h
>>
>> +int ks8695_eth_initialize(bd_t *bis);
>
> so you say the func needs bd_t* ...
>
>> --- a/board/cm4008/cm4008.c
>> +++ b/board/cm4008/cm4008.c
>> --- a/board/cm41xx/cm41xx.c
>> +++ b/board/cm41xx/cm41xx.c
>>
>> +int board_eth_init(bd_t *bis)
>> +{
>> + return ks8695_eth_initialize();
>> +}
>
> but you dont pass it in the board funcs ...
>
>> --- a/drivers/net/ks8695eth.c
>> +++ b/drivers/net/ks8695eth.c
>>
>> +int ks8695_eth_initialize(void)
>
> nor does the func itself even take it ...
>
> not sure how this compiles ? do none of these files include netdev.h ? if
> they don't, i don't see how it compiles cleanly as that means you'd get
> warnings about implicit func prototypes ...
It compiled with a warning. Wolfgang fixed it in a follow-up patch.
Regards
Greg
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-12 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-10 8:40 [U-Boot] [PATCH] KS8695: convert KS8695 eth driver to CONFIG_MULTI_ETH Greg Ungerer
2011-09-10 14:11 ` Wolfgang Denk
2011-09-11 19:15 ` Mike Frysinger
2011-09-12 12:39 ` Greg Ungerer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox