Commit Graph

16452 Commits

Author SHA1 Message Date
Nobuhiro Iwamatsu
99fc4fd168 sh/ap_sh4a_4a: Fix typo of operator in ET0_ETXD4
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:54 +09:00
Phil Edworthy
99744b7e34 sh: Add SH7269 device and RSK2+SH7269 board
This is an sh2a device (max 266MHz) with FPU, video display
controller (VDC), 8 serial ports, 4 I2C channels, 3 CAN ports,
SD and on-chip USB.

The RSK2+SH7269 board uses the SH7269 processor. It is often
referred to as just rsk7269.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:54 +09:00
Nobuhiro Iwamatsu
a80a661989 sh: Set CONFIG_SH_ETHER_PHY_MODE and CONFIG_SH_ETHER_SH7734_MII to boards with sh_eth
The board with sh_eth needs to set CONFIG_SH_ETHER_PHY_MODE.
And SH7734 needs to set value of CONFIG_SH_ETHER_SH7734_MII.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:54 +09:00
Nobuhiro Iwamatsu
bfc93fb47d sh: Add support for AP-SH4A-4A board
The AP-SH4A-4A board has SH7734, 64MB DDR2-SDRAM, USB,
Ethernet, and more.

This patch supports the following functions:
  - 64MB DDR2-SDRAM
  - 16MB NOR Flash memory
  - Serial console (SCIF)
  - Ethernet (SH-Ether with Gigabit)
  - I2C

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:54 +09:00
Nobuhiro Iwamatsu
4eb0b78e76 sh: Add register definition of PFC for SH7734
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:53 +09:00
Nobuhiro Iwamatsu
d740555968 sh: r0p7734: Add support I2C controller
This read MAC address from Serial EEPROM and set.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:53 +09:00
Nobuhiro Iwamatsu
1379c51ea5 sh: Add bit control functions
This provide bit control functions as clrbits_*, setbits_* and
clrsetbits_*.

V2: Fix comment style and error of whitespace.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:53 +09:00
Nobuhiro Iwamatsu
8ca805e102 sh: Add support for r0p7734 board
The r0p7734 board has SH7734, 128MB DDR2-SDRAM, USB,
Ethernet, and more.

This patch supports the following functions:
- 128MB DDR2-SDRAM
- 32MB NOR Flash memory
- Serial console (SCIF)
- Ethernet (SH-Ether/SMSC)

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:53 +09:00
Nobuhiro Iwamatsu
2a57e7ec96 sh: Add support Renesas SH7734
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2012-05-28 09:12:53 +09:00
Nobuhiro Iwamatsu
4398d55991 net: sh-eth: Add support Gigabit of SH7734
SH7734 support GMII. This add register infomation and the function
which enable GMII.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
2012-05-23 17:53:09 -05:00
Nobuhiro Iwamatsu
ee6ec5d4dd net: sh_eth: Add support SH7734 Ethernet device
SH7734 has one channel ethernet device.
This support 10/100/1000Base, and RMII/MII/GMII.
And this has the same structure as SH7763.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
2012-05-23 17:53:09 -05:00
Joe Hershberger
4ef8d53caa net: Allow filtering on debug traces in the net subsystem
Add several levels of DEBUG prints so that you can limit the noise to
the severety of your problem.

