lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0a06241-537d-4ffe-9921-4c79c4080044@linaro.org>
Date: Mon, 19 Aug 2024 18:57:34 +0200
From: Neil Armstrong <neil.armstrong@...aro.org>
To: Jerome Brunet <jbrunet@...libre.com>
Cc: Philipp Zabel <p.zabel@...gutronix.de>, Stephen Boyd <sboyd@...nel.org>,
 linux-kernel@...r.kernel.org, linux-amlogic@...ts.infradead.org,
 linux-clk@...r.kernel.org
Subject: Re: [PATCH v3 8/9] reset: amlogic: split the device core and platform
 probe

On 19/08/2024 18:49, Jerome Brunet wrote:
> On Mon 19 Aug 2024 at 18:33, Neil Armstrong <neil.armstrong@...aro.org> wrote:
> 
>> On 08/08/2024 12:27, Jerome Brunet wrote:
>>> To prepare the addition of the auxiliary device support, split
>>> out the device core function from the probe of the platform device.
>>> The device core function will be common to both the platform and
>>> auxiliary
>>> driver.
>>> Signed-off-by: Jerome Brunet <jbrunet@...libre.com>
>>> ---
>>>    drivers/reset/amlogic/Kconfig                 |  10 +-
>>>    drivers/reset/amlogic/Makefile                |   3 +-
>>>    .../{reset-meson.c => reset-meson-core.c}     | 101 +++---------------
>>>    drivers/reset/amlogic/reset-meson-pltf.c      |  92 ++++++++++++++++
>>
>> Are we still in 1983 ?
> 
> I don't quite get that remark or how it is helping the review.
> 
>> please use reset-meson-platform and drop pltf completely
> 
> You are requesting auxiliary -> aux on the patch.
> So which one will it be ?

`aux` is easy to read and understandable because written on all multimedia appliances
over the world for the last 40years, plft is not

