From: Lorenzo Bianconi Date: Mon, 29 Oct 2018 00:37:00 +0000 (+0100) Subject: mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration X-Git-Tag: v5.4-rc1~1957^2~19^2~45^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24702cdb5f49c4e09dd89cfc248ae4e43275b2bd;p=platform%2Fkernel%2Flinux-rpi.git mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration Use mt76x02_mac_wcid_setup utility routine for wcid init configuration and remove duplicated code. This patch fixes a mt76x0 AP issue since hw key table selection was set to pairwise by default Fixes: dbad2adcb2c7 ("mt76x0: pci: enable AP support") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index 23ff299..55db5a15 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c @@ -157,42 +157,6 @@ static void mt76x0_init_mac_registers(struct mt76x02_dev *dev) mt76_rmw(dev, MT_WMM_CTRL, 0x3ff, 0x201); } -static int mt76x0_init_wcid_mem(struct mt76x02_dev *dev) -{ - u32 *vals; - int i; - - vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL); - if (!vals) - return -ENOMEM; - - for (i = 0; i < MT76_N_WCIDS; i++) { - vals[i * 2] = 0xffffffff; - vals[i * 2 + 1] = 0x00ffffff; - } - - mt76_wr_copy(dev, MT_WCID_ADDR_BASE, vals, MT76_N_WCIDS * 2); - kfree(vals); - return 0; -} - -static int mt76x0_init_wcid_attr_mem(struct mt76x02_dev *dev) -{ - u32 *vals; - int i; - - vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL); - if (!vals) - return -ENOMEM; - - for (i = 0; i < MT76_N_WCIDS * 2; i++) - vals[i] = 1; - - mt76_wr_copy(dev, MT_WCID_ATTR_BASE, vals, MT76_N_WCIDS * 2); - kfree(vals); - return 0; -} - static void mt76x0_reset_counters(struct mt76x02_dev *dev) { mt76_rr(dev, MT_RX_STAT_0); @@ -278,17 +242,12 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev) dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG); - ret = mt76x0_init_wcid_mem(dev); - if (ret) - return ret; - for (i = 0; i < 16; i++) for (k = 0; k < 4; k++) mt76x02_mac_shared_key_setup(dev, i, k, NULL); - ret = mt76x0_init_wcid_attr_mem(dev); - if (ret) - return ret; + for (i = 0; i < 256; i++) + mt76x02_mac_wcid_setup(dev, i, 0, NULL); mt76x0_reset_counters(dev);