DEBUG_LL_STATE = Link local state machine changes
DEBUG_DEV_PKT = Packets or info directed to the device
DEBUG_NET_PKT = Packets on info on the network at large
DEBUG_INT_STATE = Internal network state changes

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:08 -05:00
Joe Hershberger
c697576262 net: Work-around for brain-damaged Cisco equipment with arp-proxy
Cisco's arp-proxy feature fails to ignore the link-local address range
This means that a link-local device on a network with this Cisco
equipment will reply to ARP requests for our device (in addition to
our reply).
If we happen to reply first, the requester's ARP table will be
populated with our MAC address, and one packet will be sent to us...
shortly following this, the requester will get an ARP reply from the
Cisco equipment telling the requester to send packets their way
instead of to our device from now on.
This work-around detects this link-local condition and will delay
replying to the ARP request for 5ms so that the first packet is sent
to the Cisco equipment and all following packets are sent to our
device.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:08 -05:00
Joe Hershberger
d22c338e07 net: Add link-local addressing support
Code based on networking/zcip.c in busybox
commit 8531d76a15890c2c535908ce888b2e2aed35b172

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:08 -05:00
Joe Hershberger
228041893c net: Separate ArpRequest() into lower-level func
Link-local support will need to send ARP packets, but needs more
fine-grained control over the contents.  Split the implementation
into 2 parts so link-local can share the code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:07 -05:00
Joe Hershberger
e94070c443 net: Don't copy every packet that waits for an ARP
Use the NetArpTxPacket for the ARP packet, not to hold what used to
be in NetTxPacket.
This saves a copy and makes the code easier to understand.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:53:07 -05:00
Joe Hershberger
d7310c7e63 net: Make sure NetLoop is initialized when using NetConsole
Fix NetConsole bug that causes first packet header to claim a
source IP address of 0.0.0.0

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:06 -05:00
Joe Hershberger
46c495d524 net: Fix net buffer initialization
A new non-static function net_init() will initialize buffers and
read from the environment.  Only update from the env on each entry
to NetLoop().

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:53:06 -05:00
Joe Hershberger
cb1c991120 net: Remove unused parameter from NetInitLoop()
Noone uses it.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:53:06 -05:00
Joe Hershberger
f1d2d28469 net: Remove static allocation for MAC address in PingSend()
Don't force ARP clients to return the MAC address if they don't care
(such as ping)

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 17:53:05 -05:00
Joe Hershberger
2c00e099fe net: Add option CONFIG_BOOTP_MAY_FAIL
This is useful if you want to look for a DHCP server, but try some
other settings if not available.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:53:05 -05:00
Joe Hershberger
1752f0fdc7 net: Fix unused variable compile warning
If CONFIG_BOOTP_SERVERIP is not defined, unused variable warning is
reported.  This was fixed upstream using a compiler feature instead
of a simple reorder of the statements.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 17:53:05 -05:00
Joe Hershberger
a3e1a727fe net: Don't write the "serverip" env var if configured not to
Before this patch, bootp would not overwrite the value, but the
value was still clobbered in the env

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:53:04 -05:00
Joe Hershberger
e711101581 net: Add net_update_ether() to handle ARP and Ping replies
When the network is VLAN or SNAP, net_update_ether() will preserve
the original Ethernet packet header and simply replace the src and
dest MACs and the protocol

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:53:04 -05:00
Joe Hershberger
ece223b52a net: Refactor to separate the UDP handler from the ARP handler
Call a built-in dummy if none is registered... don't require
protocols to register a handler (eliminating dummies)
NetConsole now uses the ARP handler when waiting on arp
(instead of needing a #define hack in arp.c)
Clear handlers at the end of net loop

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:52:53 -05:00
Joe Hershberger
22f6e99d5b net: Refactor to protect access to the NetState variable
Changes to NetState now go through an accessor function called
net_set_state()

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:21 -05:00
Joe Hershberger
adf5d93e44 net: Refactor to use NetSendPacket instead of eth_send directly
Use this entry-point consistently across the net/ code
Use a static inline function to preserve code size

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:20 -05:00
Joe Hershberger
61da3c2af8 net: Refactor ping receive handler
There is no need to call through the handler... inline it

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 17:46:20 -05:00
Joe Hershberger
f9623229fd net: Move debug trace to point of action
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:20 -05:00
Joe Hershberger
ae446f5622 net: Refactor bootp packet length computations
Eliminate pointer subtraction that recovers values computed earlier

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:19 -05:00
Joe Hershberger
00f33268ab net: Refactor packet length computations
Save the length when it is computed instead of forgetting it and
subtracting pointers to figure it out again.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 17:46:19 -05:00
Joe Hershberger
9214637a56 net: Refactor NetSendUDPPacket to share more code
Share more of the code that is common between ARP vs not.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:18 -05:00
Joe Hershberger
4b11c9166b net: Refactor IP, UPD, and ICMP header writing functions
ICMP (ping) was reimplementing IP header code... it now shares code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 17:46:18 -05:00
Joe Hershberger
674bb24982 net: cosmetic: Replace magic numbers in arp.c with constants
Use field names and sizes when accessing ARP packets

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:18 -05:00
Joe Hershberger
1256793b18 net: cosmetic: Rename tmp to reply_ip_addr in arp.c
Renamed for clarity

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:17 -05:00
Joe Hershberger
4545f4e6db net: cosmetic: Alphabetize includes in net.c
Easier to find when alphabetized

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:17 -05:00
Joe Hershberger
f8315731db net: cosmetic: Rename OPT_SIZE to OPT_FIELD_SIZE
Clearer constant name.
Also remove related BOOTP_SIZE which was unused and doesn't take
into account VLAN packets.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:17 -05:00
Joe Hershberger
0b4c5ff4ab net: cosmetic: Rename CDPHandler to cdp_receive
This is not called as a handler, so don't name it that way

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:16 -05:00
Joe Hershberger
8d353eb86d net: cosmetic: Rename "x" to "eth_proto"
x is a poor variable name

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:16 -05:00
Joe Hershberger
da5ebe2c9a net: cosmetic: Add a more explicit comment about 802.2
Make the comment more accurate about the header including SNAP

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:16 -05:00
Joe Hershberger
206d07fd7c net: cosmetic: Rename parameter len to payload_len
This name more explicitly claims that it does not include the
header size

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 17:46:15 -05:00
Joe Hershberger
e0a630795b net: cosmetic: Un-typedef ICMP_t
Remove typedef and lower-case name

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:15 -05:00
Joe Hershberger
738853bb6d net: cosmetic: Un-typedef ARP_t
Remove typedef and lower-case letters

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:15 -05:00
Joe Hershberger
c68cca35b3 net: cosmetic: Un-typedef VLAN_Ethernet_t
Eliminate the typedef and remove capital letters

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:14 -05:00
Joe Hershberger
cb487f5664 net: cosmetic: Un-typedef Ethernet_t
Separate the Ethernet header from the 802 header.
Base the size constants on the structs.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:14 -05:00
Joe Hershberger
c5c59df04d net: cosmetic: Split struct ip_udp_hdr into ip_hdr
Add a structure that only contains IP header fields to be used by
functions that don't need UDP
Rename IP_HDR_SIZE_NO_UDP to IP_HDR_SIZE

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:14 -05:00
Joe Hershberger
594c26f8a7 net: cosmetic: Un-typedef IP_t
Rename IP header related things to IP_UDP. The existing definition
of IP_t includes UDP header, so name it to accurately describe the
structure.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-23 17:46:00 -05:00
Joe Hershberger
8b9c53221f net: Move RARP receive logic out of net.c
Separate this functionality out of the net.c behemoth

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 14:19:24 -05:00
Joe Hershberger
a36b12f95a net: Move PING out of net.c
Separate this functionality out of the net.c behemoth

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-23 14:19:23 -05:00
Joe Hershberger
d280d3f430 net: Move ARP out of net.c
Separate this functionality out of the net.c behemoth

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-05-23 14:19:23 -05:00