Received: by 10.223.176.46 with SMTP id f43csp2277602wra; Thu, 25 Jan 2018 07:32:01 -0800 (PST) X-Google-Smtp-Source: AH8x22439VUQkfdKoUSzdukoXICsRiKeUZs+/kwLkBWqH8DpqQqngmZoqpBHhTdhbEPwrvUuhOGU X-Received: by 10.98.71.74 with SMTP id u71mr16617901pfa.45.1516894321720; Thu, 25 Jan 2018 07:32:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516894321; cv=none; d=google.com; s=arc-20160816; b=ev1RSYixNtG8wlhqGABXpNc85JFf9OnvaSWtv+bCHZAa18X2pXPfDaZHFIFYd6Sgfc PK1kk/7gFfPeGE/pOjBXTLR+vctwHoccmVu9dYJiU1uMpx9VmBBO1NNGovmXiXwCMb/8 5R0z3WcjVMQ5ypDvXqeJBiZ2DW54DlmsGOIJ86GXAvwpQy21ZsGwBlMwJ+mX0f1DgM0D jHLwnLpT0Gj842CbyR7YPlPzE7HI62tM1mronliFJ+HvvT8MGNcPTt94O+f1kJ4AGrbb fhrZjwnUrlnmxnUM2l4mePNqBTNJR/42S92arrAriQVXeK+29uppKdIISBk3z9pxCxlf eOLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=TlsRjfcNO+lG9PFJ9A6w/HtdfwX/Jg1Ic90d/PhgIFQ=; b=hPs3VZpxlm/CNuoLrv4m1x0mv0FrxmfHN+w1ecdR7pHQlOSfTePqgpxzgDGbpwOy5T JXsYLGJy+BtiaV5KTNu32QdfBeMmvubmp0aH+v4wEi6AbGdWbrM3RKR7+oPx2If2Fb7R j29oNXeV6PJEEmrU4I6+ruStsuNSTajByLlRjaj73UrZcWr/urr4zvRgU4seHqVOoXGq 7KG35GOtTeQKqAFonFhJLCCF/D9DRGgz+tCrMGmgyllZhqng8als0l/kUOs4pH/b5X1h 1BbVibYaVMgvSp0Qe1iYp0qVme+gf88BqiP++TV3KP7ED7kh5xj1MBLtcy1Frc3pUFoL VweQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si2134268plk.271.2018.01.25.07.31.47; Thu, 25 Jan 2018 07:32:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751867AbeAYOhh (ORCPT + 99 others); Thu, 25 Jan 2018 09:37:37 -0500 Received: from mail.ltec.ch ([95.143.48.181]:53804 "EHLO mail.ltec.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751187AbeAYOhg (ORCPT ); Thu, 25 Jan 2018 09:37:36 -0500 Received: from nebula.ltec ([172.27.11.2] helo=[172.27.11.32]) by mail.ltec.ch with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1eeiej-0003Nk-DR; Thu, 25 Jan 2018 15:37:33 +0100 Subject: Re: nvmem: add driver for Microchip 24AA025E48 I2C eeprom / nodeID chip To: Bartosz Golaszewski Cc: Andy Shevchenko , Srinivas Kandagatla , Linux Kernel Mailing List References: <017877bf-5848-53c4-1f72-d630b3acaed4@ltec.ch> From: Felix Brack Message-ID: Date: Thu, 25 Jan 2018 15:37:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.01.2018 17:02, Bartosz Golaszewski wrote: > 2018-01-24 16:18 GMT+01:00 Felix Brack : >> >> On 24.01.2018 16:08, Andy Shevchenko wrote: >>> On Wed, Jan 24, 2018 at 4:23 PM, Felix Brack wrote: >>>> Hello, >>>> >>>> About three years ago I wrote a driver for Microchip's 24AA025E48 I2C >>>> eeprom/nodeID chip. At that time I placed the source files in >>>> drivers/misc/eeprom. I never posted the code. >>>> I now plan to rewrite the driver from scratch. Is it correct to place >>>> the source code in drivers/nvmem and is there a special mailing list to >>>> which the patch should be posted when ready? >>>> >>>> many thanks and kind regards, Felix >>> >>> Does the existing driver [1] work for you (if you add ID there)? >>> >>> [1]: at24 >>> >> Yes it does. Actually the driver I wrote 3 years ago is based on the >> at24 driver. Lot's of code in my driver originates directly from the >> at24 driver. >> >> -- >> regards Felix > > Just from looking at the doc - it seems that it's a variant of > 24mac402. You should be able to access the memory block by > instantiating an 'atmel,24c02' device. As for the EUI-48 block - > current at24 driver will not work as the MAC is located at a different > offset in this chip. We need to figure out a portable way to specify > the addresses of such special blocks (same with the serial number) in > the at24 driver. > > Anyways - don't write your own driver for that, just make sure at24 works. > If no one offends against blowing up this driver by some more code, then that's fine with me. What about a patch that does the following: 1. Extend the DT bindings by a new optional property block_offset denoting where to start reading/writing from/to this device. 2. Add a member block_offset to struct at24_platform_data{} to store the device read/write offset returned from the DT (similar to the already existing page_size member). 3. Complement at24_get_pdata() to read block_offset from the DT and store it. 4. Make at24_eeprom_write_i2c() and at24_eeprom_read_serial() (and eventually more?) respect the block_offset value. Initializing the new block_offset member of struct at24_platform_data{} to 0 should leave the code semantically unchanged. Once this patch is in place I could use the 24mac402 device type with block_offset set to 0xfa (and read-only set to true) to read the EUI-48 node address from Microchip's 24AA025E48. Probably the later addition of a device named 24eui48 would also make sense (if not redundant ?). Any comments are very appreciated, Felix