2019-04-30 07:17:49 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __LINUX_XILINX_LL_TEMAC_H
|
|
|
|
#define __LINUX_XILINX_LL_TEMAC_H
|
|
|
|
|
|
|
|
#include <linux/if_ether.h>
|
|
|
|
#include <linux/phy.h>
|
2019-05-23 12:02:20 +00:00
|
|
|
#include <linux/spinlock.h>
|
2019-04-30 07:17:49 +00:00
|
|
|
|
|
|
|
struct ll_temac_platform_data {
|
|
|
|
bool txcsum; /* Enable/disable TX checksum */
|
|
|
|
bool rxcsum; /* Enable/disable RX checksum */
|
|
|
|
u8 mac_addr[ETH_ALEN]; /* MAC address (6 bytes) */
|
|
|
|
/* Clock frequency for input to MDIO clock generator */
|
|
|
|
u32 mdio_clk_freq;
|
|
|
|
unsigned long long mdio_bus_id; /* Unique id for MDIO bus */
|
|
|
|
int phy_addr; /* Address of the PHY to connect to */
|
|
|
|
phy_interface_t phy_interface; /* PHY interface mode */
|
2019-04-30 07:17:51 +00:00
|
|
|
bool reg_little_endian; /* Little endian TEMAC register access */
|
|
|
|
bool dma_little_endian; /* Little endian DMA register access */
|
net: ll_temac: Support indirect_mutex share within TEMAC IP
Indirect register access goes through a DCR bus bridge, which
allows only one outstanding transaction. And to make matters
worse, each TEMAC IP block contains two Ethernet interfaces, and
although they seem to have separate registers for indirect access,
they actually share the registers. Or to be more specific, MSW, LSW
and CTL registers are physically shared between Ethernet interfaces
in same TEMAC IP, with RDY register being (almost) specificic to
the Ethernet interface. The 0x10000 bit in RDY reflects combined
bus ready state though.
So we need to take care to synchronize not only within a single
device, but also between devices in same TEMAC IP.
This commit allows to do that with legacy platform devices.
For OF devices, the xlnx,compound parent of the temac node should be
used to find siblings, and setup a shared indirect_mutex between them.
I will leave this work to somebody else, as I don't have hardware to
test that. No regression is introduced by that, as before this commit
using two Ethernet interfaces in same TEMAC block is simply broken.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-30 07:17:54 +00:00
|
|
|
/* Pre-initialized mutex to use for synchronizing indirect
|
|
|
|
* register access. When using both interfaces of a single
|
|
|
|
* TEMAC IP block, the same mutex should be passed here, as
|
|
|
|
* they share the same DCR bus bridge.
|
|
|
|
*/
|
2019-05-23 12:02:20 +00:00
|
|
|
spinlock_t *indirect_lock;
|
2019-04-30 07:17:58 +00:00
|
|
|
/* DMA channel control setup */
|
|
|
|
u8 tx_irq_timeout; /* TX Interrupt Delay Time-out */
|
|
|
|
u8 tx_irq_count; /* TX Interrupt Coalescing Threshold Count */
|
|
|
|
u8 rx_irq_timeout; /* RX Interrupt Delay Time-out */
|
|
|
|
u8 rx_irq_count; /* RX Interrupt Coalescing Threshold Count */
|
2019-04-30 07:17:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __LINUX_XILINX_LL_TEMAC_H */
|