From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbdB0Uoh (ORCPT ); Mon, 27 Feb 2017 15:44:37 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34722 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbdB0Uoe (ORCPT ); Mon, 27 Feb 2017 15:44:34 -0500 Subject: Re: [RFC 0/3] drivers: Add an API to read device specific config data To: Alban , linux-kernel@vger.kernel.org References: <1488227292-18906-1-git-send-email-albeu@free.fr> Cc: linux-mtd@lists.infradead.org, Cyrille Pitchen , Richard Weinberger , Boris Brezillon , Brian Norris , David Woodhouse , Greg Kroah-Hartman From: Marek Vasut Message-ID: <56dbc1bb-236f-09ff-dae9-f4afea1298e7@gmail.com> Date: Mon, 27 Feb 2017 21:42:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <1488227292-18906-1-git-send-email-albeu@free.fr> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/27/2017 09:28 PM, Alban wrote: > Hi all, > > while looking at adding OF support for the ath9k driver I had the problem of > reading the EEPROM data. On the SoC platforms this data is stored in an SPI > flash along with a few other things. In OpenWRT/LEDE this data is read from > the board init code using the fact that the flash is (normaly) readable from > a memory map. A bit too hackish for my taste. > > This is just one example, there is various other similar cases, mostly with > MAC addresses. I thought it would be nicer if we had a clean API for this, > similar to the firmware API but per device instance instead of beeing per > driver. The device driver wouldn't have to care where the data is stored, > they just request it and the backend take care of reading the EEPROM, MTD > or whatever is used on the board. Can't we use the NVMEM for this stuff ? > This series implement such an API along with an implementation for MTD > devices and a use in the ath9k driver. As this is an RFC I didn't yet > write the OF binding documentation, that will come later if the feedback > is positive. > > Alban Bedel (3): > drivers: Add an API to read device specific config data > mtd: Add support for reading device data out of MTD devices > ath9k: ahb: Add OF support > > drivers/base/Kconfig | 6 + > drivers/base/Makefile | 1 + > drivers/base/devdata.c | 204 +++++++++++++++++++++++++++++++++ > drivers/mtd/Kconfig | 9 ++ > drivers/mtd/Makefile | 1 + > drivers/mtd/devdata.c | 70 +++++++++++ > drivers/net/wireless/ath/ath9k/Kconfig | 1 + > drivers/net/wireless/ath/ath9k/ahb.c | 55 +++++++-- > drivers/net/wireless/ath/ath9k/init.c | 41 ++++++- > include/linux/devdata.h | 79 +++++++++++++ > 10 files changed, 459 insertions(+), 8 deletions(-) > create mode 100644 drivers/base/devdata.c > create mode 100644 drivers/mtd/devdata.c > create mode 100644 include/linux/devdata.h > -- Best regards, Marek Vasut