There are several magic numbers that refer to locations in the CSR page.
They can be replaced.
Signed-off-by: Larry Finger <[email protected]>
---
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -650,7 +650,7 @@ static int rtl8187_init_hw(struct ieee80
rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
- rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
+ rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);
reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
reg &= 0x3F;
reg |= 0x80;
@@ -882,7 +882,7 @@ static void rtl8187_work(struct work_str
u16 tmp;
mutex_lock(&priv->conf_mutex);
- tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
+ tmp = rtl818x_ioread16(priv, &priv->map->TALLY_CNT);
while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
struct sk_buff *old_skb;
Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -462,7 +462,7 @@ static void rtl8225_rf_init(struct ieee8
rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */
msleep(1);
- rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+ rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x3dc00002);
/* set sensitivity */
rtl8225_write(dev, 0x0c, 0x50);
@@ -818,7 +818,7 @@ static void rtl8225z2_rf_init(struct iee
rtl8225_write_phy_cck(dev, 0x4b, 0x04);
rtl8225_write_phy_cck(dev, 0x4c, 0x05);
- rtl818x_iowrite8(priv, (u8 *)0xFF5B, 0x0D); msleep(1);
+ rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); msleep(1);
rtl8225z2_rf_set_tx_power(dev, 1);
@@ -828,7 +828,7 @@ static void rtl8225z2_rf_init(struct iee
rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */
msleep(1);
- rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+ rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x3dc00002);
}
static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)
On Sun, 2009-04-12 at 19:40 -0500, Larry Finger wrote:
> - rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
> + rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);
That looks strange -- I can tell it works because priv->map is set to
0xFF00, but wouldn't actual constants make more sense?
johannes
--- On Mon, 13/4/09, Larry Finger <[email protected]> wrote:
> There are several magic numbers that
> refer to locations in the CSR page.
> They can be replaced.
>
> Signed-off-by: Larry Finger <[email protected]>
Tested-by: Hin-Tak Leung <[email protected]>
Am running the patch ATM.
Johannes Berg wrote:
> On Sun, 2009-04-12 at 19:40 -0500, Larry Finger wrote:
>
>> - rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
>> + rtl818x_iowrite16(priv, &priv->map->FEMR, 0xFFFF);
>
> That looks strange -- I can tell it works because priv->map is set to
> 0xFF00, but wouldn't actual constants make more sense?
The value 0xFFF4 is the address offset of the Function Event Mask Register, not
a data value. Using a symbol emphasizes that we are referring to a register and
not a constant.
Larry