Lines Matching +full:eeprom +full:- +full:name

1 // SPDX-License-Identifier: ISC
3 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
9 #include <linux/nvmem-consumer.h>
15 struct device_node *np = dev->dev->of_node; in mt76_get_of_eeprom_data()
19 data = of_get_property(np, "mediatek,eeprom-data", &size); in mt76_get_of_eeprom_data()
21 return -ENOENT; in mt76_get_of_eeprom_data()
24 return -EINVAL; in mt76_get_of_eeprom_data()
34 struct device_node *np = dev->dev->of_node; in mt76_get_of_data_from_mtd()
43 list = of_get_property(np, "mediatek,mtd-eeprom", &size); in mt76_get_of_data_from_mtd()
45 return -ENOENT; in mt76_get_of_data_from_mtd()
49 return -ENOENT; in mt76_get_of_data_from_mtd()
53 return -EINVAL; in mt76_get_of_data_from_mtd()
57 part = np->name; in mt76_get_of_data_from_mtd()
66 ret = -EINVAL; in mt76_get_of_data_from_mtd()
76 dev_err(dev->dev, "reading EEPROM from mtd %s failed: %i\n", in mt76_get_of_data_from_mtd()
82 ret = -EINVAL; in mt76_get_of_data_from_mtd()
86 if (of_property_read_bool(dev->dev->of_node, "big-endian")) { in mt76_get_of_data_from_mtd()
90 /* convert eeprom data in Little Endian */ in mt76_get_of_data_from_mtd()
97 dev->test_mtd.name = devm_kstrdup(dev->dev, part, GFP_KERNEL); in mt76_get_of_data_from_mtd()
98 dev->test_mtd.offset = offset; in mt76_get_of_data_from_mtd()
105 return -ENOENT; in mt76_get_of_data_from_mtd()
113 struct device_node *np = dev->dev->of_node; in mt76_get_of_data_from_nvmem()
130 ret = -EINVAL; in mt76_get_of_data_from_nvmem()
145 struct device_node *np = dev->dev->of_node; in mt76_get_of_eeprom()
149 return -ENOENT; in mt76_get_of_eeprom()
159 return mt76_get_of_data_from_nvmem(dev, eep, "eeprom", len); in mt76_get_of_eeprom()
165 struct mt76_dev *dev = phy->dev; in mt76_eeprom_override()
166 struct device_node *np = dev->dev->of_node; in mt76_eeprom_override()
168 of_get_mac_address(np, phy->macaddr); in mt76_eeprom_override()
170 if (!is_valid_ether_addr(phy->macaddr)) { in mt76_eeprom_override()
171 eth_random_addr(phy->macaddr); in mt76_eeprom_override()
172 dev_info(dev->dev, in mt76_eeprom_override()
174 phy->macaddr); in mt76_eeprom_override()
196 struct device_node *np = dev->dev->of_node; in mt76_find_power_limits_node()
206 if (dev->region < ARRAY_SIZE(region_names)) in mt76_find_power_limits_node()
207 region_name = region_names[dev->region]; in mt76_find_power_limits_node()
209 np = of_get_child_by_name(np, "power-limits"); in mt76_find_power_limits_node()
222 if (mt76_string_prop_find(country, dev->alpha2) || in mt76_find_power_limits_node()
235 mt76_get_of_array(struct device_node *np, char *name, size_t *len, int min) in mt76_get_of_array() argument
237 struct property *prop = of_find_property(np, name, NULL); in mt76_get_of_array()
239 if (!prop || !prop->value || prop->length < min * 4) in mt76_get_of_array()
242 *len = prop->length; in mt76_get_of_array()
244 return prop->value; in mt76_get_of_array()
260 if (chan->hw_value >= be32_to_cpu(val[0]) && in mt76_find_channel_node()
261 chan->hw_value <= be32_to_cpu(val[1])) in mt76_find_channel_node()
265 len -= 2 * sizeof(*val); in mt76_find_channel_node()
280 val = mt76_get_of_array(np, "txs-delta", &len, nss); in mt76_get_txs_delta()
284 return be32_to_cpu(val[nss - 1]); in mt76_get_txs_delta()
321 if (--cur > 0) in mt76_apply_multi_array_limit()
325 len -= pwr_len + 1; in mt76_apply_multi_array_limit()
338 struct mt76_dev *dev = phy->dev; in mt76_get_rate_power_limits()
341 char name[16]; in mt76_get_rate_power_limits() local
342 u32 mcs_rates = dev->drv->mcs_rates; in mt76_get_rate_power_limits()
343 u32 ru_rates = ARRAY_SIZE(dest->ru[0]); in mt76_get_rate_power_limits()
361 switch (chan->band) { in mt76_get_rate_power_limits()
375 snprintf(name, sizeof(name), "txpower-%cg", band); in mt76_get_rate_power_limits()
376 np = of_get_child_by_name(np, name); in mt76_get_rate_power_limits()
384 txs_delta = mt76_get_txs_delta(np, hweight16(phy->chainmask)); in mt76_get_rate_power_limits()
386 val = mt76_get_of_array(np, "rates-cck", &len, ARRAY_SIZE(dest->cck)); in mt76_get_rate_power_limits()
387 mt76_apply_array_limit(dest->cck, ARRAY_SIZE(dest->cck), val, in mt76_get_rate_power_limits()
390 val = mt76_get_of_array(np, "rates-ofdm", in mt76_get_rate_power_limits()
391 &len, ARRAY_SIZE(dest->ofdm)); in mt76_get_rate_power_limits()
392 mt76_apply_array_limit(dest->ofdm, ARRAY_SIZE(dest->ofdm), val, in mt76_get_rate_power_limits()
395 val = mt76_get_of_array(np, "rates-mcs", &len, mcs_rates + 1); in mt76_get_rate_power_limits()
396 mt76_apply_multi_array_limit(dest->mcs[0], ARRAY_SIZE(dest->mcs[0]), in mt76_get_rate_power_limits()
397 ARRAY_SIZE(dest->mcs), val, len, in mt76_get_rate_power_limits()
400 val = mt76_get_of_array(np, "rates-ru", &len, ru_rates + 1); in mt76_get_rate_power_limits()
401 mt76_apply_multi_array_limit(dest->ru[0], ARRAY_SIZE(dest->ru[0]), in mt76_get_rate_power_limits()
402 ARRAY_SIZE(dest->ru), val, len, in mt76_get_rate_power_limits()
412 dev->eeprom.size = len; in mt76_eeprom_init()
413 dev->eeprom.data = devm_kzalloc(dev->dev, len, GFP_KERNEL); in mt76_eeprom_init()
414 if (!dev->eeprom.data) in mt76_eeprom_init()
415 return -ENOMEM; in mt76_eeprom_init()
417 return !mt76_get_of_eeprom(dev, dev->eeprom.data, len); in mt76_eeprom_init()