Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599928

Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API

From Christian Lamparter <chunkeey@googlemail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API
Date 2017-03-14 01:00 +0100
Message-ID <tkI2C-8rP-3@gated-at.bofh.it> (permalink)
References <tkFo6-6nZ-5@gated-at.bofh.it> <tkFo7-6nZ-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Monday, March 13, 2017 10:05:11 PM CET Alban wrote:
> Currently SoC platforms use a firmware request to get the EEPROM data.
> This is mostly a hack and rely on using a user-helper scripts which is
> deprecated. A nicer alternative is to use the nvmem API which was
> designed for this kind of task.
> 
> Furthermore we let CONFIG_ATH9K_AHB select CONFIG_NVMEM as such
> devices will generally use this method for loading the EEPROM data.
> 
> Signed-off-by: Alban <albeu@free.fr>
> ---
> @@ -654,6 +656,25 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
>  	if (ret)
>  		return ret;
>  
> +	/* If the EEPROM hasn't been retrieved via firmware request
> +	 * use the nvmem API insted.
> +	 */
> +	if (!ah->eeprom_blob) {
> +		struct nvmem_cell *eeprom_cell;
> +
> +		eeprom_cell = nvmem_cell_get(ah->dev, "eeprom");
> +		if (!IS_ERR(eeprom_cell)) {
> +			ah->eeprom_data = nvmem_cell_read(
> +				eeprom_cell, &ah->eeprom_size);
> +			nvmem_cell_put(eeprom_cell);
> +
> +			if (IS_ERR(ah->eeprom_data)) {
> +				dev_err(ah->dev, "failed to read eeprom");
> +				return PTR_ERR(ah->eeprom_data);
> +			}
> +		}
> +	}
> +
>  	if (ath9k_led_active_high != -1)
>  		ah->config.led_active_high = ath9k_led_active_high == 1;
>  
Are you sure this works with AR93XX SoCs that have the calibration data
in the OTP?

I've added Chris to the CC, since he has a HiveAP 121 that has this
configuration, so he can test, whenever this is a problem or not.

But from what I can tell, devices with the calibration data in the
OTP would fail now. This is because the OTP is done by ath9k_hw_init()
which hasn't run yet (it's a bit further down the road in the same
function though). 

Note: the OTP doesn't store the whole caldata. Just a few parts.
A temporary "eeprom" gets constructed with the help of the 
ar9300_eep_templates in ar9003_eeprom.c's
ar9300_eeprom_restore_internal(). But from what I don't think, 
that the eeprom_blob is constructed/set by the functions in
ar9003_eeprom.

I think this will require an additional property like
qca,calibration-in-otp. What's your opinion?

Thanks,
Christian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/7] Documentation: dt: net: Update the ath9k binding for SoC devices Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
  [PATCH 5/7] ath9k: of: Use the clk API to get the reference clock rate Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 5/7] ath9k: of: Use the clk API to get the reference clock  rate Rafał Miłecki <zajec5@gmail.com> - 2017-03-13 23:20 +0100
  [PATCH 2/7] ath9k: ahb: Add OF support Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 2/7] ath9k: ahb: Add OF support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-03-14 12:20 +0100
  [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
    Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using  the nvmem API Rafał Miłecki <zajec5@gmail.com> - 2017-03-13 23:20 +0100
    Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Christian Lamparter <chunkeey@googlemail.com> - 2017-03-14 01:00 +0100
      Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data  using the nvmem API Alban <albeu@free.fr> - 2017-03-23 15:50 +0100
        Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API Christian Lamparter <chunkeey@googlemail.com> - 2017-03-24 17:30 +0100
  [PATCH 4/7] ath9k: Add support for reading the MAC address with nvmem Alban <albeu@free.fr> - 2017-03-13 22:10 +0100
  Re: [PATCH 1/7] Documentation: dt: net: Update the ath9k binding for  SoC devices Rob Herring <robh@kernel.org> - 2017-03-20 23:10 +0100
  Re: [PATCH 1/7] Documentation: dt: net: Update the ath9k binding for SoC devices Christian Lamparter <chunkeey@googlemail.com> - 2017-03-27 18:20 +0200

csiph-web