All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabor Juhos <juhosg@openwrt.org>
To: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	Daniel Golle <dgolle@allnet.de>,
	linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [rt2x00-users] [PATCH 2/2] rt2x00: rt2800pci: allow to load EEPROM data via firmware API
Date: Wed, 19 Dec 2012 10:35:22 +0100	[thread overview]
Message-ID: <50D18A5A.2020505@openwrt.org> (raw)
In-Reply-To: <20121218222226.GB4825@localhost.localdomain>

2012.12.18. 23:22 keltezéssel, Stanislaw Gruszka írta:
> On Tue, Dec 18, 2012 at 05:22:23PM +0100, Gabor Juhos wrote:
>> Currently the driver fetches the EEPROM data
>> from a fixed memory location for SoC devices
>> for SoC devices with a built-in wireless MAC.
>>
>> The usability of this approach is quite
>> limited, because it is only suitable if the
>> location of the EEPROM data is mapped into
>> the memory. This condition is true on embedded
>> boards equipped which are using a parallel NOR
>> flash, but it is not true for boards equipped
>> with SPI or NAND flashes. The fixed location
>> also does not work in all cases, because the
>> offset of the EEPROM data varies between
>> different boards.
>>
>> Additionally, various embedded boards are using
>> a PCI/PCIe chip soldered directly onto the PCB.
>> Such boards usually does not have a separate
>> EEPROM chip for the PCI/PCIe devices, the data
>> of the EEPROM is stored in the main flash
>> instead.
>>
>> The patch makes it possible to load the EEPROM
>> data via firmware API. This new method works
>> regardless of the type of the flash, and it is
>> usable with built-in and with PCI/PCIe devices.
>>
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> 
> I understand this patch will not broke NOR boards, which use
> ioremap approach currently?

The change will break those obviously, so those boards must be converted to use
the new method. I have added sanity check into the 'rt2800soc_probe' function
which ensures that the users of such boards will be informed about that. FWIW,
that approach is used by out-of-tree boards only.

>> +	init_completion(&ec.complete);
>> +	retval = request_firmware_nowait(THIS_MODULE, 1, name,
>> +					 rt2x00dev->dev, GFP_KERNEL, &ec,
>> +					 rt2800pci_eeprom_request_cb);
>> +	if (retval < 0) {
>> +		ERROR(rt2x00dev, "EEPROM request failed\n");
>> +		return retval;
>> +	}
>> +
>> +	wait_for_completion(&ec.complete);
> Since we use completion here, why we can not just use normal synchronous
> version of request_firmware? I heard of request_firmware drawbacks, so
> this approach can be correct. Just want to know if we do not complicate
> things not necessarily here.

If the driver is built into the kernel, then the synchronous version would fail
because user-space is not up during probe time.

The initial version of the patch used the synchronous version, but Gertjan had
concerns about that:

http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2012-December/005526.html

>> +		goto release_eeprom;
>> +	}
>> +
>> +	memcpy(rt2x00dev->eeprom, ec.blob->data, EEPROM_SIZE);
>> +	retval = 0;
>> +
>> +release_eeprom:
> We do not free memory - I guess we should do relase_firmware(ec.blob)?

Yes. I'm sure that I have added that call once, but it seems lost in the rebase
process. Will send and updated version.

Thank you for the comments!

-Gabor

  reply	other threads:[~2012-12-19  9:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 16:22 [PATCH 1/2] rt2x00: rt2800pci: verify ioremap return value Gabor Juhos
2012-12-18 16:22 ` [PATCH 2/2] rt2x00: rt2800pci: allow to load EEPROM data via firmware API Gabor Juhos
2012-12-18 22:22   ` [rt2x00-users] " Stanislaw Gruszka
2012-12-19  9:35     ` Gabor Juhos [this message]
2012-12-20  8:58       ` Kalle Valo
2012-12-20 11:06         ` Stanislaw Gruszka
2012-12-20 14:34           ` Gabor Juhos
2012-12-18 21:57 ` [rt2x00-users] [PATCH 1/2] rt2x00: rt2800pci: verify ioremap return value Stanislaw Gruszka
2012-12-19  9:34   ` Gabor Juhos
2012-12-18 23:58 ` Julian Calaby
2012-12-19  9:35   ` Gabor Juhos
2012-12-19 11:05 ` Jones Desougi
2012-12-19 11:59   ` Gabor Juhos
2013-01-07 20:02     ` John W. Linville
2013-01-07 20:37       ` Gabor Juhos
2013-01-07 21:08         ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50D18A5A.2020505@openwrt.org \
    --to=juhosg@openwrt.org \
    --cc=dgolle@allnet.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=stf_xl@wp.pl \
    --cc=users@rt2x00.serialmonkey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.