mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
5c624b9e9c
Fixed cache misaligned issue in the net driver. The issue shows-up when a call to flush_dcache_range is made with unaligned memory. The memory must be aligned to ARCH_DMA_MINALIGN. Signed-off-by: Suji Velupillai <suji.velupillai@broadcom.com> Tested-by: Suji Velupillai <suji.velupillai@broadcom.com> Reviewed-by: Arun Parameswaran <arun.parameswaran@broadcom.com> Reviewed-by: JD Zheng <jiandong.zheng@broadcom.com> Reviewed-by: Shamez Kurji <shamez.kurji@broadcom.com> Signed-off-by: Steve Rae <steve.rae@raedomain.com> Cover Letter: This series resolves issues specific to the Broadcom SF2 driver: - fix cache misaligned issue - convert to Kconfig END Acked-by: Joe Hershberger <joe.hershberger@ni.com>
68 lines
1.4 KiB
C
68 lines
1.4 KiB
C
/*
|
|
* Copyright 2014-2017 Broadcom.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#ifndef _BCM_SF2_ETH_H_
|
|
#define _BCM_SF2_ETH_H_
|
|
|
|
#include <phy.h>
|
|
|
|
#define RX_BUF_SIZE 2048
|
|
/* RX_BUF_NUM must be power of 2 */
|
|
#define RX_BUF_NUM 32
|
|
|
|
#define TX_BUF_SIZE 2048
|
|
/* TX_BUF_NUM must be power of 2 */
|
|
#define TX_BUF_NUM 2
|
|
|
|
/* Support 2 Ethernet ports now */
|
|
#define BCM_ETH_MAX_PORT_NUM 2
|
|
|
|
#define CONFIG_BCM_SF2_ETH_DEFAULT_PORT 0
|
|
|
|
enum {
|
|
MAC_DMA_TX = 1,
|
|
MAC_DMA_RX = 2
|
|
};
|
|
|
|
struct eth_dma {
|
|
void *tx_desc_aligned;
|
|
void *rx_desc_aligned;
|
|
|
|
uint8_t *tx_buf;
|
|
uint8_t *rx_buf;
|
|
|
|
int cur_tx_index;
|
|
int cur_rx_index;
|
|
|
|
int (*tx_packet)(struct eth_dma *dma, void *packet, int length);
|
|
bool (*check_tx_done)(struct eth_dma *dma);
|
|
|
|
int (*check_rx_done)(struct eth_dma *dma, uint8_t *buf);
|
|
|
|
int (*enable_dma)(struct eth_dma *dma, int dir);
|
|
int (*disable_dma)(struct eth_dma *dma, int dir);
|
|
};
|
|
|
|
struct eth_info {
|
|
struct eth_dma dma;
|
|
phy_interface_t phy_interface;
|
|
struct phy_device *port[BCM_ETH_MAX_PORT_NUM];
|
|
int port_num;
|
|
|
|
int (*miiphy_read)(struct mii_dev *bus, int phyaddr, int devad,
|
|
int reg);
|
|
int (*miiphy_write)(struct mii_dev *bus, int phyaddr, int devad,
|
|
int reg, u16 value);
|
|
|
|
int (*mac_init)(struct eth_device *dev);
|
|
int (*enable_mac)(void);
|
|
int (*disable_mac)(void);
|
|
int (*set_mac_addr)(unsigned char *mac);
|
|
int (*set_mac_speed)(int speed, int duplex);
|
|
|
|
};
|
|
|
|
#endif /* _BCM_SF2_ETH_H_ */
|