From patchwork Thu Mar 26 11:42:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1261951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=LNQS513G; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48p35y5SCFz9sQx for ; Thu, 26 Mar 2020 22:43:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B86E2800DF; Thu, 26 Mar 2020 12:43:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="LNQS513G"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED871817C3; Thu, 26 Mar 2020 12:43:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0704.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::704]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F3DC4800DF for ; Thu, 26 Mar 2020 12:43:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g//m7HWIvuUE9aAtSNOKT9p237BgQ49+Qk7ZfXJdMxK4p3OnoBXfeYrSE5ZznBAgY3b+AmZ1/qzPVRbGeCIZ+/zXRp2fUaC3jSwN5R/1mCzrMFvI4yYXnLH47tWRUHzJlOZexvXNJjPPlWQ4+cysFGCAYimU+hPfrq3YWJvwvtXeNZe2TzlaG8VnDt4zjZrwuKW8lA8cpLnDud3WjEWi7QyYgTjgwaGX2bIMKdUEHDRjklCeCJ42kVQAzBMeaj00YhrQn2UezOW0wNvTYwCNFbq42IsmPk7STNXuy9AfLLga2f/7LtFaD4dV64T2WDqzBQTin9/D0wLHVeaO2IaGxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Om3K1yrT2oUHt8diDoTktNqBh2eV5Oj8bfTpDCwukro=; b=Cs7J806K1qdYyXxoLKO2oRc5BGyB93BCKJq3onEb1g2ldnaP52YJxGxkX0OgrGJoDPFQA6Wjn+Fe9U7dak0Z/uCqHG5eri7fqNkQJdA4AyiQchgEvlTSKdh5892ZyJFjooQjPeQegn4QCd5kzb7maUD3YstqHiiCh5IZ8vnC0rdQNmtYjjVOFi0FijGKtoUpm1oS8fBpk4RiM8+lICu8W8Sxc/IHR2YuBsCDFPJipOUvRTRWMj1I9wyN7j6XKA0NmG7xKFIybcEjK0MqfYJ5KmudWMDCSZW8VbCo0ukyAtUDZSok9J8VgeM1eQM6yc6+EgIW9V6DSJn8tS8pPV2tXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Om3K1yrT2oUHt8diDoTktNqBh2eV5Oj8bfTpDCwukro=; b=LNQS513Gi5vSMPq/6ukS/nEYYS6U+u16hsoFjjNRUTYaUNxCuVzDWswQF+JoWiXDZkA5njoUEKO9tzAkAOdvQT9P3BkynNRve9m1zFDeJJI2K7MtrZhiXriWFY4CFG8Wep5sNAFKXbVgt0YT5fnIEUAidU3fElu/wOKdIJOivUQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3583.EURPRD10.PROD.OUTLOOK.COM (10.186.160.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Thu, 26 Mar 2020 11:43:15 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7%5]) with mapi id 15.20.2835.023; Thu, 26 Mar 2020 11:43:15 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Jagan Teki , Vignesh R , Rasmus Villemoes Subject: [PATCH 0/3] mtd: spi-nor: add support for locking on Macronix nor flashes Date: Thu, 26 Mar 2020 12:42:54 +0100 Message-Id: <20200326114257.1782-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 X-ClientProxiedBy: AM6PR10CA0092.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::33) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR10CA0092.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.18 via Frontend Transport; Thu, 26 Mar 2020 11:43:14 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8ee8ffd-7990-4af0-a1f6-08d7d17ade9d X-MS-TrafficTypeDiagnostic: VI1PR10MB3583: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0354B4BED2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(39840400004)(366004)(136003)(376002)(396003)(54906003)(956004)(81166006)(316002)(1076003)(16526019)(107886003)(6916009)(8676002)(6486002)(86362001)(81156014)(186003)(5660300002)(8936002)(44832011)(6512007)(4326008)(8976002)(36756003)(2616005)(6506007)(6666004)(52116002)(478600001)(2906002)(26005)(66946007)(66556008)(66476007); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3583; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WGNyXN1wcxX9DuYvYiUViH8Ih62MnjFyeVpzb0Uyj+b8LR8GEaBfqJ/tEyyNrU+QB0L2oDkkF6BRkso/SRMuMZjYkLyy8X8vaLXteeHGaqEilyJMAwi1/NJa6jBmX0xklPDalvIgeP5GQ/phBctBf01UoZPDKDW/0n068vXFpU9SSa0KjcfTq9XoforMsp7UdHk/OpnuwA0prxMCxomu4Hh2A17911ExI3T9wVrg4G6rcER57akLNPtKlhIUoXbBT5pr89QrxoaODMwjX8Pv6oBp+Cxh6d5EkVP/sP7KV9maWm+4GL9oOfQQz7810zLN51+ddcFbYzenm/fuGGkccdjVBZ/7QN+nR52r0Nv+VFctXQDJyz08iBQYd3tZYJyGMIXyjx4zFR6cAvoJGSBtByu1W62qYy3+kB7ofWDVRtm1HiOefGs+1D8+yWLSaOeY X-MS-Exchange-AntiSpam-MessageData: 2oW6QRx+Na5ym1ZySioNRWLrc8ZFo2dnO6yJtzIdRQ7cTUtJ3Mx3tj2fjdVepn+uyE3Ai6VdqicopVsumg31DNh1VbrBp0iZNGKvXobR68tVPh8DvwOpeWTFdS63n1kjsRCrzhMpAYXgGOn4wWapbA== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: a8ee8ffd-7990-4af0-a1f6-08d7d17ade9d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2020 11:43:14.9171 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AC7Vv1K0CknSC69+/lERNXqMlqah8ywL9Jc/hcos34tzEPr70oFHbdMNqCYTslAtNEblaEs6ZvPbKQqEYG3sWgXi0kLjqlxY/PmXwt18/gI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3583 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Here's an attempt at implementing locking support for Macronix flashes. I've tested that it works on the chip used on our boards, and reading data sheets for various other Macronix chips suggest they behave in the same way. I'm still not entirely sure about the best way to hook up these functions in spi_nor_scan. Also, I'm ignoring the UI/UX issue of automatically setting a OTP bit without some "force" or "yes, I'm sure" opt-in - maybe I'm simply overthinking it and it's not a problem in practice (at least for our use case at hand, we will use bottom protect, so we can't really shoot ourselves in the foot). Rasmus Villemoes (3): mtd: spi-nor: don't guard stm_*lock* family by preprocessor conditionals mtd: spi-nor: add support for locking on Macronix nor flashes mtd: spi-nor: set SPI_NOR_HAS_LOCK for Macronix mx25l3205d drivers/mtd/spi/spi-nor-core.c | 268 ++++++++++++++++++++++++++++----- drivers/mtd/spi/spi-nor-ids.c | 2 +- include/linux/mtd/spi-nor.h | 3 + 3 files changed, 236 insertions(+), 37 deletions(-)