aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-12-02 23:35:22 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-02 23:35:22 -0500
commita64f3f83505f4ed6662fd9dda998d4890aba58bd (patch)
treebd5cc56420c19043b3a247b786dfc68bebbc9a0c
parent9f7aec5f563f6e82efa96342547a5285f751106b (diff)
parentc4a25007cfccbf19e6481885af378bca5e681683 (diff)
Merge branch 'mvneta-fixes'
Marcin Wojtas says: ==================== Marvell Armada XP/370/38X Neta fixes I'm sending v4 with corrected commit log of the last patch, in order to avoid possible conflicts between the branches as suggested by Gregory Clement. Best regards, Marcin Wojtas Changes from v4: * Correct commit log of patch 6/6 Changes from v2: * Style fixes in patch updating mbus protection * Remove redundant stable notifications except for patch 4/6 Changes from v1: * update MBUS windows access protection register once, after whole loop * add fixing value of MVNETA_RXQ_INTR_ENABLE_ALL_MASK * add fixing error path for skb_build() * add possibility of setting custom TX IP checksum limit in DT property ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt6
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi1
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c33
3 files changed, 34 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
index f5a8ca29aff0..aeea50c84e92 100644
--- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
+++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
@@ -8,6 +8,11 @@ Required properties:
8- phy-mode: See ethernet.txt file in the same directory 8- phy-mode: See ethernet.txt file in the same directory
9- clocks: a pointer to the reference clock for this device. 9- clocks: a pointer to the reference clock for this device.
10 10
11Optional properties:
12- tx-csum-limit: maximum mtu supported by port that allow TX checksum.
13 Value is presented in bytes. If not used, by default 1600B is set for
14 "marvell,armada-370-neta" and 9800B for others.
15
11Example: 16Example:
12 17
13ethernet@d0070000 { 18ethernet@d0070000 {
@@ -15,6 +20,7 @@ ethernet@d0070000 {
15 reg = <0xd0070000 0x2500>; 20 reg = <0xd0070000 0x2500>;
16 interrupts = <8>; 21 interrupts = <8>;
17 clocks = <&gate_clk 4>; 22 clocks = <&gate_clk 4>;
23 tx-csum-limit = <9800>
18 status = "okay"; 24 status = "okay";
19 phy = <&phy0>; 25 phy = <&phy0>;
20 phy-mode = "rgmii-id"; 26 phy-mode = "rgmii-id";
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index c6a0e9d7f1a9..e8b7f6726772 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -498,6 +498,7 @@
498 reg = <0x70000 0x4000>; 498 reg = <0x70000 0x4000>;
499 interrupts-extended = <&mpic 8>; 499 interrupts-extended = <&mpic 8>;
500 clocks = <&gateclk 4>; 500 clocks = <&gateclk 4>;
501 tx-csum-limit = <9800>;
501 status = "disabled"; 502 status = "disabled";
502 }; 503 };
503 504
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index e84c7f2634d3..ed622fa29dfa 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -36,7 +36,7 @@
36 36
37/* Registers */ 37/* Registers */
38#define MVNETA_RXQ_CONFIG_REG(q) (0x1400 + ((q) << 2)) 38#define MVNETA_RXQ_CONFIG_REG(q) (0x1400 + ((q) << 2))
39#define MVNETA_RXQ_HW_BUF_ALLOC BIT(1) 39#define MVNETA_RXQ_HW_BUF_ALLOC BIT(0)
40#define MVNETA_RXQ_PKT_OFFSET_ALL_MASK (0xf << 8) 40#define MVNETA_RXQ_PKT_OFFSET_ALL_MASK (0xf << 8)
41#define MVNETA_RXQ_PKT_OFFSET_MASK(offs) ((offs) << 8) 41#define MVNETA_RXQ_PKT_OFFSET_MASK(offs) ((offs) << 8)
42#define MVNETA_RXQ_THRESHOLD_REG(q) (0x14c0 + ((q) << 2)) 42#define MVNETA_RXQ_THRESHOLD_REG(q) (0x14c0 + ((q) << 2))
@@ -62,6 +62,7 @@
62#define MVNETA_WIN_SIZE(w) (0x2204 + ((w) << 3)) 62#define MVNETA_WIN_SIZE(w) (0x2204 + ((w) << 3))
63#define MVNETA_WIN_REMAP(w) (0x2280 + ((w) << 2)) 63#define MVNETA_WIN_REMAP(w) (0x2280 + ((w) << 2))
64#define MVNETA_BASE_ADDR_ENABLE 0x2290 64#define MVNETA_BASE_ADDR_ENABLE 0x2290
65#define MVNETA_ACCESS_PROTECT_ENABLE 0x2294
65#define MVNETA_PORT_CONFIG 0x2400 66#define MVNETA_PORT_CONFIG 0x2400
66#define MVNETA_UNI_PROMISC_MODE BIT(0) 67#define MVNETA_UNI_PROMISC_MODE BIT(0)
67#define MVNETA_DEF_RXQ(q) ((q) << 1) 68#define MVNETA_DEF_RXQ(q) ((q) << 1)
@@ -159,7 +160,7 @@
159 160
160#define MVNETA_INTR_ENABLE 0x25b8 161#define MVNETA_INTR_ENABLE 0x25b8
161#define MVNETA_TXQ_INTR_ENABLE_ALL_MASK 0x0000ff00 162#define MVNETA_TXQ_INTR_ENABLE_ALL_MASK 0x0000ff00
162#define MVNETA_RXQ_INTR_ENABLE_ALL_MASK 0xff000000 // note: neta says it's 0x000000FF 163#define MVNETA_RXQ_INTR_ENABLE_ALL_MASK 0x000000ff
163 164
164#define MVNETA_RXQ_CMD 0x2680 165#define MVNETA_RXQ_CMD 0x2680
165#define MVNETA_RXQ_DISABLE_SHIFT 8 166#define MVNETA_RXQ_DISABLE_SHIFT 8
@@ -242,6 +243,7 @@
242#define MVNETA_VLAN_TAG_LEN 4 243#define MVNETA_VLAN_TAG_LEN 4
243 244
244#define MVNETA_CPU_D_CACHE_LINE_SIZE 32 245#define MVNETA_CPU_D_CACHE_LINE_SIZE 32
246#define MVNETA_TX_CSUM_DEF_SIZE 1600
245#define MVNETA_TX_CSUM_MAX_SIZE 9800 247#define MVNETA_TX_CSUM_MAX_SIZE 9800
246#define MVNETA_ACC_MODE_EXT 1 248#define MVNETA_ACC_MODE_EXT 1
247 249
@@ -1579,12 +1581,16 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
1579 } 1581 }
1580 1582
1581 skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size); 1583 skb = build_skb(data, pp->frag_size > PAGE_SIZE ? 0 : pp->frag_size);
1582 if (!skb)
1583 goto err_drop_frame;
1584 1584
1585 /* After refill old buffer has to be unmapped regardless
1586 * the skb is successfully built or not.
1587 */
1585 dma_unmap_single(dev->dev.parent, phys_addr, 1588 dma_unmap_single(dev->dev.parent, phys_addr,
1586 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); 1589 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
1587 1590
1591 if (!skb)
1592 goto err_drop_frame;
1593
1588 rcvd_pkts++; 1594 rcvd_pkts++;
1589 rcvd_bytes += rx_bytes; 1595 rcvd_bytes += rx_bytes;
1590 1596
@@ -3191,6 +3197,7 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
3191 } 3197 }
3192 3198
3193 mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable); 3199 mvreg_write(pp, MVNETA_BASE_ADDR_ENABLE, win_enable);
3200 mvreg_write(pp, MVNETA_ACCESS_PROTECT_ENABLE, win_protect);
3194} 3201}
3195 3202
3196/* Power up the port */ 3203/* Power up the port */
@@ -3250,6 +3257,7 @@ static int mvneta_probe(struct platform_device *pdev)
3250 char hw_mac_addr[ETH_ALEN]; 3257 char hw_mac_addr[ETH_ALEN];
3251 const char *mac_from; 3258 const char *mac_from;
3252 const char *managed; 3259 const char *managed;
3260 int tx_csum_limit;
3253 int phy_mode; 3261 int phy_mode;
3254 int err; 3262 int err;
3255 int cpu; 3263 int cpu;
@@ -3350,8 +3358,21 @@ static int mvneta_probe(struct platform_device *pdev)
3350 } 3358 }
3351 } 3359 }
3352 3360
3353 if (of_device_is_compatible(dn, "marvell,armada-370-neta")) 3361 if (!of_property_read_u32(dn, "tx-csum-limit", &tx_csum_limit)) {
3354 pp->tx_csum_limit = 1600; 3362 if (tx_csum_limit < 0 ||
3363 tx_csum_limit > MVNETA_TX_CSUM_MAX_SIZE) {
3364 tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
3365 dev_info(&pdev->dev,
3366 "Wrong TX csum limit in DT, set to %dB\n",
3367 MVNETA_TX_CSUM_DEF_SIZE);
3368 }
3369 } else if (of_device_is_compatible(dn, "marvell,armada-370-neta")) {
3370 tx_csum_limit = MVNETA_TX_CSUM_DEF_SIZE;
3371 } else {
3372 tx_csum_limit = MVNETA_TX_CSUM_MAX_SIZE;
3373 }
3374
3375 pp->tx_csum_limit = tx_csum_limit;
3355 3376
3356 pp->tx_ring_size = MVNETA_MAX_TXD; 3377 pp->tx_ring_size = MVNETA_MAX_TXD;
3357 pp->rx_ring_size = MVNETA_MAX_RXD; 3378 pp->rx_ring_size = MVNETA_MAX_RXD;