Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1A7FC433F5 for ; Mon, 9 May 2022 05:29:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 278EC83F22; Mon, 9 May 2022 07:29:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="hYBn8NUK"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GCAlqFiD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 184D283E97; Mon, 9 May 2022 07:29:43 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 34D72802EB for ; Mon, 9 May 2022 07:29:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6AB105C00E7; Mon, 9 May 2022 01:29:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 09 May 2022 01:29:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1652074179; x=1652160579; bh=T3rk/QK/JreIiFvu5IbiDrfEt z7whCMOwyhSY/+p8cQ=; b=hYBn8NUKdyMnMWkdDlE6XL5YmcwfoiGba4PN0pH2u pn8cWUWUOLBPYfBtp8AMjPLz6Ke/dob0u8AHKp7q4aYv0qe6X8f61E0ReHj3P4US IDrCJuDZ2j2DCakeeE+s/PthXYuZk3go/alPEcBIImnp3HsjpBHOKB+5CL2qpy1T DE15imGI7byIJJvC58FS2geVdoT0JPEQC/dxw/ShYKMjXIbpEaflYRjfKtzu+jst uejBvIhayQjBByLhaiRl088fXjNWoU5BIUGI9ygUdPIHec8PKy3e8fYzAxnT67qv UGNNPxdcM9W9+gKcm8sQwi9hOsD0JnorVOz7OsiBp9SvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1652074179; x=1652160579; bh=T 3rk/QK/JreIiFvu5IbiDrfEtz7whCMOwyhSY/+p8cQ=; b=GCAlqFiD9cQeD+Y11 jE/4PER2e6jmAzJWuhTbRobIE4Cjur9zKa/SedwwlPj8jBRXcP7jXGvpbRwBW7EK wg8Lr7DRBWrBIV46SwmN3qlyu3VZSP0fyrHeWZk3iQgU3Xmt+BNvJ8N+Lse34Pm4 x1GaZX9jtzKnpc/MYzTHPW5hT6ZXIA73/4G8lBTcE/d7bHETyfnhPfXOBZZoXKcz nG8vc7cNLT6hcu3w8RP5rBR989yWLGqAeb5xs7tNBAX7hGEpAZacbuavAf8k9GAj X3Y3hfZZPP92+qVqTRmAGnDYAZjohWUH45wZ4C1WDchCu1JG7gJSgRbNTJMNXPdM fBavA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekgdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeekveelhfejueelleetvdejvdeffeetgeelheeujeffhefgffefkeehhffh keekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 May 2022 01:29:38 -0400 (EDT) From: Samuel Holland To: u-boot@lists.denx.de, Jagan Teki , Andre Przywara , Lukasz Majewski , Sean Anderson Cc: Samuel Holland , Bin Meng , Heinrich Schuchardt , Maxime Ripard Subject: [PATCH 0/7] clk: sunxi: Out-of-bounds access fix and driver cleanup Date: Mon, 9 May 2022 00:29:30 -0500 Message-Id: <20220509052937.42283-1-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean This series fixes an issue with out-of-bounds access to the gate array (patches 1-2), uses the rearranged array size information to remove a bunch of duplicate code (patches 3-4), and then simplifies how the reset driver is bound (patches 5-7). The original motivation for these changes was adding a driver for the legacy A31/A23/A33 PRCM binding (which I will send separately), and trying to use OF_PLATDATA in SPL (which did not work out). But I think at least some of the cleanup is worth applying on its own. Patch 4 is generally the same change I made between v1 and v2 of the pinctrl series, using some #ifdefs to share a U_BOOT_DRIVER. It's not quite as clean as the pinctrl case, because here the SoC-specific parts are in different files, so all of the CCU descriptors have to be global. Samuel Holland (7): clk: sunxi: Store the array sizes in the CCU descriptor clk: sunxi: Prevent out-of-bounds gate array access reset: sunxi: Get the reset count from the CCU descriptor clk: sunxi: Use a single driver for all variants clk: sunxi: Convert driver private data to platform data reset: sunxi: Convert driver private data to platform data reset: sunxi: Reuse the platform data from the clock driver drivers/clk/sunxi/clk_a10.c | 27 +----- drivers/clk/sunxi/clk_a10s.c | 27 +----- drivers/clk/sunxi/clk_a23.c | 27 +----- drivers/clk/sunxi/clk_a31.c | 25 +---- drivers/clk/sunxi/clk_a31_r.c | 29 +----- drivers/clk/sunxi/clk_a64.c | 25 +---- drivers/clk/sunxi/clk_a80.c | 36 ++------ drivers/clk/sunxi/clk_a83t.c | 25 +---- drivers/clk/sunxi/clk_h3.c | 27 +----- drivers/clk/sunxi/clk_h6.c | 25 +---- drivers/clk/sunxi/clk_h616.c | 25 +---- drivers/clk/sunxi/clk_h6_r.c | 27 +----- drivers/clk/sunxi/clk_r40.c | 25 +---- drivers/clk/sunxi/clk_sunxi.c | 168 ++++++++++++++++++++++++++++++---- drivers/clk/sunxi/clk_v3s.c | 27 +----- drivers/reset/reset-sunxi.c | 55 ++--------- include/clk/sunxi.h | 21 +---- 17 files changed, 208 insertions(+), 413 deletions(-) -- 2.35.1