Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp157448pja; Fri, 22 Nov 2019 04:49:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxjbNBb6vPdhOnBbXhEc4oEjQAm/TTrp0LJMDaQv3XpC4hupgJgg0VP8b9N4PLhgNEXWIi4 X-Received: by 2002:aa7:c0c8:: with SMTP id j8mr847967edp.235.1574426992819; Fri, 22 Nov 2019 04:49:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574426992; cv=none; d=google.com; s=arc-20160816; b=KER8xQzvro8cGo5qla6sH7BWmALFQP4DT1OW9VpEh6WRTK1KQzKZmZ0oFIgXmgf/Ge qmWIUH8LHFV4UiNSmbGxpwVQMlDFULHGp0419keHOeUiFt0Fz3eCtT1Gg/IZQ/vPukCL 4SV0K7SEdsuOM0OcRzn+/i5V6YnuZSwGvH8p+JPlQ6uA88rZmxm1jzQV26PB11jT5C2a hHhNfI+jU+SZTulAa+7AZv/fjY3KLKsxDnqDyN3cvALFKMxbtWSYDGtmlQE+v+BmsaPo lQoYERuzzsea1vS2O0irJxY7+06qZCRrH9zYhP/9ijV+S8S/NLAQAd7MaqHmef6TOmEs iM3g== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=u5HN2aZVdj7m+hEI/tOay7oYBKK4V1c4Qj4MJYDq/G8=; b=B7ksZyQPjIXu8g5CCF54UJci9RngRnozsjnFzJr2OxNW4tznT7Jc8l6lO3eZtjB1Vb qROAJ5uKV/uoD6M3SM/+sR+NqzU1F/myZv21BrXVrHficJSvK4oin6z3dhq3Gbg9e7J/ 7zGnKowOKoen3T2c3568t/NFln+dAnKf92/DPaHjmuBax0HT2VHutOYIdR23IbHAeX0S QG5izzdK6LTgjjGJShKCz3LV0NZYM03GzZhysrhZQnpYJQY02POIQrXu0hbSMmNnTqTx 0ndAA4S01PLAjHEBUZuwXLCXktcw6gyX02vfZD7uXZMdoxhjMMHqtqU2xAd7o1iK8Wmb xaGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=y43nUX9f; 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 s13si4116249ejx.144.2019.11.22.04.49.27; Fri, 22 Nov 2019 04:49:52 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=y43nUX9f; 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 S1727612AbfKVMrR (ORCPT + 99 others); Fri, 22 Nov 2019 07:47:17 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:40344 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727193AbfKVMrR (ORCPT ); Fri, 22 Nov 2019 07:47:17 -0500 Received: by mail-oi1-f196.google.com with SMTP id d22so6361187oic.7 for ; Fri, 22 Nov 2019 04:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=u5HN2aZVdj7m+hEI/tOay7oYBKK4V1c4Qj4MJYDq/G8=; b=y43nUX9f2O6pPgD2zT2J76e5OrIx6dYRFy/3LTBk/WB5BUPyt5Tw9+g349oglCGlpc S7PtdBt9Bhyo4VczYhRGS72HwuwJWIhNbUpNqO1xxjcNMF/pd3d6bCjqUDt2FjuXgpx4 H6RR2+YNKVH9W6DgH5Rg1+Si8iE6MOvVwW5eVga9QVLjZY67y/mqbQs7CoJHy/AxXsdY o9M+cpQJO+3WCBE6a9ylZPf0Y3+ILeYjYyankYt0PeP3F6eODLhifc90Mq0uOSL95ij3 yrrZDRKqDelRApbxvKFD6mIDbqBSUWLXTc2DEJSWsZT49fVT1Sme4YtNpeaS537MhXfU aVOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=u5HN2aZVdj7m+hEI/tOay7oYBKK4V1c4Qj4MJYDq/G8=; b=ICUSd0/vGo5uW935IJi7rF9I3tFWtUPcj4V0MvlhVpA6tU2Q9vsz/BBNt1GStU7I4H 9tXQye85GftD76X7SEH0DkMPx2dh5O/HnCqFezN9Y7ptWBAgfaokT3gLUxHNi1TgtarR EunVR/HxnbfLEWhoK+W77T46ASlPZgDCO7gNgyB5X5SN01udCO3A4BzS6oNBFrQPUQBg 1J4GdyDArxqDubeyytWC3DpAPGeWSnmp0RHNnZVqlAItPZRQ1ttPQ1iDP+5RIDXSWHA5 qjKQgTUS/Q9gmbJxWvAIIylfkWOHfCv3hAOZlfVL9QO1z2JoVDKlseJWeZrQRzuw6uKf vD0A== X-Gm-Message-State: APjAAAWQST5g7RQSWEqH/bnnTKfKNtmHfEkr+SNJSIt0mhw5gs1g+Qe/ VukGvNenlV1fJILDYksDbCB2oOQYiIQLNGkH2FEzWA== X-Received: by 2002:aca:d904:: with SMTP id q4mr12198515oig.21.1574426835323; Fri, 22 Nov 2019 04:47:15 -0800 (PST) MIME-Version: 1.0 References: <20191120142038.30746-1-ktouil@baylibre.com> <20191120142038.30746-2-ktouil@baylibre.com> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 22 Nov 2019 13:47:04 +0100 Message-ID: Subject: Re: [PATCH 1/4] dt-bindings: nvmem: new optional property write-protect-gpios To: Linus Walleij Cc: Khouloud Touil , Rob Herring , Mark Rutland , Srinivas Kandagatla , baylibre-upstreaming@groups.io, "linux-kernel@vger.kernel.org" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-i2c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pt., 22 lis 2019 o 13:41 Linus Walleij napisa=C5= =82(a): > > Hi Khouloud, > > thanks for your patch! > > I just have a semantic comment: > > On Wed, Nov 20, 2019 at 3:21 PM Khouloud Touil wrot= e: > > > Instead of modifying all the memory drivers to check this pin, make > > the NVMEM subsystem check if the write-protect GPIO being passed > > through the nvmem_config or defined in the device tree and pull it > > low whenever writing to the memory. > > It is claimed that this should be pulled low to assert it so by > definition it is active low. > > > + wp-gpios: > > + description: > > + GPIO to which the write-protect pin of the chip is connected. > > + maxItems: 1 > > Mandate that the flag in the second cell should be GPIO_ACTIVE_LOW > > > patternProperties: > > "^.*@[0-9a-f]+$": > > type: object > > @@ -66,6 +71,7 @@ examples: > > qfprom: eeprom@700000 { > > #address-cells =3D <1>; > > #size-cells =3D <1>; > > + wp-gpios =3D <&gpio1 3 0>; > > #include > wp-gpios =3D <&gpio1 3 GPIO_ACTIVE_LOW>; > > This will in Linux have the semantic effect that you need to > set the output high with gpio_set_val(d, 1) to assert it > (drive it low) but that really doesn't matter to the device tree > bindings, those are OS-agnostic: if the line is active low then > it should use this flag. > > It has the upside that the day you need a write-protect that > is active high, it is simple to support that use case too. > Linus, what about the existing bindings for at24 that don't mandate the active-low flag? I'm afraid this would break the support for this specific chip or lead to code duplication if we had this in both nvmem and at24 with different logic. Bartosz > Yours, > Linus Walleij