blob: 3682ae75c7aa35ea904179330c8d5e794394b830 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +02002/*
3 * MV-643XX ethernet platform device data definition file.
4 */
Lennert Buytenhekfa3959f2008-04-24 01:27:02 +02005
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +02006#ifndef __LINUX_MV643XX_ETH_H
7#define __LINUX_MV643XX_ETH_H
8
Lennert Buytenhekf2ce8252008-04-24 01:27:17 +02009#include <linux/mbus.h>
Joe Perches574e2af2013-08-01 16:17:48 -070010#include <linux/if_ether.h>
Lennert Buytenhekf2ce8252008-04-24 01:27:17 +020011
Lennert Buytenhek240e44192008-04-24 01:27:44 +020012#define MV643XX_ETH_SHARED_NAME "mv643xx_eth"
13#define MV643XX_ETH_NAME "mv643xx_eth_port"
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020014#define MV643XX_ETH_SHARED_REGS 0x2000
15#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000
Dale Farnsworth3077d782007-10-29 15:39:01 -070016#define MV643XX_ETH_BAR_4 0x2220
17#define MV643XX_ETH_SIZE_REG_4 0x2224
18#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020019
Arnaud Patard (Rtp)58569ae2012-07-26 12:15:46 +020020#define MV643XX_TX_CSUM_DEFAULT_LIMIT 0
21
Lennert Buytenhekf2ce8252008-04-24 01:27:17 +020022struct mv643xx_eth_shared_platform_data {
23 struct mbus_dram_target_info *dram;
Saeed Bishara9b2c2ff2010-06-27 00:26:43 +000024 /*
25 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
26 * limit of 9KiB will be used.
27 */
28 int tx_csum_limit;
Lennert Buytenhekf2ce8252008-04-24 01:27:17 +020029};
30
Lennert Buytenhekac8406052008-08-26 14:06:47 +020031#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
32#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
33#define MV643XX_ETH_PHY_NONE 0xff
34
Sebastian Hesselbarth5f292352013-05-29 09:32:45 +000035struct device_node;
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020036struct mv643xx_eth_platform_data {
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020037 /*
38 * Pointer back to our parent instance, and our port number.
39 */
Lennert Buytenhekfa3959f2008-04-24 01:27:02 +020040 struct platform_device *shared;
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020041 int port_number;
Lennert Buytenhekfa3959f2008-04-24 01:27:02 +020042
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020043 /*
44 * Whether a PHY is present, and if yes, at which address.
45 */
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020046 int phy_addr;
Sebastian Hesselbarth5f292352013-05-29 09:32:45 +000047 struct device_node *phy_node;
Lennert Buytenhekce4e2e42008-04-24 01:29:59 +020048
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020049 /*
50 * Use this MAC address if it is valid, overriding the
51 * address that is already in the hardware.
52 */
Joe Perches574e2af2013-08-01 16:17:48 -070053 u8 mac_addr[ETH_ALEN];
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020054
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020055 /*
56 * If speed is 0, autonegotiation is enabled.
57 * Valid values for speed: 0, SPEED_10, SPEED_100, SPEED_1000.
58 * Valid values for duplex: DUPLEX_HALF, DUPLEX_FULL.
59 */
60 int speed;
61 int duplex;
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020062
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020063 /*
Lennert Buytenhekf7981c12008-08-26 10:23:22 +020064 * How many RX/TX queues to use.
Lennert Buytenhek64da80a2008-06-02 01:01:26 +020065 */
Lennert Buytenhekf7981c12008-08-26 10:23:22 +020066 int rx_queue_count;
67 int tx_queue_count;
Lennert Buytenhek64da80a2008-06-02 01:01:26 +020068
69 /*
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020070 * Override default RX/TX queue sizes if nonzero.
71 */
72 int rx_queue_size;
73 int tx_queue_size;
74
75 /*
76 * Use on-chip SRAM for RX/TX descriptors if size is nonzero
77 * and sufficient to contain all descriptors for the requested
78 * ring sizes.
79 */
80 unsigned long rx_sram_addr;
81 int rx_sram_size;
82 unsigned long tx_sram_addr;
83 int tx_sram_size;
Lennert Buytenhekc4a6a2a2007-10-19 04:09:53 +020084};
85
Lennert Buytenhekfc32b0e2008-06-02 00:28:40 +020086
87#endif