From nobody Wed Feb 11 05:43:42 2026 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C76C114BFA5 for ; Thu, 16 May 2024 15:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715872133; cv=none; b=HU7ReLi9pFBzRJl6hqwuwzl8DFxlUk3FnOONcJ0jWJs5tmBLkpi83yrl8cBxR5i63j2kEMwoms5jWmJKL80XChpk+R1Gfg+dHaK7+Yn+2GCrt4rXE5gqGkdc5FMHNuaB7NoOSem1Or3bH3rTexCFYrYk0aTQ4VBN0jM5Ol4i+Ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715872133; c=relaxed/simple; bh=GPIkBbQj4IQYkRBMApjzbDefFG1cRgF3e6hKKqXUa84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iPWjOWs9rbOn65lW4AarW8HRYZb+koblPkamAnvSvOGs3SjgBfew2SY1Rlni16RIojCVq3FbUAcX+jQw1XEl1pj+6ihNHl23Lm2RHJWkbZZxxGWNLvftApVWdqmHCcbiXOSM0KoQKc/E/nRgZ8UecbCT8etO07l8KqtWkeV/wzM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=p0S5dnGS; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="p0S5dnGS" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2db17e8767cso12510971fa.3 for ; Thu, 16 May 2024 08:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1715872130; x=1716476930; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zlq2XgSsulaEdUEoiNJy3+0ETTvrLEFhmOVX/TPKWFg=; b=p0S5dnGSdMKtvt45zX7xJfOn2ceBCsFzGZqPG3stB6jWb7rrlM+4+rxT7DlKbC6+sF Ze2uXr2DDZ8TzsgSxICYc0pwUU6CVokQnzW1APxdBYqRIzLG69wsDyud92ge1BRoi4VU HsXXOMd80A8csNv3JU4mNIHyqx2ep6uCAvbcqLzja1N6iOYkx/dhbKsSePcxXFmXQWW2 UyS10NhCMqXFtfjfxTlCzg+nCHV2Ly/SW/W6pL2KpiN8NDP/+XNAKzkPgwxT1Ua7KdXE f2TdCKVTGuPxMnOHsr+KjiMVysnLnPkC+TFeig89Cprqivn0JwMSdgxGjPrBTABQjQO5 A6zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715872130; x=1716476930; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zlq2XgSsulaEdUEoiNJy3+0ETTvrLEFhmOVX/TPKWFg=; b=geE9X2PpTksApN60kNhAwmH9bBB+82mB3rajE0Iwm4z8jZVu+d5PwVjbUZ/LmtDigh xWxVbEo9W52iTctyFkf/liepHnmzcaO+6s/iRIl+zdwHaIdo3PqxpyObpDLM2wZT4t/E ESmSINeBFrAoP6r8TnTQFSESibf1LpWjev/6unLAv1PAlR8s9RMIN80rgRqBO1AKeX8X MKZo0zwZ/KLgDceMWIi+dorD/osKvWzwbNtyArQbVV8K8Tx4l6xSKVLYBJJIShZb+Y9W e7jp0o1RsaHIk0aMch/DtShDgo1Zq4You5LTfSdJqnCvdMtz3Lb7O3vZqPPQcVOkDLaZ /nYg== X-Forwarded-Encrypted: i=1; AJvYcCWIHe3nFBsrcEAg+RVYxCYj5mEcjPtxYdzb+T+mGQW00HuhPCsurNeDYpWgQ8l5/ngeGGTo5xW+XUQDvGw8aYsFVD2/DChH8GkHkqZh X-Gm-Message-State: AOJu0Yzv/wTeQOffdPz/rzchntUYFbrZKEJLGE841vAMWn1ldyTQzEfn 6sl7O0Plg+7I1xrcgWhxZ7huO7jTBFbwjuS9wWncNDkm5lKLN4uAhliJlmvUQ8E= X-Google-Smtp-Source: AGHT+IHr28udNSRatyT+2G5LNG1+hGVEMFrX9RhYuqKy2yHAm390/4kDGgRKQKwjLoGX9pVtnsJ34g== X-Received: by 2002:a2e:5112:0:b0:2e6:d2bc:1d18 with SMTP id 38308e7fff4ca-2e6d2bc24e5mr52015521fa.22.1715872129966; Thu, 16 May 2024 08:08:49 -0700 (PDT) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:1fce:7e5a:e201:edd5]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-41f87c25459sm309351725e9.18.2024.05.16.08.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 08:08:49 -0700 (PDT) From: Jerome Brunet To: Philipp Zabel , Stephen Boyd , Neil Armstrong Cc: Jerome Brunet , Jan Dakinevich , linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org Subject: [RFC PATCH 3/9] reset: amlogic: split the device and platform probe Date: Thu, 16 May 2024 17:08:33 +0200 Message-ID: <20240516150842.705844-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240516150842.705844-1-jbrunet@baylibre.com> References: <20240516150842.705844-1-jbrunet@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To prepare the addition of the auxiliary device support, split the device probe from the probe of the platform device. The device probe will be common to both the platform and auxiliary driver. Signed-off-by: Jerome Brunet --- drivers/reset/reset-meson.c | 55 +++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 59126c9f194a..fec55321b52b 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -87,6 +87,27 @@ static const struct reset_control_ops meson_reset_ops = =3D { .deassert =3D meson_reset_deassert, }; =20 +static int meson_reset_probe(struct device *dev, struct regmap *map, + const struct meson_reset_param *param) +{ + unsigned int stride =3D regmap_get_reg_stride(map); + struct meson_reset *data; + + data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->param =3D param; + data->map =3D map; + data->rcdev.owner =3D dev->driver->owner; + data->rcdev.nr_resets =3D param->reg_count * BITS_PER_BYTE + * stride; + data->rcdev.ops =3D &meson_reset_ops; + data->rcdev.of_node =3D dev->of_node; + + return devm_reset_controller_register(dev, &data->rcdev); +} + static const struct meson_reset_param meson8b_param =3D { .reg_count =3D 8, .reset_offset =3D 0x0, @@ -125,46 +146,38 @@ static const struct regmap_config regmap_config =3D { .reg_stride =3D 4, }; =20 -static int meson_reset_probe(struct platform_device *pdev) +static int meson_reset_pltf_probe(struct platform_device *pdev) { + + const struct meson_reset_param *param; struct device *dev =3D &pdev->dev; - struct meson_reset *data; + struct regmap *map; void __iomem *base; =20 - data =3D devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); =20 - data->param =3D of_device_get_match_data(dev); - if (!data->param) + param =3D of_device_get_match_data(dev); + if (!param) return -ENODEV; =20 - data->map =3D devm_regmap_init_mmio(dev, base, ®map_config); - if (IS_ERR(data->map)) - return dev_err_probe(dev, PTR_ERR(data->map), + map =3D devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(map)) + return dev_err_probe(dev, PTR_ERR(map), "can't init regmap mmio region\n"); =20 - data->rcdev.owner =3D THIS_MODULE; - data->rcdev.nr_resets =3D data->param->reg_count * BITS_PER_BYTE - * regmap_config.reg_stride; - data->rcdev.ops =3D &meson_reset_ops; - data->rcdev.of_node =3D dev->of_node; - - return devm_reset_controller_register(dev, &data->rcdev); + return meson_reset_probe(dev, map, param); } =20 -static struct platform_driver meson_reset_driver =3D { - .probe =3D meson_reset_probe, +static struct platform_driver meson_reset_pltf_driver =3D { + .probe =3D meson_reset_pltf_probe, .driver =3D { .name =3D "meson_reset", .of_match_table =3D meson_reset_dt_ids, }, }; -module_platform_driver(meson_reset_driver); +module_platform_driver(meson_reset_pltf_driver); =20 MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver"); MODULE_AUTHOR("Neil Armstrong "); --=20 2.43.0