18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * MV-643XX ethernet platform device data definition file.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __LINUX_MV643XX_ETH_H
78c2ecf20Sopenharmony_ci#define __LINUX_MV643XX_ETH_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/mbus.h>
108c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define MV643XX_ETH_SHARED_NAME		"mv643xx_eth"
138c2ecf20Sopenharmony_ci#define MV643XX_ETH_NAME		"mv643xx_eth_port"
148c2ecf20Sopenharmony_ci#define MV643XX_ETH_SHARED_REGS		0x2000
158c2ecf20Sopenharmony_ci#define MV643XX_ETH_SHARED_REGS_SIZE	0x2000
168c2ecf20Sopenharmony_ci#define MV643XX_ETH_BAR_4		0x2220
178c2ecf20Sopenharmony_ci#define MV643XX_ETH_SIZE_REG_4		0x2224
188c2ecf20Sopenharmony_ci#define MV643XX_ETH_BASE_ADDR_ENABLE_REG	0x2290
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define MV643XX_TX_CSUM_DEFAULT_LIMIT	0
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct mv643xx_eth_shared_platform_data {
238c2ecf20Sopenharmony_ci	struct mbus_dram_target_info	*dram;
248c2ecf20Sopenharmony_ci	/*
258c2ecf20Sopenharmony_ci	 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
268c2ecf20Sopenharmony_ci	 * limit of 9KiB will be used.
278c2ecf20Sopenharmony_ci	 */
288c2ecf20Sopenharmony_ci	int			tx_csum_limit;
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define MV643XX_ETH_PHY_ADDR_DEFAULT	0
328c2ecf20Sopenharmony_ci#define MV643XX_ETH_PHY_ADDR(x)		(0x80 | (x))
338c2ecf20Sopenharmony_ci#define MV643XX_ETH_PHY_NONE		0xff
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistruct device_node;
368c2ecf20Sopenharmony_cistruct mv643xx_eth_platform_data {
378c2ecf20Sopenharmony_ci	/*
388c2ecf20Sopenharmony_ci	 * Pointer back to our parent instance, and our port number.
398c2ecf20Sopenharmony_ci	 */
408c2ecf20Sopenharmony_ci	struct platform_device	*shared;
418c2ecf20Sopenharmony_ci	int			port_number;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	/*
448c2ecf20Sopenharmony_ci	 * Whether a PHY is present, and if yes, at which address.
458c2ecf20Sopenharmony_ci	 */
468c2ecf20Sopenharmony_ci	int			phy_addr;
478c2ecf20Sopenharmony_ci	struct device_node	*phy_node;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	/*
508c2ecf20Sopenharmony_ci	 * Use this MAC address if it is valid, overriding the
518c2ecf20Sopenharmony_ci	 * address that is already in the hardware.
528c2ecf20Sopenharmony_ci	 */
538c2ecf20Sopenharmony_ci	u8			mac_addr[ETH_ALEN];
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	/*
568c2ecf20Sopenharmony_ci	 * If speed is 0, autonegotiation is enabled.
578c2ecf20Sopenharmony_ci	 *   Valid values for speed: 0, SPEED_10, SPEED_100, SPEED_1000.
588c2ecf20Sopenharmony_ci	 *   Valid values for duplex: DUPLEX_HALF, DUPLEX_FULL.
598c2ecf20Sopenharmony_ci	 */
608c2ecf20Sopenharmony_ci	int			speed;
618c2ecf20Sopenharmony_ci	int			duplex;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	/*
648c2ecf20Sopenharmony_ci	 * How many RX/TX queues to use.
658c2ecf20Sopenharmony_ci	 */
668c2ecf20Sopenharmony_ci	int			rx_queue_count;
678c2ecf20Sopenharmony_ci	int			tx_queue_count;
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	/*
708c2ecf20Sopenharmony_ci	 * Override default RX/TX queue sizes if nonzero.
718c2ecf20Sopenharmony_ci	 */
728c2ecf20Sopenharmony_ci	int			rx_queue_size;
738c2ecf20Sopenharmony_ci	int			tx_queue_size;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	/*
768c2ecf20Sopenharmony_ci	 * Use on-chip SRAM for RX/TX descriptors if size is nonzero
778c2ecf20Sopenharmony_ci	 * and sufficient to contain all descriptors for the requested
788c2ecf20Sopenharmony_ci	 * ring sizes.
798c2ecf20Sopenharmony_ci	 */
808c2ecf20Sopenharmony_ci	unsigned long		rx_sram_addr;
818c2ecf20Sopenharmony_ci	int			rx_sram_size;
828c2ecf20Sopenharmony_ci	unsigned long		tx_sram_addr;
838c2ecf20Sopenharmony_ci	int			tx_sram_size;
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#endif
88