b43: LCN-PHY: add R/W ops for PHY and radio
authorRafał Miłecki <zajec5@gmail.com>
Sun, 28 Aug 2011 12:28:43 +0000 (14:28 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 13 Sep 2011 19:42:29 +0000 (15:42 -0400)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_lcn.c

index 4b2cd6d24ce9573696057f36fbb6a09af23b8c54..cf75d3dce88d9f53f811301382556443594615a0 100644 (file)
@@ -232,6 +232,46 @@ static void b43_phy_lcn_op_adjust_txpower(struct b43_wldev *dev)
 {
 }
 
+/**************************************************
+ * R/W ops.
+ **************************************************/
+
+static u16 b43_phy_lcn_op_read(struct b43_wldev *dev, u16 reg)
+{
+       b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
+       return b43_read16(dev, B43_MMIO_PHY_DATA);
+}
+
+static void b43_phy_lcn_op_write(struct b43_wldev *dev, u16 reg, u16 value)
+{
+       b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
+       b43_write16(dev, B43_MMIO_PHY_DATA, value);
+}
+
+static void b43_phy_lcn_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
+                                  u16 set)
+{
+       b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
+       b43_write16(dev, B43_MMIO_PHY_DATA,
+                   (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set);
+}
+
+static u16 b43_phy_lcn_op_radio_read(struct b43_wldev *dev, u16 reg)
+{
+       /* LCN-PHY needs 0x200 for read access */
+       reg |= 0x200;
+
+       b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg);
+       return b43_read16(dev, B43_MMIO_RADIO24_DATA);
+}
+
+static void b43_phy_lcn_op_radio_write(struct b43_wldev *dev, u16 reg,
+                                      u16 value)
+{
+       b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg);
+       b43_write16(dev, B43_MMIO_RADIO24_DATA, value);
+}
+
 /**************************************************
  * PHY ops struct.
  **************************************************/
@@ -241,13 +281,11 @@ const struct b43_phy_operations b43_phyops_lcn = {
        .free                   = b43_phy_lcn_op_free,
        .prepare_structs        = b43_phy_lcn_op_prepare_structs,
        .init                   = b43_phy_lcn_op_init,
-       /*
        .phy_read               = b43_phy_lcn_op_read,
        .phy_write              = b43_phy_lcn_op_write,
        .phy_maskset            = b43_phy_lcn_op_maskset,
        .radio_read             = b43_phy_lcn_op_radio_read,
        .radio_write            = b43_phy_lcn_op_radio_write,
-       */
        .software_rfkill        = b43_phy_lcn_op_software_rfkill,
        .switch_analog          = b43_phy_lcn_op_switch_analog,
        /*