mtk-socinfo driver implementation
Subsystems (3)
v3 cover mtk-socinfo driver implementation
v3 changes:
changes dts:
1. remove socinfo node so mtk-socinfo can be registered from mtk-efuse
2. add unit address to mtk-socinfo nodes
mtk-socinfo.c:
1. add static to previously global variables
2. remove the check on soc_dev in mtk_socinfo_remove
3. Drop .owner from platform_driver mtk_socinfo
4. Instead of probing from devicetree, socinfo is registered from mtk-efuse
mtk-efuse.c:
1. Add mtk-efuse name to nvmem_config to avoid confusion with future nvmem nodes
2. register mtk-socinfo from mtk-efuse
William-tw Lin (3):
arm64: dts: Add node for chip info driver
soc: mediatek: mtk-socinfo: Add driver for getting chip information
nvmem: mtk-efuse: Modify driver for getting chip information
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 ++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 9 ++ arch/arm64/boot/dts/mediatek/mt8186.dtsi | 4 + arch/arm64/boot/dts/mediatek/mt8192.dtsi | 8 + arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 + drivers/nvmem/mtk-efuse.c | 11 +- drivers/soc/mediatek/Kconfig | 8 + drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-socinfo.c | 186 +++++++++++++++++++++++ 9 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/mediatek/mtk-socinfo.c
Signature · 1 line
2.18.0
PATCH v3 1/3 arm64: dts: Add node for chip info driver
Add dts node for socinfo retrieval for the following projects:
MT8173, MT8183, MT8186, MT8192, MT8195
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 9 +++++++++ arch/arm64/boot/dts/mediatek/mt8186.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8192.dtsi | 8 ++++++++ arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 +++ 5 files changed, 33 insertions(+)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +9 -0
@@ -590,6 +590,15 @@ reg = <0 0x10206000 0 0x1000>; #address-cells = <1>; #size-cells = <1>; + + socinfo_data1: socinfo-data1@40 { + reg = <0x040 0x4>; + }; + + socinfo_data2: socinfo-data2@44 { + reg = <0x044 0x4>; + }; + thermal_calibration: calib@528 { reg = <0x528 0xc>; };
arch/arm64/boot/dts/mediatek/mt8183.dtsi +9 -0
@@ -1585,6 +1585,15 @@ reg = <0 0x11f10000 0 0x1000>; #address-cells = <1>; #size-cells = <1>; + + socinfo_data1: socinfo-data1@4c { + reg = <0x04c 0x4>; + }; + + socinfo_data2: socinfo-data2@60 { + reg = <0x060 0x4>; + }; + thermal_calibration: calib@180 { reg = <0x180 0xc>; };
arch/arm64/boot/dts/mediatek/mt8186.dtsi +4 -0
@@ -1672,6 +1672,10 @@ reg = <0x59c 0x4>; bits = <0 3>; }; + + socinfo_data1: socinfo-data1@7a0 { + reg = <0x7a0 0x4>; + }; }; mipi_tx0: dsi-phy@11cc0000 {
arch/arm64/boot/dts/mediatek/mt8192.dtsi +8 -0
@@ -1120,6 +1120,14 @@ #address-cells = <1>; #size-cells = <1>; + socinfo_data1: socinfo-data1@44 { + reg = <0x044 0x4>; + }; + + socinfo_data2: socinfo-data2@50 { + reg = <0x050 0x4>; + }; + lvts_e_data1: data1@1c0 { reg = <0x1c0 0x58>; };
arch/arm64/boot/dts/mediatek/mt8195.dtsi +3 -0
@@ -1686,6 +1686,9 @@ lvts_efuse_data2: lvts2-calib@1d0 { reg = <0x1d0 0x38>; }; + socinfo_data1: socinfo-data1@7a0 { + reg = <0x7a0 0x4>; + }; }; u3phy2: t-phy@11c40000 {
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v3 1/3] arm64: dts: Add node for chip info driver
Il 20/12/23 11:38, William-tw Lin ha scritto:
Quoted 3 lines
Add dts node for socinfo retrieval for the following projects:
MT8173, MT8183, MT8186, MT8192, MT8195
arm64: dts: mediatek: Add socinfo efuses to MT8173/83/96/92/95 SoCs
Add efuse nodes for socinfo retrieval for MT8173, MT8183, MT8186, MT8192 and MT8195.
...because you're not adding a chipinfo node, but efuse nodes :-)
Quoted 14 lines
Signed-off-by William-tw Lin <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++ arch/arm64/boot/dts/mediatek/mt8183.dtsi | 9 +++++++++ arch/arm64/boot/dts/mediatek/mt8186.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8192.dtsi | 8 ++++++++ arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 +++ 5 files changed, 33 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 594
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0@@ -590,6 +590,15 @@ reg = <0 0x10206000 0 0x1000>; #address-cells = <1>; #size-cells = <1>; + + socinfo_data1: socinfo-data1@40 {
Also, you don't need the phandles as those nodes will never be modified from board specific devicetree, nor assigned to any devicetree node.
This means that you can go with just
socinfo-data1@40 {
reg ...
}same for data2 and for all SoCs.
Apart from that, looks good to me.
Cheers,
Angelo
PATCH v3 2/3 soc: mediatek: mtk-socinfo: Add driver for getting chip information
In reply to William-tw LinAdd driver for socinfo retrieval. This patch includes the following:
1. mtk-socinfo driver for chip info retrieval
2. Related changes to Makefile and Kconfig
--- drivers/soc/mediatek/Kconfig | 8 ++ drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-socinfo.c | 186 +++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 drivers/soc/mediatek/mtk-socinfo.c
drivers/soc/mediatek/Kconfig +8 -0
@@ -68,4 +68,12 @@ config MTK_SVS chip process corner, temperatures and other factors. Then DVFS driver could apply SVS bank voltage to PMIC/Buck. +config MTK_SOCINFO + tristate "MediaTek SoC Information" + default y + help + The MediaTek SoC Information (mtk-socinfo) driver provides + information about the SoC to the userspace including the + manufacturer name, marketing name and soc name. + endmenu
drivers/soc/mediatek/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o obj-$(CONFIG_MTK_SVS) += mtk-svs.o +obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o
drivers/soc/mediatek/mtk-socinfo.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v3 2/3] soc: mediatek: mtk-socinfo: Add driver for getting chip information
Il 20/12/23 11:39, William-tw Lin ha scritto:
Quoted 17 lines
Add driver for socinfo retrieval. This patch includes the following:
1. mtk-socinfo driver for chip info retrieval
2. Related changes toMakefileandKconfigSigned-off-by William-tw Lin <[email protected]>--- drivers/soc/mediatek/Kconfig | 8 ++ drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-socinfo.c | 186 +++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+)create mode 100644
drivers/soc/mediatek/mtk-socinfo.cdrivers/soc/mediatek/Kconfig +0
-0
drivers/soc/mediatek/Kconfig config MTK_SVS · line 73
Quoted 6 lines
drivers/soc/mediatek/Kconfig +3
-0@@ -68,4 +68,12 @@ config MTK_SVS chip process corner, temperatures and other factors. Then DVFS driver could apply SVS bank voltage to PMIC/Buck. +config MTK_SOCINFO + tristate "MediaTek SoC Information" + default y
Add the dependency please.
depends on NVMEM_MTK_EFUSE
Quoted 100 lines
drivers/soc/mediatek/Kconfig +5
-0+ help + The MediaTek SoC Information (mtk-socinfo) driver provides + information about the SoC to the userspace including the + manufacturer name, marketing name and soc name. + endmenudrivers/soc/mediatek/Makefile +1
-0@@ -7,3 +7,4 @@ obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o obj-$(CONFIG_MTK_SVS) += mtk-svs.o +obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.odrivers/soc/mediatek/mtk-socinfo.c new file +79
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 MediaTek Inc. +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_platform.h> +#include <linux/pm_runtime.h> +#include <linux/nvmem-consumer.h> +#include <linux/device.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h> +#include <linux/string.h> +#include <linux/sys_soc.h> +#include <linux/slab.h> +#include <linux/platform_device.h> + +#define MTK_SOCINFO_ENTRY (_soc_name, _segment_name, _marketing_name, _cell_data1, _cell_data2) {\ + .soc_name = _soc_name, \ + .segment_name = _segment_name, \ + .marketing_name = _marketing_name, \ + .cell_data = {_cell_data1, _cell_data2} \ +} +#define CELL_NOT_USED (0xFFFFFFFF) +#define MAX_CELLS (2) + +struct mtk_socinfo { +struct device *dev; +struct name_data *name_data; +struct socinfo_data *socinfo_data; +struct soc_device *soc_dev; +}; + +struct socinfo_data { +char *soc_name; +char *segment_name; +char *marketing_name; +u32 cell_data[MAX_CELLS ]; +}; + +static const char *cell_names[MAX_CELLS ] = {"socinfo-data1" ,"socinfo-data2" }; + +static struct socinfo_data socinfo_data_table[] = { +MTK_SOCINFO_ENTRY ("MT8173" ,"MT8173V/AC" ,"MT8173" ,0x6CA20004 ,0x10000000 ), +MTK_SOCINFO_ENTRY ("MT8183" ,"MT8183V/AZA" ,"Kompanio 500" ,0x00010043 ,0x00000840 ), +MTK_SOCINFO_ENTRY ("MT8186" ,"MT8186GV/AZA" ,"Kompanio 520" ,0x81861001 ,CELL_NOT_USED ), +MTK_SOCINFO_ENTRY ("MT8186T" ,"MT8186TV/AZA" ,"Kompanio 528" ,0x81862001 ,CELL_NOT_USED ), +MTK_SOCINFO_ENTRY ("MT8188" ,"MT8188GV/AZA" ,"Kompanio 830" ,0x81880000 ,0x00000010 ), +MTK_SOCINFO_ENTRY ("MT8188" ,"MT8188GV/HZA" ,"Kompanio 830" ,0x81880000 ,0x00000011 ), +MTK_SOCINFO_ENTRY ("MT8192" ,"MT8192V/AZA" ,"Kompanio 820" ,0x00001100 ,0x00040080 ), +MTK_SOCINFO_ENTRY ("MT8192T" ,"MT8192V/ATZA" ,"Kompanio 828" ,0x00000100 ,0x000400C0 ), +MTK_SOCINFO_ENTRY ("MT8195" ,"MT8195GV/EZA" ,"Kompanio 1200" ,0x81950300 ,CELL_NOT_USED ), +MTK_SOCINFO_ENTRY ("MT8195" ,"MT8195GV/EHZA" ,"Kompanio 1200" ,0x81950304 ,CELL_NOT_USED ), +MTK_SOCINFO_ENTRY ("MT8195" ,"MT8195TV/EZA" ,"Kompanio 1380" ,0x81950400 ,CELL_NOT_USED ), +MTK_SOCINFO_ENTRY ("MT8195" ,"MT8195TV/EHZA" ,"Kompanio 1380" ,0x81950404 ,CELL_NOT_USED ), +}; + +static int mtk_socinfo_create_socinfo_node (struct mtk_socinfo *mtk_socinfop) +{ +struct soc_device_attribute *attrs; +static char machine[30 ] = {0 }; +static const char *soc_manufacturer ="MediaTek" ; + + attrs =devm_kzalloc (mtk_socinfop->dev,sizeof (*attrs),GFP_KERNEL ); +if (!attrs) +return -ENOMEM ; + +snprintf (machine,sizeof (machine),"%s (%s)" , mtk_socinfop->socinfo_data->marketing_name, + mtk_socinfop->socinfo_data->soc_name); + attrs->family = soc_manufacturer; + attrs->machine = machine; + + mtk_socinfop->soc_dev =soc_device_register (attrs); +if (IS_ERR (mtk_socinfop->soc_dev)) +return PTR_ERR (mtk_socinfop->soc_dev); + +dev_info (mtk_socinfop->dev,"%s %s SoC detected.\n" , soc_manufacturer, attrs->machine); +return 0 ;
drivers/soc/mediatek/mtk-socinfo.c line 89
Quoted 10 lines
drivers/soc/mediatek/mtk-socinfo.c new file +10
-0+} + +static u32 mtk_socinfo_read_cell (struct device *dev,const char *name) +{ +struct nvmem_device *nvmemp; +struct device_node *np = dev->of_node; +u32 offset; +u32 cell_val =CELL_NOT_USED ; + + nvmemp =devm_nvmem_device_get (dev,"mtk-efuse0" );
Are you sure that this is supposed to be "mtk-efuse0" and not "mtk-efuse"? Looks strange.
Everything else looks ok.
Cheers,
Angelo
Re: [PATCH v3 2/3] soc: mediatek: mtk-socinfo: Add driver for getting chip information
Quoted 174 lines · AngeloGioacchino Del Regno
Il 20/12/23 11:39, William-tw Lin ha scritto:
Quoted 24 lines
Add driver for socinfo retrieval. This patch includes the following:
1. mtk-socinfo driver for chip info retrieval
2. Related changes toMakefileandKconfigSigned-off-by William-tw Lin <[email protected]>--- drivers/soc/mediatek/Kconfig | 8 ++ drivers/soc/mediatek/Makefile | 1 + drivers/soc/mediatek/mtk-socinfo.c | 186 +++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+)create mode 100644
drivers/soc/mediatek/mtk-socinfo.cdrivers/soc/mediatek/Kconfig +0
-0@@ -68,4 +68,12 @@ config MTK_SVS chip process corner, temperatures and other factors. ThenDVFS
driver could apply SVS bank voltage to PMIC/Buck.drivers/soc/mediatek/Kconfig config MTK_SVS · line 73
Quoted 3 lines
drivers/soc/mediatek/Kconfig +3
-0+config MTK_SOCINFO + tristate "MediaTek SoC Information" + default yAdd the dependency please.
depends on
NVMEM_MTK_EFUSEQuoted 129 lines
drivers/soc/mediatek/Kconfig +5
-0+ help + The MediaTek SoC Information (mtk-socinfo) driver provides + information about the SoC to the userspace including the + manufacturer name, marketing name and soc name. + endmenudrivers/soc/mediatek/Makefile +0
-0@@ -7,3 +7,4 @@ obj-$(CONFIG_MTK_REGULATOR_COUPLER) += mtk-regulator-coupler.o
obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
obj-$(CONFIG_MTK_SVS) += mtk-svs.odrivers/soc/mediatek/Makefile +1
-0+obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.odrivers/soc/mediatek/mtk-socinfo.c new file +19
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2023 MediaTek Inc. +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_platform.h> +#include <linux/pm_runtime.h> +#include <linux/nvmem-consumer.h> +#include <linux/device.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h> +#include <linux/string.h> +#include <linux/sys_soc.h> +#include <linux/slab.h> +#include <linux/platform_device.h> + +#define MTK_SOCINFO_ENTRY(_soc_name, _segment_name,
_marketing_name,_cell_data1,_cell_data2) {\drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ .soc_name = _soc_name,\drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ .segment_name = _segment_name,\drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ .marketing_name = _marketing_name,\drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ .cell_data = {_cell_data1, _cell_data2}\drivers/soc/mediatek/mtk-socinfo.c new file +19
-0+} +#define CELL_NOT_USED (0xFFFFFFFF) +#define MAX_CELLS (2) + +struct mtk_socinfo { +struct device *dev; +struct name_data *name_data; +struct socinfo_data *socinfo_data; +struct soc_device *soc_dev; +}; + +struct socinfo_data { +char *soc_name; +char *segment_name; +char *marketing_name; +u32 cell_data[MAX_CELLS ]; +}; + +static const char *cell_names[MAX_CELLS ] = {"socinfo-data1" ,"socinfo-data2"};
drivers/soc/mediatek/mtk-socinfo.c new file +3
-0+ +static struct socinfo_data socinfo_data_table[] = { + MTK_SOCINFO_ENTRY("MT8173", "MT8173V/AC", "MT8173", 0x6CA20004,
0x10000000),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8183", "MT8183V/AZA", "Kompanio 500",
0x00010043,0x00000840),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8186", "MT8186GV/AZA", "Kompanio 520",
0x81861001,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8186T", "MT8186TV/AZA", "Kompanio 528",
0x81862001,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8188", "MT8188GV/AZA", "Kompanio 830",
0x81880000,0x00000010),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8188", "MT8188GV/HZA", "Kompanio 830",
0x81880000,0x00000011),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8192", "MT8192V/AZA", "Kompanio 820",
0x00001100,0x00040080),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8192T", "MT8192V/ATZA", "Kompanio 828",
0x00000100,0x000400C0),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8195", "MT8195GV/EZA", "Kompanio 1200",
0x81950300,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8195", "MT8195GV/EHZA", "Kompanio 1200",
0x81950304,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8195", "MT8195TV/EZA", "Kompanio 1380",
0x81950400,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +1
-0+ MTK_SOCINFO_ENTRY("MT8195", "MT8195TV/EHZA", "Kompanio 1380",
0x81950404,CELL_NOT_USED),drivers/soc/mediatek/mtk-socinfo.c new file +3
-0+}; + +static int mtk_socinfo_create_socinfo_node(struct mtk_socinfo
*mtk_socinfop)drivers/soc/mediatek/mtk-socinfo.c new file +6
-0+{ +struct soc_device_attribute *attrs; +static char machine[30 ] = {0 }; +static const char *soc_manufacturer ="MediaTek" ; + + attrs = devm_kzalloc(mtk_socinfop->dev, sizeof(*attrs),
GFP_KERNEL);drivers/soc/mediatek/mtk-socinfo.c new file +4
-0+if (!attrs) +return -ENOMEM ; + + snprintf(machine, sizeof(machine), "%s (%s)", mtk_socinfop-Quoted 1 line
socinfo_data->marketing_name,drivers/soc/mediatek/mtk-socinfo.c new file +9
-0+ mtk_socinfop->socinfo_data->soc_name); + attrs->family = soc_manufacturer; + attrs->machine = machine; + + mtk_socinfop->soc_dev =soc_device_register (attrs); +if (IS_ERR (mtk_socinfop->soc_dev)) +return PTR_ERR (mtk_socinfop->soc_dev); + + dev_info(mtk_socinfop->dev, "%s %s SoC detected.\n",
soc_manufacturer,attrs->machine);drivers/soc/mediatek/mtk-socinfo.c new file +4
-0+return 0 ; +} + +static u32 mtk_socinfo_read_cell(struct device *dev, const char*name)
drivers/soc/mediatek/mtk-socinfo.c line 89
Quoted 7 lines
drivers/soc/mediatek/mtk-socinfo.c new file +7
-0+{ +struct nvmem_device *nvmemp; +struct device_node *np = dev->of_node; +u32 offset; +u32 cell_val =CELL_NOT_USED ; + + nvmemp =devm_nvmem_device_get (dev,"mtk-efuse0" );Are you sure that this is supposed to be "mtk-efuse0" and not "mtk- efuse"?
Looks strange.
Quoted 6 lines
Everything else looks ok.
Cheers,
Angelo
Hi Angelo,
Thank you for the comments! I can confirm that the node for mtk-efuse is "mtk-efuse0" since nvmem_regsiter() automatically appends an id to the name. The changes for the other comments will be addressed in the next version of patches. Thank you so much!
Best regards,
William
Re: [PATCH v3 2/3] soc: mediatek: mtk-socinfo: Add driver for getting chip information
In reply to William-tw LinQuoted 5 lines · William-tw Lin
Add driver for socinfo retrieval. This patch includes the following:
1. mtk-socinfo driver for chip info retrieval
2. Related changes toMakefileandKconfigSigned-off-by William-tw Lin <[email protected]>
...
drivers/soc/mediatek/mtk-socinfo.c line 182
Quoted 8 lines
drivers/soc/mediatek/mtk-socinfo.c new file +8
-0+static struct platform_driver mtk_socinfo = { + .probe = mtk_socinfo_probe, + .remove_new = mtk_socinfo_remove, + .driver = { + .name ="mtk-socinfo" , + }, +}; +builtin_platform_driver (mtk_socinfo);
module platform driver, because this is tristate and because this should be a module.
Best regards,
Krzysztof
AngeloGioacchino Del Regno
maintainerRe: [PATCH v3 2/3] soc: mediatek: mtk-socinfo: Add driver for getting chip information
Il 20/12/23 12:34, Krzysztof Kozlowski ha scritto:
Quoted 9 lines · William-tw Lin
Quoted 5 lines
Add driver for socinfo retrieval. This patch includes the following:
1. mtk-socinfo driver for chip info retrieval
2. Related changes toMakefileandKconfigSigned-off-by William-tw Lin <[email protected]>...
Quoted 12 lines
drivers/soc/mediatek/mtk-socinfo.c line 182
Quoted 8 lines
drivers/soc/mediatek/mtk-socinfo.c new file +8
-0+static struct platform_driver mtk_socinfo = { + .probe = mtk_socinfo_probe, + .remove_new = mtk_socinfo_remove, + .driver = { + .name ="mtk-socinfo" , + }, +}; +builtin_platform_driver (mtk_socinfo);module platform driver, because this is tristate and because this should be a module.
Oh! Yes, right! Thanks for catching that, it totally slipped off my brain.
Cheers,
Angelo
Re: [PATCH v3 2/3] soc: mediatek: mtk-socinfo: Add driver for getting chip information
In reply to Krzysztof KozlowskiHi Krzysztof,
Thank you for the comments. The fix regarding module_platform_driver will be provided in the next version of patches. Thanks a lot!
Best regards,
William
Quoted 28 lines · Krzysztof Kozlowski
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 1 line · William-tw Lin
Add driver for socinfo retrieval. This patch includes the
following:
Quoted 4 lines
1. mtk-socinfo driver for chip info retrieval
2. Related changes toMakefileandKconfigSigned-off-by William-tw Lin <[email protected]>...
drivers/soc/mediatek/mtk-socinfo.c line 182
Quoted 8 lines
drivers/soc/mediatek/mtk-socinfo.c new file +8
-0+static struct platform_driver mtk_socinfo = { +.probe = mtk_socinfo_probe, +.remove_new = mtk_socinfo_remove, +.driver = { +.name ="mtk-socinfo" , +}, +}; +builtin_platform_driver (mtk_socinfo);module platform driver, because this is tristate and because this should
be a module.Best regards,
Krzysztof
PATCH v3 3/3 nvmem: mtk-efuse: Modify driver for getting chip information
In reply to William-tw LinRetrieval of soc info is needed. This patch includes the following:
1. Register socinfo device in mtk-efuse.c
--- drivers/nvmem/mtk-efuse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/nvmem/mtk-efuse.c +10 -1
@@ -68,6 +68,7 @@ static int mtk_efuse_probe(struct platform_device *pdev)struct nvmem_config econfig = {};struct mtk_efuse_priv *priv;const struct mtk_efuse_pdata *pdata; +struct platform_device *socinfo; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -85,11 +86,19 @@ static int mtk_efuse_probe(struct platform_device *pdev) econfig.size =resource_size (res); econfig.priv = priv; econfig.dev = dev; + econfig.name ="mtk-efuse" ;if (pdata->uses_post_processing) econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info; nvmem =devm_nvmem_register (dev, &econfig); +if (IS_ERR (nvmem)) +return PTR_ERR (nvmem); -return PTR_ERR_OR_ZERO (nvmem); + socinfo =platform_device_register_data (&pdev->dev,"mtk-socinfo" , +PLATFORM_DEVID_AUTO ,NULL ,0 ); +if (IS_ERR (socinfo)) +dev_info (dev,"MediaTek SoC Information will be unavailable\n" ); + +return 0 ; }static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata = {
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v3 3/3] nvmem: mtk-efuse: Modify driver for getting chip information
Il 20/12/23 11:39, William-tw Lin ha scritto:
Quoted 3 lines
Retrieval of soc info is needed. This patch includes the following:
1. Register socinfo device inmtk-efuse.c
nvmem: mtk-efuse: Register MediaTek socinfo driver from efuse
The socinfo driver reads chip information from eFuses and does not need any devicetree node. Register it from mtk-efuse.
While at it, also add the name for this driver's nvmem_config.
^^^ that's a proper commit title and description :-)
Quoted 24 lines
Signed-off-by William-tw Lin <[email protected]>--- drivers/nvmem/mtk-efuse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/nvmem/mtk-efuse.c +2
-0@@ -68,6 +68,7 @@ static int mtk_efuse_probe(struct platform_device *pdev)struct nvmem_config econfig = {};struct mtk_efuse_priv *priv;const struct mtk_efuse_pdata *pdata; +struct platform_device *socinfo; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)@@ -85,11 +86,19 @@ static int mtk_efuse_probe(struct platform_device *pdev) econfig.size =resource_size (res); econfig.priv = priv; econfig.dev = dev; + econfig.name ="mtk-efuse" ;if (pdata->uses_post_processing) econfig.fixup_dt_cell_info = &mtk_efuse_fixup_dt_cell_info;
drivers/nvmem/mtk-efuse.c static int mtk_efuse_probe(struct platform_device *pdev) · line 100
Quoted 10 lines
drivers/nvmem/mtk-efuse.c +7
-1nvmem =devm_nvmem_register (dev, &econfig); +if (IS_ERR (nvmem)) +return PTR_ERR (nvmem); -return PTR_ERR_OR_ZERO (nvmem); + socinfo =platform_device_register_data (&pdev->dev,"mtk-socinfo" , +PLATFORM_DEVID_AUTO ,NULL ,0 ); +if (IS_ERR (socinfo)) +dev_info (dev,"MediaTek SoC Information will be unavailable\n" ); +
if (IS_ERR(socinfo)) dev_info(dev, "MediaTek SoC Information will be unavailable\n"); platform_set_drvdata(pdev, socinfo); return 0;
drivers/nvmem/mtk-efuse.c static int mtk_efuse_probe(struct platform_device *pdev) · line 104
Quoted 4 lines
drivers/nvmem/mtk-efuse.c +1
-0+return 0 ; }static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata = {
static void mtk_efuse_remove(struct platform_device *pdev)
{
struct platform_device *socinfo = platform_get_drvdata(pdev);
if (!IS_ERR_OR_NULL(socinfo))
platform_device_unregister(socinfo);
}static struct platform_driver mtk_efuse_driver = {
.probe = mtk_efuse_probe,
.remove_new = mtk_efuse_remove, <---- add this .driver = {
.name = "mediatek,efuse", .of_match_table = mtk_efuse_of_match,
}
};
After those additions, it's good for me.
Thanks,
Angelo