drivers: eth: sam_gmac: Use DT max_frame_size option
This commit updates the Atmel SAM GMAC driver to select max frame size value from the device tree. Now GMAC driver can operate with the three different frame size options available. The current supported values are: 1518, 1536 and 10240. Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
parent
3c4fbfddf5
commit
15c048a1dd
2 changed files with 16 additions and 2 deletions
|
@ -1876,12 +1876,13 @@ static void eth0_iface_init(struct net_if *iface)
|
|||
/* Check the status of data caches */
|
||||
dcache_is_enabled();
|
||||
|
||||
/* Initialize GMAC driver, maximum frame length is 1518 bytes */
|
||||
/* Initialize GMAC driver */
|
||||
gmac_ncfgr_val =
|
||||
GMAC_NCFGR_MTIHEN /* Multicast Hash Enable */
|
||||
| GMAC_NCFGR_LFERD /* Length Field Error Frame Discard */
|
||||
| GMAC_NCFGR_RFCS /* Remove Frame Check Sequence */
|
||||
| GMAC_NCFGR_RXCOEN; /* Receive Checksum Offload Enable */
|
||||
| GMAC_NCFGR_RXCOEN /* Receive Checksum Offload Enable */
|
||||
| GMAC_MAX_FRAME_SIZE;
|
||||
result = gmac_init(cfg->regs, gmac_ncfgr_val);
|
||||
if (result < 0) {
|
||||
LOG_ERR("Unable to initialize ETH driver");
|
||||
|
|
|
@ -194,6 +194,19 @@ enum queue_idx {
|
|||
GMAC_QUE_5, /** Priority queue 5 */
|
||||
};
|
||||
|
||||
#if (DT_INST_PROP(0, max_frame_size) == 1518)
|
||||
/* Maximum frame length is 1518 bytes */
|
||||
#define GMAC_MAX_FRAME_SIZE 0
|
||||
#elif (DT_INST_PROP(0, max_frame_size) == 1536)
|
||||
/* Enable Max Frame Size of 1536 */
|
||||
#define GMAC_MAX_FRAME_SIZE GMAC_NCFGR_MAXFS
|
||||
#elif (DT_INST_PROP(0, max_frame_size) == 10240)
|
||||
/* Jumbo Frame Enable */
|
||||
#define GMAC_MAX_FRAME_SIZE GMAC_NCFGR_JFRAME
|
||||
#else
|
||||
#error "GMAC_MAX_FRAME_SIZE is invalid, fix it at device tree."
|
||||
#endif
|
||||
|
||||
/** Minimal ring buffer implementation */
|
||||
struct ring_buf {
|
||||
u32_t *buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue