Commit 314cf958 authored by Daire McNamara's avatar Daire McNamara Committed by David S. Miller
Browse files

net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs



On mpfs, with SRAM configured for 4 queues, setting max_tx_len
to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors.
Setting max_tx_len to (4KiB - 56) removes those errors.

The details are described in erratum 1686 by Cadence

The max jumbo frame size is also reduced for mpfs to (4KiB - 56).

Signed-off-by: default avatarDaire McNamara <daire.mcnamara@microchip.com>
Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1b5dfe6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1181,6 +1181,7 @@ struct macb_config {
			    struct clk **hclk, struct clk **tx_clk,
			    struct clk **rx_clk, struct clk **tsu_clk);
	int	(*init)(struct platform_device *pdev);
	unsigned int		max_tx_length;
	int	jumbo_max_len;
	const struct macb_usrio_config *usrio;
};
+9 −3
Original line number Diff line number Diff line
@@ -4117,14 +4117,12 @@ static int macb_init(struct platform_device *pdev)

	/* setup appropriated routines according to adapter type */
	if (macb_is_gem(bp)) {
		bp->max_tx_length = GEM_MAX_TX_LEN;
		bp->macbgem_ops.mog_alloc_rx_buffers = gem_alloc_rx_buffers;
		bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers;
		bp->macbgem_ops.mog_init_rings = gem_init_rings;
		bp->macbgem_ops.mog_rx = gem_rx;
		dev->ethtool_ops = &gem_ethtool_ops;
	} else {
		bp->max_tx_length = MACB_MAX_TX_LEN;
		bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers;
		bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers;
		bp->macbgem_ops.mog_init_rings = macb_init_rings;
@@ -4861,7 +4859,8 @@ static const struct macb_config mpfs_config = {
	.clk_init = macb_clk_init,
	.init = init_reset_optional,
	.usrio = &macb_default_usrio,
	.jumbo_max_len = 10240,
	.max_tx_length = 4040, /* Cadence Erratum 1686 */
	.jumbo_max_len = 4040,
};

static const struct macb_config sama7g5_gem_config = {
@@ -5012,6 +5011,13 @@ static int macb_probe(struct platform_device *pdev)
	if (macb_config)
		bp->jumbo_max_len = macb_config->jumbo_max_len;

	if (!hw_is_gem(bp->regs, bp->native_io))
		bp->max_tx_length = MACB_MAX_TX_LEN;
	else if (macb_config->max_tx_length)
		bp->max_tx_length = macb_config->max_tx_length;
	else
		bp->max_tx_length = GEM_MAX_TX_LEN;

	bp->wol = 0;
	if (of_property_read_bool(np, "magic-packet"))
		bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;