Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1432942

[PATCH net-next v3 7/7] r8152: add byte_enable for ocp_read_word function

From Hayes Wang <hayeswang@realtek.com>
Newsgroups linux.kernel
Subject [PATCH net-next v3 7/7] r8152: add byte_enable for ocp_read_word function
Date 2016-06-28 14:30 +0200
Message-ID <rP0jo-6Z4-43@gated-at.bofh.it> (permalink)
References <rOwY1-4io-5@gated-at.bofh.it> <rP0jn-6Z4-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add byte_enable for ocp_read_word() to replace reading 4
bytes data with reading the desired 2 bytes data.

This is used to avoid the issue which is described in
commit b4d99def0938 ("r8152: remove sram_read"). The
original method always reads 4 bytes data, and it may
have problem when reading the PHY registers.

The new method is supported since RTL8152B, but it
doesn't influence the previous chips. The bits of the
byte_enable for the previous chips are the reserved
bits, and the hw would ignore them.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index bd74fab..e5405e6 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -946,11 +946,13 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index)
 {
 	u32 data;
 	__le32 tmp;
+	u16 byen = BYTE_EN_WORD;
 	u8 shift = index & 2;
 
 	index &= ~3;
+	byen <<= shift;
 
-	generic_ocp_read(tp, index, sizeof(tmp), &tmp, type);
+	generic_ocp_read(tp, index, sizeof(tmp), &tmp, type | byen);
 
 	data = __le32_to_cpu(tmp);
 	data >>= (shift * 8);
-- 
2.4.11

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/6] r8152: support new chips Hayes Wang <hayeswang@realtek.com> - 2016-06-27 08:10 +0200
  [PATCH net-next 3/6] r8152: add power_cut_en for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-27 08:10 +0200
  [PATCH net-next 5/6] r8152: support RTL8153B Hayes Wang <hayeswang@realtek.com> - 2016-06-27 08:10 +0200
  [PATCH net-next v2 2/6] r8152: add u1u2_enable for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v2 6/6] r8152: add byte_enable for ocp_read_word function Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v2 4/6] r8152: support the new chip 8050 Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v2 5/6] r8152: support RTL8153B Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v2 1/6] r8152: add aldps_enable for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v2 0/6] r8152: support new chips Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
    [PATCH net-next v2 3/6] r8152: add power_cut_en for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 04:50 +0200
  [PATCH net-next v3 6/7] r8152: support RTL8153B Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:30 +0200
  [PATCH net-next v3 0/7] r8152: support new chips Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:30 +0200
    [PATCH net-next v3 4/7] r8152: add u2p3_enable for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:30 +0200
    [PATCH net-next v3 7/7] r8152: add byte_enable for ocp_read_word function Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:30 +0200
    [PATCH net-next v3 3/7] r8152: add power_cut_en for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:40 +0200
    [PATCH net-next v3 2/7] r8152: add u1u2_enable for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:40 +0200
    [PATCH net-next v3 1/7] r8152: add aldps_enable for rtl_ops Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:40 +0200
    [PATCH net-next v3 5/7] r8152: support the new chip 8050 Hayes Wang <hayeswang@realtek.com> - 2016-06-28 14:40 +0200
    RE: [PATCH net-next v3 0/7] r8152: support new chips Hayes Wang <hayeswang@realtek.com> - 2016-06-29 05:40 +0200

csiph-web