Skip to content

Commit c6233a5

Browse files
committed
Add W6300 device driver
1 parent fd5410c commit c6233a5

File tree

8 files changed

+1187
-1113
lines changed

8 files changed

+1187
-1113
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ LWIPOBJ := network.o netio.o gcif.o \
128128
sys.o tcp.o tcp_in.o tcp_out.o \
129129
udp.o icmp.o ip.o ip_frag.o \
130130
ip_addr.o etharp.o loopif.o \
131-
enc28j60if.o w5500if.o w6100if.o
131+
enc28j60if.o w5500if.o w6x00if.o
132132

133133
#---------------------------------------------------------------------------------
134134
OGCOBJ := \
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*-------------------------------------------------------------
22
3-
w6100if.h -- W6100 device driver
3+
w6x00if.h -- W6X00 device driver
44
5-
Copyright (C) 2024 Extrems' Corner.org
5+
Copyright (C) 2024 - 2025 Extrems' Corner.org
66
77
This software is provided 'as-is', without any express or implied
88
warranty. In no event will the authors be held liable for any
@@ -25,11 +25,11 @@ distribution.
2525
2626
-------------------------------------------------------------*/
2727

28-
#ifndef __NETIF_W6100IF_H__
29-
#define __NETIF_W6100IF_H__
28+
#ifndef __NETIF_W6X00IF_H__
29+
#define __NETIF_W6X00IF_H__
3030

3131
#include "lwip/netif.h"
3232

33-
err_t w6100if_init(struct netif *netif);
33+
err_t w6x00if_init(struct netif *netif);
3434

35-
#endif /* __NETIF_W6100IF_H__ */
35+
#endif /* __NETIF_W6X00IF_H__ */

libogc/exi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,6 @@ char *EXI_GetTypeString(u32 nType)
784784
return "GDEV";
785785
case 0x02020000:
786786
return "Modem";
787-
case 0x03000000:
788-
return "WIZnet";
789787
case 0x03010000:
790788
return "Marlin";
791789
case 0x04120000:
@@ -817,6 +815,9 @@ char *EXI_GetTypeString(u32 nType)
817815
return "IDE-EXI";
818816
case 0xfa050000:
819817
return "ENC28J60";
818+
case 0x03000000:
819+
case 0xff800000:
820+
return "WIZnet";
820821
default:
821822
return "Unknown";
822823
}

lwip/netif/enc28j60if.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ distribution.
4343

4444
static vu32 *const _piReg = (u32 *)0xCC003000;
4545

46+
#define ENC28J60_CID (0xFA050000)
47+
4648
#define ENC28J60_CMD_RCR(x) ((0x00 | ((x) & 0x1F)) << 24) // Read Control Register
4749
#define ENC28J60_CMD_RBM ((0x3A) << 24) // Read Buffer Memory
4850
#define ENC28J60_CMD_WCR(x) ((0x40 | ((x) & 0x1F)) << 24) // Write Control Register
@@ -601,7 +603,7 @@ static bool ENC28J60_Init(s32 chan, s32 dev, struct enc28j60if *enc28j60if)
601603
CurrBank[chan] = 0;
602604
usleep(1000);
603605

604-
if (!EXI_GetIDEx(chan, dev, &id) || id != 0xFA050000 ||
606+
if (!EXI_GetIDEx(chan, dev, &id) || id != ENC28J60_CID ||
605607
!ENC28J60_ReadPHYReg(chan, ENC28J60_PHID1, &phid1) || phid1 != 0x0083 ||
606608
!ENC28J60_ReadPHYReg(chan, ENC28J60_PHID2, &phid2) || phid2 != 0x1400) {
607609
if (chan < EXI_CHANNEL_2 && dev == EXI_DEVICE_0)

lwip/netif/w5500if.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ distribution.
3939

4040
static vu32 *const _piReg = (u32 *)0xCC003000;
4141

42+
#define W5500_CID (0x03000000)
43+
4244
#define W5500_BSB(x) (((x) & 0x1F) << 27) // Block Select Bits
4345
#define W5500_RWB (1 << 26) // Read/Write Access Mode Bit
4446
#define W5500_OM(x) (((x) & 0x3) << 24) // SPI Operation Mode Bits
@@ -351,7 +353,7 @@ static bool W5500_WriteCmd(s32 chan, u32 cmd, const void *buf, u32 len)
351353
{
352354
bool err = false;
353355

354-
cmd |= W5500_RWB;
356+
cmd |= W5500_RWB;
355357
cmd = (cmd << 16) | (cmd >> 16);
356358

357359
if (!EXI_Select(chan, Dev[chan], EXI_SPEED32MHZ))
@@ -564,14 +566,15 @@ static bool W5500_Init(s32 chan, s32 dev, struct w5500if *w5500if)
564566
LWP_ThreadSleep(w5500if->unlockQueue);
565567
IRQ_Restore(level);
566568

567-
if (!EXI_GetID(chan, dev, &id) || id != 0x03000000) {
569+
if (!EXI_GetID(chan, dev, &id) || id != W5500_CID) {
568570
if (chan < EXI_CHANNEL_2 && dev == EXI_DEVICE_0)
569571
EXI_Detach(chan);
570572
EXI_Unlock(chan);
571573
return false;
572574
}
573575

574576
Dev[chan] = dev;
577+
575578
if (!W5500_ReadReg(chan, W5500_VERSIONR, &versionr) || versionr != 0x04) {
576579
if (chan < EXI_CHANNEL_2 && dev == EXI_DEVICE_0)
577580
EXI_Detach(chan);

lwip/netif/w6100if.c

Lines changed: 0 additions & 1099 deletions
This file was deleted.

lwip/netif/w6x00if.c

Lines changed: 1167 additions & 0 deletions
Large diffs are not rendered by default.

lwip/network.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <netif/gcif/gcif.h>
3030
#include <netif/loopif.h>
3131
#include <netif/w5500if.h>
32-
#include <netif/w6100if.h>
32+
#include <netif/w6x00if.h>
3333

3434
#include <sys/iosupport.h>
3535

@@ -1517,7 +1517,7 @@ s32 if_configex(struct in_addr *local_ip,struct in_addr *netmask,struct in_addr
15171517
hbba = bba_create(&g_hNetIF);
15181518
pnet = netif_add(&g_hNetIF,&loc_ip,&mask,&gw,hbba,bba_init,net_input);
15191519
if(!pnet)
1520-
pnet = netif_add(&g_hNetIF,&loc_ip,&mask,&gw,NULL,w6100if_init,net_input);
1520+
pnet = netif_add(&g_hNetIF,&loc_ip,&mask,&gw,NULL,w6x00if_init,net_input);
15211521
if(!pnet)
15221522
pnet = netif_add(&g_hNetIF,&loc_ip,&mask,&gw,NULL,w5500if_init,net_input);
15231523
if(!pnet)

0 commit comments

Comments
 (0)