aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/renesas/ravb_main.c
diff options
context:
space:
mode:
authorKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>2018-09-18 06:22:26 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-18 23:09:57 -0400
commit2fe397a3959de8a472f165e6d152f64cb77fa2cc (patch)
tree3e8953c631443845a823646b5a38257ee8b48d87 /drivers/net/ethernet/renesas/ravb_main.c
parent65fac4fe9080714df80d430888834ce87c6716ba (diff)
ravb: do not write 1 to reserved bits
EtherAVB hardware requires 0 to be written to status register bits in order to clear them, however, care must be taken not to: 1. Clear other bits, by writing zero to them 2. Write one to reserved bits This patch corrects the ravb driver with respect to the second point above. This is done by defining reserved bit masks for the affected registers and, after auditing the code, ensure all sites that may write a one to a reserved bit use are suitably masked. Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas/ravb_main.c')
-rw-r--r--drivers/net/ethernet/renesas/ravb_main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index aff5516b781e..d6f753925352 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -739,10 +739,11 @@ static void ravb_error_interrupt(struct net_device *ndev)
739 u32 eis, ris2; 739 u32 eis, ris2;
740 740
741 eis = ravb_read(ndev, EIS); 741 eis = ravb_read(ndev, EIS);
742 ravb_write(ndev, ~EIS_QFS, EIS); 742 ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
743 if (eis & EIS_QFS) { 743 if (eis & EIS_QFS) {
744 ris2 = ravb_read(ndev, RIS2); 744 ris2 = ravb_read(ndev, RIS2);
745 ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF), RIS2); 745 ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
746 RIS2);
746 747
747 /* Receive Descriptor Empty int */ 748 /* Receive Descriptor Empty int */
748 if (ris2 & RIS2_QFF0) 749 if (ris2 & RIS2_QFF0)
@@ -795,7 +796,7 @@ static bool ravb_timestamp_interrupt(struct net_device *ndev)
795 u32 tis = ravb_read(ndev, TIS); 796 u32 tis = ravb_read(ndev, TIS);
796 797
797 if (tis & TIS_TFUF) { 798 if (tis & TIS_TFUF) {
798 ravb_write(ndev, ~TIS_TFUF, TIS); 799 ravb_write(ndev, ~(TIS_TFUF | TIS_RESERVED), TIS);
799 ravb_get_tx_tstamp(ndev); 800 ravb_get_tx_tstamp(ndev);
800 return true; 801 return true;
801 } 802 }
@@ -930,7 +931,7 @@ static int ravb_poll(struct napi_struct *napi, int budget)
930 /* Processing RX Descriptor Ring */ 931 /* Processing RX Descriptor Ring */
931 if (ris0 & mask) { 932 if (ris0 & mask) {
932 /* Clear RX interrupt */ 933 /* Clear RX interrupt */
933 ravb_write(ndev, ~mask, RIS0); 934 ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
934 if (ravb_rx(ndev, &quota, q)) 935 if (ravb_rx(ndev, &quota, q))
935 goto out; 936 goto out;
936 } 937 }
@@ -938,7 +939,7 @@ static int ravb_poll(struct napi_struct *napi, int budget)
938 if (tis & mask) { 939 if (tis & mask) {
939 spin_lock_irqsave(&priv->lock, flags); 940 spin_lock_irqsave(&priv->lock, flags);
940 /* Clear TX interrupt */ 941 /* Clear TX interrupt */
941 ravb_write(ndev, ~mask, TIS); 942 ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
942 ravb_tx_free(ndev, q, true); 943 ravb_tx_free(ndev, q, true);
943 netif_wake_subqueue(ndev, q); 944 netif_wake_subqueue(ndev, q);
944 mmiowb(); 945 mmiowb();