> 
>>
>>>    drivers/reset/amlogic/reset-meson.h           |  24 +++++
>>>    5 files changed, 143 insertions(+), 87 deletions(-)
>>>    rename drivers/reset/amlogic/{reset-meson.c => reset-meson-core.c} (51%)
>>>    create mode 100644 drivers/reset/amlogic/reset-meson-pltf.c
>>>    create mode 100644 drivers/reset/amlogic/reset-meson.h
>>> diff --git a/drivers/reset/amlogic/Kconfig
>>> b/drivers/reset/amlogic/Kconfig
>>> index 7ed9cf50f038..04c7be0f3165 100644
>>> --- a/drivers/reset/amlogic/Kconfig
>>> +++ b/drivers/reset/amlogic/Kconfig
>>> @@ -1,9 +1,15 @@
>>> +config RESET_MESON_CORE
>>> +	tristate
>>> +	select REGMAP
>>> +
>>>    config RESET_MESON
>>> -	tristate "Meson Reset Driver"
>>> +	tristate "Meson Reset Platform Driver"
>>>    	depends on ARCH_MESON || COMPILE_TEST
>>>    	default ARCH_MESON
>>> +	select REGMAP_MMIO
>>> +	select RESET_MESON_CORE
>>>    	help
>>> -	  This enables the reset driver for Amlogic Meson SoCs.
>>> +	  This enables the reset platform driver for Amlogic SoCs.
>>>      config RESET_MESON_AUDIO_ARB
>>>    	tristate "Meson Audio Memory Arbiter Reset Driver"
>>> diff --git a/drivers/reset/amlogic/Makefile b/drivers/reset/amlogic/Makefile
>>> index 55509fc78513..0f8f9121b566 100644
>>> --- a/drivers/reset/amlogic/Makefile
>>> +++ b/drivers/reset/amlogic/Makefile
>>> @@ -1,2 +1,3 @@
>>> -obj-$(CONFIG_RESET_MESON) += reset-meson.o
>>> +obj-$(CONFIG_RESET_MESON) += reset-meson-pltf.o
>>> +obj-$(CONFIG_RESET_MESON_CORE) += reset-meson-core.o
>>>    obj-$(CONFIG_RESET_MESON_AUDIO_ARB) += reset-meson-audio-arb.o
>>> diff --git a/drivers/reset/amlogic/reset-meson.c b/drivers/reset/amlogic/reset-meson-core.c
>>> similarity index 51%
>>> rename from drivers/reset/amlogic/reset-meson.c
>>> rename to drivers/reset/amlogic/reset-meson-core.c
>>> index b16d9c32adb1..ea4fc562f7e6 100644
>>> --- a/drivers/reset/amlogic/reset-meson.c
>>> +++ b/drivers/reset/amlogic/reset-meson-core.c
>>> @@ -1,27 +1,17 @@
>>>    // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
>>>    /*
>>> - * Amlogic Meson Reset Controller driver
>>> + * Amlogic Meson Reset core functions
>>>     *
>>> - * Copyright (c) 2016 BayLibre, SAS.
>>> - * Author: Neil Armstrong <narmstrong@...libre.com>
>>
>> Hmmm no, I'm still an author
>>
>>> + * Copyright (c) 2024 BayLibre, SAS.
>>
>> And Baylibre's Copyright is still from 2016, so use 2016-2024 in this case
>>
>>> + * Author: Jerome Brunet <jbrunet@...libre.com>
>>>     */
>>> -#include <linux/err.h>
>>> -#include <linux/init.h>
>>> -#include <linux/io.h>
>>> -#include <linux/of.h>
>>> +
>>> +#include <linux/device.h>
>>>    #include <linux/module.h>
>>> -#include <linux/platform_device.h>
>>>    #include <linux/regmap.h>
>>>    #include <linux/reset-controller.h>
>>> -#include <linux/slab.h>
>>> -#include <linux/types.h>
>>> -
>>> -struct meson_reset_param {
>>> -	unsigned int reset_num;
>>> -	unsigned int reset_offset;
>>> -	unsigned int level_offset;
>>> -	bool level_low_reset;
>>> -};
>>> +
>>> +#include "reset-meson.h"
>>>      struct meson_reset {
>>>    	const struct meson_reset_param *param;
>>> @@ -102,84 +92,27 @@ static const struct reset_control_ops meson_reset_ops = {
>>>    	.status		= meson_reset_status,
>>>    };
>>>    -static const struct meson_reset_param meson8b_param = {
>>> -	.reset_num	= 256,
>>> -	.reset_offset	= 0x0,
>>> -	.level_offset	= 0x7c,
>>> -	.level_low_reset = true,
>>> -};
>>> -
>>> -static const struct meson_reset_param meson_a1_param = {
>>> -	.reset_num	= 96,
>>> -	.reset_offset	= 0x0,
>>> -	.level_offset	= 0x40,
>>> -	.level_low_reset = true,
>>> -};
>>> -
>>> -static const struct meson_reset_param meson_s4_param = {
>>> -	.reset_num	= 192,
>>> -	.reset_offset	= 0x0,
>>> -	.level_offset	= 0x40,
>>> -	.level_low_reset = true,
>>> -};
>>> -
>>> -static const struct of_device_id meson_reset_dt_ids[] = {
>>> -	 { .compatible = "amlogic,meson8b-reset",    .data = &meson8b_param},
>>> -	 { .compatible = "amlogic,meson-gxbb-reset", .data = &meson8b_param},
>>> -	 { .compatible = "amlogic,meson-axg-reset",  .data = &meson8b_param},
>>> -	 { .compatible = "amlogic,meson-a1-reset",   .data = &meson_a1_param},
>>> -	 { .compatible = "amlogic,meson-s4-reset",   .data = &meson_s4_param},
>>> -	 { .compatible = "amlogic,c3-reset",   .data = &meson_s4_param},
>>> -	 { /* sentinel */ },
>>> -};
>>> -MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);
>>> -
>>> -static const struct regmap_config regmap_config = {
>>> -	.reg_bits   = 32,
>>> -	.val_bits   = 32,
>>> -	.reg_stride = 4,
>>> -};
>>> -
>>> -static int meson_reset_probe(struct platform_device *pdev)
>>> +int meson_reset_probe(struct device *dev, struct regmap *map,
>>> +		      const struct meson_reset_param *param)
>>>    {
>>> -	struct device *dev = &pdev->dev;
>>>    	struct meson_reset *data;
>>> -	void __iomem *base;
>>>      	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
>>>    	if (!data)
>>>    		return -ENOMEM;
>>>    -	base = devm_platform_ioremap_resource(pdev, 0);
>>> -	if (IS_ERR(base))
>>> -		return PTR_ERR(base);
>>> -
>>> -	data->param = device_get_match_data(dev);
>>> -	if (!data->param)
>>> -		return -ENODEV;
>>> -
>>> -	data->map = devm_regmap_init_mmio(dev, base, &regmap_config);
>>> -	if (IS_ERR(data->map))
>>> -		return dev_err_probe(dev, PTR_ERR(data->map),
>>> -				     "can't init regmap mmio region\n");
>>> -
>>> -	data->rcdev.owner = THIS_MODULE;
>>> -	data->rcdev.nr_resets = data->param->reset_num;
>>> +	data->param = param;
>>> +	data->map = map;
>>> +	data->rcdev.owner = dev->driver->owner;
>>> +	data->rcdev.nr_resets = param->reset_num;
>>>    	data->rcdev.ops = &meson_reset_ops;
>>>    	data->rcdev.of_node = dev->of_node;
>>>      	return devm_reset_controller_register(dev, &data->rcdev);
>>>    }
>>> +EXPORT_SYMBOL_NS_GPL(meson_reset_probe, MESON_RESET);
>>>    -static struct platform_driver meson_reset_driver = {
>>> -	.probe	= meson_reset_probe,
>>> -	.driver = {
>>> -		.name		= "meson_reset",
>>> -		.of_match_table	= meson_reset_dt_ids,
>>> -	},
>>> -};
>>> -module_platform_driver(meson_reset_driver);
>>> -
>>> -MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
>>> +MODULE_DESCRIPTION("Amlogic Meson Reset Core function");
>>>    MODULE_AUTHOR("Neil Armstrong <narmstrong@...libre.com>");
>>> -MODULE_LICENSE("Dual BSD/GPL");
>>> +MODULE_AUTHOR("Jerome Brunet <jbrunet@...libre.com>");
>>> +MODULE_IMPORT_NS(MESON_RESET);
>>> diff --git a/drivers/reset/amlogic/reset-meson-pltf.c b/drivers/reset/amlogic/reset-meson-pltf.c
>>> new file mode 100644
>>> index 000000000000..97e933b4aa34
>>> --- /dev/null
>>> +++ b/drivers/reset/amlogic/reset-meson-pltf.c
>>> @@ -0,0 +1,92 @@
>>> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
>>> +/*
>>> + * Amlogic Meson Reset platform driver
>>> + *
>>> + * Copyright (c) 2016 BayLibre, SAS.
>>> + * Author: Neil Armstrong <narmstrong@...libre.com>
>>> + */
>>> +#include <linux/err.h>
>>> +#include <linux/io.h>
>>> +#include <linux/of.h>
>>> +#include <linux/module.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/regmap.h>
>>> +#include <linux/reset-controller.h>
>>> +
>>> +#include "reset-meson.h"
>>> +
>>> +static const struct meson_reset_param meson8b_param = {
>>> +	.reset_num	= 256,
>>> +	.reset_offset	= 0x0,
>>> +	.level_offset	= 0x7c,
>>> +	.level_low_reset = true,
>>> +};
>>> +
>>> +static const struct meson_reset_param meson_a1_param = {
>>> +	.reset_num	= 96,
>>> +	.reset_offset	= 0x0,
>>> +	.level_offset	= 0x40,
>>> +	.level_low_reset = true,
>>> +};
>>> +
>>> +static const struct meson_reset_param meson_s4_param = {
>>> +	.reset_num	= 192,
>>> +	.reset_offset	= 0x0,
>>> +	.level_offset	= 0x40,
>>> +	.level_low_reset = true,
>>> +};
>>> +
>>> +static const struct of_device_id meson_reset_dt_ids[] = {
>>> +	 { .compatible = "amlogic,meson8b-reset",    .data = &meson8b_param},
>>> +	 { .compatible = "amlogic,meson-gxbb-reset", .data = &meson8b_param},
>>> +	 { .compatible = "amlogic,meson-axg-reset",  .data = &meson8b_param},
>>> +	 { .compatible = "amlogic,meson-a1-reset",   .data = &meson_a1_param},
>>> +	 { .compatible = "amlogic,meson-s4-reset",   .data = &meson_s4_param},
>>> +	 { .compatible = "amlogic,c3-reset",   .data = &meson_s4_param},
>>> +	 { /* sentinel */ },
>>> +};
>>> +MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);
>>> +
>>> +static const struct regmap_config regmap_config = {
>>> +	.reg_bits   = 32,
>>> +	.val_bits   = 32,
>>> +	.reg_stride = 4,
>>> +};
>>> +
>>> +static int meson_reset_pltf_probe(struct platform_device *pdev)
>>> +{
>>> +	const struct meson_reset_param *param;
>>> +	struct device *dev = &pdev->dev;
>>> +	struct regmap *map;
>>> +	void __iomem *base;
>>> +
>>> +	base = devm_platform_ioremap_resource(pdev, 0);
>>> +	if (IS_ERR(base))
>>> +		return PTR_ERR(base);
>>> +
>>> +	param = device_get_match_data(dev);
>>> +	if (!param)
>>> +		return -ENODEV;
>>> +
>>> +	map = devm_regmap_init_mmio(dev, base, &regmap_config);
>>> +	if (IS_ERR(map))
>>> +		return dev_err_probe(dev, PTR_ERR(map),
>>> +				     "can't init regmap mmio region\n");
>>> +
>>> +	return meson_reset_probe(dev, map, param);
>>> +}
>>> +
>>> +static struct platform_driver meson_reset_pltf_driver = {
>>> +	.probe	= meson_reset_pltf_probe,
>>> +	.driver = {
>>> +		.name		= "meson_reset",
>>> +		.of_match_table	= meson_reset_dt_ids,
>>> +	},
>>> +};
>>> +module_platform_driver(meson_reset_pltf_driver);
>>> +
>>> +MODULE_DESCRIPTION("Amlogic Meson Reset Platform Controller driver");
>>> +MODULE_AUTHOR("Neil Armstrong <narmstrong@...libre.com>");
>>> +MODULE_AUTHOR("Jerome Brunet <jbrunet@...libre.com>");
>>> +MODULE_LICENSE("Dual BSD/GPL");
>>> +MODULE_IMPORT_NS(MESON_RESET);
>>> diff --git a/drivers/reset/amlogic/reset-meson.h b/drivers/reset/amlogic/reset-meson.h
>>> new file mode 100644
>>> index 000000000000..c2e8a5cf2e46
>>> --- /dev/null
>>> +++ b/drivers/reset/amlogic/reset-meson.h
>>> @@ -0,0 +1,24 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
>>> +/*
>>> + * Copyright (c) 2024 BayLibre, SAS.
>>> + * Author: Jerome Brunet <jbrunet@...libre.com>
>>> + */
>>> +
>>> +#ifndef __MESON_RESET_CORE_H
>>> +#define __MESON_RESET_CORE_H
>>> +
>>> +#include <linux/module.h>
>>> +#include <linux/regmap.h>
>>> +#include <linux/reset-controller.h>
>>> +
>>> +struct meson_reset_param {
>>> +	unsigned int reset_num;
>>> +	unsigned int reset_offset;
>>> +	unsigned int level_offset;
>>> +	bool level_low_reset;
>>> +};
>>> +
>>> +int meson_reset_probe(struct device *dev, struct regmap *map,
>>> +		      const struct meson_reset_param *param);
>>> +
>>> +#endif /* __MESON_RESET_CORE_H */
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