Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1604406img; Wed, 27 Feb 2019 02:12:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IYrf5PqiU39SDhlbl70W/IZ1/a2RWtQE6/XSg403Gn26sSX0TWTOhszgXRfFUftoQR27MAh X-Received: by 2002:a65:5507:: with SMTP id f7mr2208210pgr.44.1551262348180; Wed, 27 Feb 2019 02:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551262348; cv=none; d=google.com; s=arc-20160816; b=hNoU3dxsbK57EMEyLMKqfuF/rSVdXZbUpQmYZqWbt4ZlVX3haZGb0iIwLSxXW7H3m/ 4Ez8SRSYnpvlRcafr/jTZzUOJc+8wxnlh6q1OX/SGbeI4F3BBeG5k305y+bki2pXe3ZR UBJx+3T5Q+4PFRKxQU+8jLBwAecFF/kVNCXxyl8NrxnMN0QYWnU6dPGEdB7zbUHMDUdP NeRf0tju2GRh6972J6Bi9cJcWiUNb7UI+Wjv08V35eD9MKteVOviT0YrE4XU8Me0kL6s KEsrY1cf4dQGeo2BPSHBsDW+IyMGZHt0YMoQKYbqiPG1iuIBVb863WUGrClNO+HH0R2I gL9Q== 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:dkim-signature; bh=Qs2liJLGMWU770amCHkKQGol3ULiosdr5P4zmUSVilE=; b=UD0MbuQtYvSIPx+KSFgZ6ATLduM6Np1erAVOSU2389S1maWSYs9jGwLZNmvuwTE204 hJWKI2ABcVIup8jmgZmU/5OrscnymWIL2DuMC/chfe2k87bpk3/FcZL2AcsnR/k3q94h RmqTSWfbw8DBL6FWic4nfG8j3+HeSlwnGyxqohZ7hJXbUHX4lrot6cDJvGRnd6m1bvH7 5xYMWwxzvTKgLZ38GfdlEmrhk7C7xEWoICVZveWJZ+ImEvcNqqX5KkTB8oih0AoVsisG lqUq2cXb3YdPTwlbbTHOw2TMH3v2N+YGdnjVuZpDGaO0u2nkWBT3ZHVjd2di9lLj/OJ3 xsNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=x+cJFl7X; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si14163505pgd.272.2019.02.27.02.12.12; Wed, 27 Feb 2019 02:12:28 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=x+cJFl7X; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727636AbfB0KLv (ORCPT + 99 others); Wed, 27 Feb 2019 05:11:51 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:42090 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbfB0KLu (ORCPT ); Wed, 27 Feb 2019 05:11:50 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1RABV7i038275; Wed, 27 Feb 2019 04:11:31 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1551262291; bh=Qs2liJLGMWU770amCHkKQGol3ULiosdr5P4zmUSVilE=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=x+cJFl7XHAd/Q0VcdtIi6a3sonDFIYCRG0lSyNGNXD1rBuSwWoyUsKj5CBB/8cGQJ BTh8FkhIeitAPTuAYeJGGNyMW8omGiGwSOa8PnS1c2AgODdB2zMDVx1OGwMED8nf45 kHbZPsV1+ELWHypXKR+5FcUJvOyWC1ux3B5a+Ff8= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1RABVYr024897 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 27 Feb 2019 04:11:31 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 27 Feb 2019 04:11:30 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 27 Feb 2019 04:11:30 -0600 Received: from [172.24.190.89] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1RABPY8002039; Wed, 27 Feb 2019 04:11:26 -0600 Subject: Re: [RFC PATCH 3/5] mtd: Add support for Hyperbus memory devices To: Boris Brezillon CC: Sergei Shtylyov , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Rob Herring , "devicetree@vger.kernel.org" , Arnd Bergmann , "tudor.ambarus@microchip.com" , Greg Kroah-Hartman , "Nori, Sekhar" , "linux-kernel@vger.kernel.org" , "linux-mtd@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , Miquel Raynal References: <20190219063607.29949-1-vigneshr@ti.com> <20190219063607.29949-4-vigneshr@ti.com> <7e79fff7-2565-28f7-7b2b-bb3098f1a928@cogentembedded.com> <3952b327-3aff-a32e-4280-6ab24c32cfd9@ti.com> <20190227105937.527c6573@kernel.org> From: Vignesh Raghavendra Message-ID: Date: Wed, 27 Feb 2019 15:42:27 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190227105937.527c6573@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/02/19 3:29 PM, Boris Brezillon wrote: > On Wed, 27 Feb 2019 15:22:19 +0530 > Vignesh Raghavendra wrote: > >> On 26/02/19 11:46 PM, Sergei Shtylyov wrote: >>> On 02/19/2019 09:36 AM, Vignesh R (by way of Boris Brezillon ) wrote: >>> > [...] >>>> + */ >>>> + >>>> +struct hb_device { >>>> + struct map_info map; >>>> + struct device *dev; >>>> + struct device_node *np; >>>> + struct mtd_info *mtd; >>>> + struct hb_ops *ops; >>>> + enum hb_memtype memtype; >>>> + bool needs_calib; >>>> + bool registered; >>>> +}; >>>> + >>>> +/** >>>> + * struct hb_ops - struct representing custom Hyperbus operations >>>> + * @read16: read 16 bit of data, usually from register/ID-CFI space >>>> + * @write16: write 16 bit of data, usually to register/ID-CFI space >>>> + * copy_from: copy data from flash memory >>>> + * copy_to: copy data to flash_memory >>>> + */ >>>> + >>>> +struct hb_ops { >>>> + u16 (*read16)(struct hb_device *hbdev, unsigned long addr); >>>> + void (*write16)(struct hb_device *hbdev, unsigned long addr, u16 val); >>>> + >>>> + void (*copy_from)(struct hb_device *hbdev, void *to, >>>> + unsigned long from, ssize_t len); >>>> + void (*copy_to)(struct hb_device *dev, unsigned long to, >>>> + const void *from, ssize_t len); >>> >>> ... else these methods won't fly if you need to "massage" the controller >>> registers inside them... >>> >> >> If accessing controller register is the only need, wouldn't a private >> data pointer within struct hb_device be sufficient to hold pointer to >> controller specific struct? >> >> struct hb_device { >> ... >> void *priv; /* points to controller's private data */ >> }; >> >> >> Or do you see a need for separate structure for the HyperBus controller? > > Sorry to chime in. Just want to share my experience here: properly > splitting the controller/device representation is always a good thing. > When it's not done from the beginning and people start to add their own > controller drivers as if it was a flash device driver it becomes messy > pretty quickly and people add hacks to support that (look at the raw > NAND framework if you need a proof). So, I'd recommend having this > separation now, even if the onle controllers we support have a 1:1 > relationship between HB controller and HB device. > >> Alright, will separate controller and slave representation. Thanks for the feedback! -- Regards Vignesh