mmc: host: sh_mobile_sdhi: move card_busy from tmio to sdhi
[linux/fpc-iii.git] / drivers / net / wireless / broadcom / b43 / phy_ac.c
blob52f8abad8831d2dfcbf903d1f7b1bd87da40f5b7
1 /*
2 * Broadcom B43 wireless driver
3 * IEEE 802.11ac AC-PHY support
5 * Copyright (c) 2015 Rafał Miłecki <zajec5@gmail.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include "b43.h"
14 #include "phy_ac.h"
16 /**************************************************
17 * Basic PHY ops
18 **************************************************/
20 static int b43_phy_ac_op_allocate(struct b43_wldev *dev)
22 struct b43_phy_ac *phy_ac;
24 phy_ac = kzalloc(sizeof(*phy_ac), GFP_KERNEL);
25 if (!phy_ac)
26 return -ENOMEM;
27 dev->phy.ac = phy_ac;
29 return 0;
32 static void b43_phy_ac_op_free(struct b43_wldev *dev)
34 struct b43_phy *phy = &dev->phy;
35 struct b43_phy_ac *phy_ac = phy->ac;
37 kfree(phy_ac);
38 phy->ac = NULL;
41 static void b43_phy_ac_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
42 u16 set)
44 b43_write16f(dev, B43_MMIO_PHY_CONTROL, reg);
45 b43_write16(dev, B43_MMIO_PHY_DATA,
46 (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set);
49 static u16 b43_phy_ac_op_radio_read(struct b43_wldev *dev, u16 reg)
51 b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg);
52 return b43_read16(dev, B43_MMIO_RADIO24_DATA);
55 static void b43_phy_ac_op_radio_write(struct b43_wldev *dev, u16 reg,
56 u16 value)
58 b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg);
59 b43_write16(dev, B43_MMIO_RADIO24_DATA, value);
62 static unsigned int b43_phy_ac_op_get_default_chan(struct b43_wldev *dev)
64 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
65 return 11;
66 return 36;
69 static enum b43_txpwr_result
70 b43_phy_ac_op_recalc_txpower(struct b43_wldev *dev, bool ignore_tssi)
72 return B43_TXPWR_RES_DONE;
75 static void b43_phy_ac_op_adjust_txpower(struct b43_wldev *dev)
79 /**************************************************
80 * PHY ops struct
81 **************************************************/
83 const struct b43_phy_operations b43_phyops_ac = {
84 .allocate = b43_phy_ac_op_allocate,
85 .free = b43_phy_ac_op_free,
86 .phy_maskset = b43_phy_ac_op_maskset,
87 .radio_read = b43_phy_ac_op_radio_read,
88 .radio_write = b43_phy_ac_op_radio_write,
89 .get_default_chan = b43_phy_ac_op_get_default_chan,
90 .recalc_txpower = b43_phy_ac_op_recalc_txpower,
91 .adjust_txpower = b43_phy_ac_op_adjust_txpower,