From: "pankaj.dubey" <pankaj.dubey@samsung.com> To: Marek Szyprowski <m.szyprowski@samsung.com>, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: krzk@kernel.org, arnd@arndb.de, kgene@kernel.org, m.reichl@fivetechno.de, a.hajda@samsung.com, cwchoi00@gmail.com, javier@osg.samsung.com, Grant Likely <grant.likely@linaro.org>, Rob Herring <robh+dt@kernel.org>, Linus Walleij <linus.walleij@linaro.org> Subject: Re: [PATCH v9 04/12] soc: samsung: add exynos chipid driver support Date: Mon, 3 Apr 2017 15:05:16 +0530 [thread overview] Message-ID: <f5b08b44-0bb2-e1a3-d834-1640cd37d066@samsung.com> (raw) In-Reply-To: <e054813c-7566-61cc-21cb-733aadd1a9c7@samsung.com> Hi Marek, On Monday 03 April 2017 01:27 PM, Marek Szyprowski wrote: > Hi Pankaj > > On 2017-03-30 15:16, Pankaj Dubey wrote: >> Exynos SoCs have Chipid, for identification of product IDs and SoC >> revisions. This patch intends to provide initialization code for all >> these functionalities, at the same time it provides some sysfs entries >> for accessing these information to user-space. >> >> This driver uses existing binding for exynos-chipid. snip >> + >> +static const struct exynos_soc_id { >> + const char *name; >> + unsigned int id; >> + unsigned int mask; >> +} soc_ids[] = { >> + { "EXYNOS3250", 0xE3472000, 0xFFFFF000 }, >> + { "EXYNOS4210", 0x43210000, 0xFFFFF000 }, > > You have once again changed the mask for Exynos4 SoCs, so please add > following line to the above array: Yes, this time I cross-verified from the UM of respective SoC's and added it. > > { "EXYNOS4210", 0x43200000, 0xFFFFF000 }, /* EVT0 revision */ > > Otherwise Exynos C210 (4210 EVT0) is not properly detected: > > soc soc0: Exynos: CPU[UNKNOWN] PRO_ID[0x43200200] REV[0x0] Detected Thanks for testing, I will add support for this. > >> + { "EXYNOS4212", 0x43220000, 0xFFFFF000 }, >> + { "EXYNOS4412", 0xE4412000, 0xFFFFF000 }, >> + { "EXYNOS5250", 0x43520000, 0xFFFFF000 }, >> + { "EXYNOS5260", 0xE5260000, 0xFFFFF000 }, >> + { "EXYNOS5410", 0xE5410000, 0xFFFFF000 }, >> + { "EXYNOS5420", 0xE5420000, 0xFFFFF000 }, >> + { "EXYNOS5440", 0xE5440000, 0xFFFFF000 }, >> + { "EXYNOS5800", 0xE5422000, 0xFFFFF000 }, >> + { "EXYNOS7420", 0xE7420000, 0xFFFFF000 }, >> + { "EXYNOS5433", 0xE5433000, 0xFFFFF000 }, >> +}; > > Now the mask is same for all revisions, so you can remove it from the above > array and directly use some kind of define in the code. Yes, I also observed, but somehow I missed to update this part. I will change this in next version. > >> + >> +static const char * __init product_id_to_soc_id(unsigned int product_id) >> +{ >> + int i; >> + >> + for (i = 0; i < ARRAY_SIZE(soc_ids); i++) >> + if ((product_id & soc_ids[i].mask) == soc_ids[i].id) >> + return soc_ids[i].name; >> + return "UNKNOWN"; >> +} >> + >> +int __init exynos_chipid_early_init(void) >> +{ >> + struct soc_device_attribute *soc_dev_attr; >> + void __iomem *exynos_chipid_base; >> + struct soc_device *soc_dev; >> + struct device_node *root; >> + struct device_node *np; >> + struct device *dev; >> + u32 product_id; >> + u32 revision; >> + >> + /* look up for chipid node */ >> + np = of_find_compatible_node(NULL, NULL, >> "samsung,exynos4210-chipid"); >> + if (!np) >> + return -ENODEV; >> + >> + exynos_chipid_base = of_iomap(np, 0); >> + of_node_put(np); >> + >> + if (!exynos_chipid_base) { >> + pr_err("%s: failed to map chipid\n", np->name); >> + return -ENOMEM; >> + } >> + >> + product_id = readl_relaxed(exynos_chipid_base); >> + revision = product_id & EXYNOS_REV_MASK; >> + iounmap(exynos_chipid_base); >> + >> + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); >> + if (!soc_dev_attr) >> + return -ENODEV; >> + >> + soc_dev_attr->family = "Samsung Exynos"; >> + >> + root = of_find_node_by_path("/"); >> + of_property_read_string(root, "model", &soc_dev_attr->machine); >> + of_node_put(root); >> + >> + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x", revision); >> + soc_dev_attr->soc_id = product_id_to_soc_id(product_id); >> + >> + soc_dev = soc_device_register(soc_dev_attr); >> + if (IS_ERR(soc_dev)) { >> + kfree(soc_dev_attr->revision); >> + kfree_const(soc_dev_attr->soc_id); >> + kfree(soc_dev_attr); >> + return PTR_ERR(soc_dev); >> + } >> + dev = soc_device_to_device(soc_dev); >> + >> + dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", >> + soc_dev_attr->soc_id, product_id, revision); >> + >> + return 0; >> +} >> +early_initcall(exynos_chipid_early_init); > > Best regards Thanks, Pankaj Dubey
WARNING: multiple messages have this Message-ID (diff)
From: pankaj.dubey@samsung.com (pankaj.dubey) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 04/12] soc: samsung: add exynos chipid driver support Date: Mon, 03 Apr 2017 15:05:16 +0530 [thread overview] Message-ID: <f5b08b44-0bb2-e1a3-d834-1640cd37d066@samsung.com> (raw) In-Reply-To: <e054813c-7566-61cc-21cb-733aadd1a9c7@samsung.com> Hi Marek, On Monday 03 April 2017 01:27 PM, Marek Szyprowski wrote: > Hi Pankaj > > On 2017-03-30 15:16, Pankaj Dubey wrote: >> Exynos SoCs have Chipid, for identification of product IDs and SoC >> revisions. This patch intends to provide initialization code for all >> these functionalities, at the same time it provides some sysfs entries >> for accessing these information to user-space. >> >> This driver uses existing binding for exynos-chipid. snip >> + >> +static const struct exynos_soc_id { >> + const char *name; >> + unsigned int id; >> + unsigned int mask; >> +} soc_ids[] = { >> + { "EXYNOS3250", 0xE3472000, 0xFFFFF000 }, >> + { "EXYNOS4210", 0x43210000, 0xFFFFF000 }, > > You have once again changed the mask for Exynos4 SoCs, so please add > following line to the above array: Yes, this time I cross-verified from the UM of respective SoC's and added it. > > { "EXYNOS4210", 0x43200000, 0xFFFFF000 }, /* EVT0 revision */ > > Otherwise Exynos C210 (4210 EVT0) is not properly detected: > > soc soc0: Exynos: CPU[UNKNOWN] PRO_ID[0x43200200] REV[0x0] Detected Thanks for testing, I will add support for this. > >> + { "EXYNOS4212", 0x43220000, 0xFFFFF000 }, >> + { "EXYNOS4412", 0xE4412000, 0xFFFFF000 }, >> + { "EXYNOS5250", 0x43520000, 0xFFFFF000 }, >> + { "EXYNOS5260", 0xE5260000, 0xFFFFF000 }, >> + { "EXYNOS5410", 0xE5410000, 0xFFFFF000 }, >> + { "EXYNOS5420", 0xE5420000, 0xFFFFF000 }, >> + { "EXYNOS5440", 0xE5440000, 0xFFFFF000 }, >> + { "EXYNOS5800", 0xE5422000, 0xFFFFF000 }, >> + { "EXYNOS7420", 0xE7420000, 0xFFFFF000 }, >> + { "EXYNOS5433", 0xE5433000, 0xFFFFF000 }, >> +}; > > Now the mask is same for all revisions, so you can remove it from the above > array and directly use some kind of define in the code. Yes, I also observed, but somehow I missed to update this part. I will change this in next version. > >> + >> +static const char * __init product_id_to_soc_id(unsigned int product_id) >> +{ >> + int i; >> + >> + for (i = 0; i < ARRAY_SIZE(soc_ids); i++) >> + if ((product_id & soc_ids[i].mask) == soc_ids[i].id) >> + return soc_ids[i].name; >> + return "UNKNOWN"; >> +} >> + >> +int __init exynos_chipid_early_init(void) >> +{ >> + struct soc_device_attribute *soc_dev_attr; >> + void __iomem *exynos_chipid_base; >> + struct soc_device *soc_dev; >> + struct device_node *root; >> + struct device_node *np; >> + struct device *dev; >> + u32 product_id; >> + u32 revision; >> + >> + /* look up for chipid node */ >> + np = of_find_compatible_node(NULL, NULL, >> "samsung,exynos4210-chipid"); >> + if (!np) >> + return -ENODEV; >> + >> + exynos_chipid_base = of_iomap(np, 0); >> + of_node_put(np); >> + >> + if (!exynos_chipid_base) { >> + pr_err("%s: failed to map chipid\n", np->name); >> + return -ENOMEM; >> + } >> + >> + product_id = readl_relaxed(exynos_chipid_base); >> + revision = product_id & EXYNOS_REV_MASK; >> + iounmap(exynos_chipid_base); >> + >> + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); >> + if (!soc_dev_attr) >> + return -ENODEV; >> + >> + soc_dev_attr->family = "Samsung Exynos"; >> + >> + root = of_find_node_by_path("/"); >> + of_property_read_string(root, "model", &soc_dev_attr->machine); >> + of_node_put(root); >> + >> + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%x", revision); >> + soc_dev_attr->soc_id = product_id_to_soc_id(product_id); >> + >> + soc_dev = soc_device_register(soc_dev_attr); >> + if (IS_ERR(soc_dev)) { >> + kfree(soc_dev_attr->revision); >> + kfree_const(soc_dev_attr->soc_id); >> + kfree(soc_dev_attr); >> + return PTR_ERR(soc_dev); >> + } >> + dev = soc_device_to_device(soc_dev); >> + >> + dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", >> + soc_dev_attr->soc_id, product_id, revision); >> + >> + return 0; >> +} >> +early_initcall(exynos_chipid_early_init); > > Best regards Thanks, Pankaj Dubey
next prev parent reply other threads:[~2017-04-03 9:32 UTC|newest] Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20170330131417epcas1p48a7f41b90177294b7918ecf31df130d1@epcas1p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 00/12] Introducing Exynos ChipId driver Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey [not found] ` <CGME20170330131419epcas5p4ac36250d3a9225643e327e60f47956c2@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 01/12] ARM: EXYNOS: refactor firmware specific routines Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 7:45 ` Krzysztof Kozlowski 2017-04-07 7:45 ` Krzysztof Kozlowski 2017-04-07 8:06 ` pankaj.dubey 2017-04-07 8:06 ` pankaj.dubey [not found] ` <CGME20170330131421epcas5p40b0ad9c1003d3ab807667ae2b05d25bc@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 02/12] ARM: EXYNOS: remove usage of soc_is_exynosMMMM from pm.c Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 8:24 ` Krzysztof Kozlowski 2017-04-07 8:24 ` Krzysztof Kozlowski 2017-04-07 12:12 ` pankaj.dubey 2017-04-07 12:12 ` pankaj.dubey 2017-04-07 12:24 ` Krzysztof Kozlowski 2017-04-07 12:24 ` Krzysztof Kozlowski 2017-04-07 14:13 ` pankaj.dubey 2017-04-07 14:13 ` pankaj.dubey [not found] ` <CGME20170330131424epcas5p4fccfab06e5d77d70d09c3835c3332ee5@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 03/12] ARM: EXYNOS: remove secondary startup initialization from smp_prepare_cpus Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 8:31 ` Krzysztof Kozlowski 2017-04-07 8:31 ` Krzysztof Kozlowski 2017-04-07 12:15 ` pankaj.dubey 2017-04-07 12:15 ` pankaj.dubey [not found] ` <CGME20170330131427epcas5p4c3d238022dc75694ad3baa8a1018ea04@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 04/12] soc: samsung: add exynos chipid driver support Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-03-30 13:50 ` Arnd Bergmann 2017-03-30 13:50 ` Arnd Bergmann 2017-03-31 5:36 ` pankaj.dubey 2017-03-31 5:36 ` pankaj.dubey 2017-03-31 8:09 ` Arnd Bergmann 2017-03-31 8:09 ` Arnd Bergmann 2017-04-03 9:21 ` pankaj.dubey 2017-04-03 9:21 ` pankaj.dubey 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 9:35 ` pankaj.dubey [this message] 2017-04-03 9:35 ` pankaj.dubey 2017-04-07 9:13 ` Krzysztof Kozlowski 2017-04-07 9:13 ` Krzysztof Kozlowski 2017-04-07 12:18 ` pankaj.dubey 2017-04-07 12:18 ` pankaj.dubey [not found] ` <CGME20170330131429epcas5p414565c5a9f2c38f3f6660b72f9ad68a2@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 05/12] ARM: EXYNOS: enable exynos_chipid for ARCH_EXYNOS Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey [not found] ` <CGME20170330131431epcas5p447a730e1bb194162f262a819ae665efb@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 06/12] ARM64: " Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-03-30 13:51 ` Arnd Bergmann 2017-03-30 13:51 ` Arnd Bergmann [not found] ` <CGME20170330131434epcas1p4e42fe06bae3456c39e0f93a2f8ae4bc0@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 07/12] ARM: EXYNOS: introduce soc specific pm ops Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-03-30 14:03 ` Arnd Bergmann 2017-03-30 14:03 ` Arnd Bergmann 2017-04-07 9:24 ` Krzysztof Kozlowski 2017-04-07 9:24 ` Krzysztof Kozlowski 2017-04-07 14:11 ` pankaj.dubey 2017-04-07 14:11 ` pankaj.dubey 2017-04-07 14:57 ` Krzysztof Kozlowski 2017-04-07 14:57 ` Krzysztof Kozlowski [not found] ` <CGME20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} ops to exynos_s2r_data Pankaj Dubey 2017-03-30 13:17 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " Pankaj Dubey 2017-04-07 10:32 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} " Krzysztof Kozlowski 2017-04-07 10:32 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " Krzysztof Kozlowski 2017-04-07 13:52 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} " pankaj.dubey 2017-04-07 13:52 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " pankaj.dubey [not found] ` <CGME20170330131438epcas1p459ce93da17fcd05249eddaef18d5021e@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 09/12] ARM: EXYNOS: introduce exynos_cpu_info struct Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 9:54 ` pankaj.dubey 2017-04-03 9:54 ` pankaj.dubey 2017-04-07 10:41 ` Krzysztof Kozlowski 2017-04-07 10:41 ` Krzysztof Kozlowski 2017-04-07 14:00 ` pankaj.dubey 2017-04-07 14:00 ` pankaj.dubey 2017-04-07 14:18 ` Krzysztof Kozlowski 2017-04-07 14:18 ` Krzysztof Kozlowski 2017-04-07 10:47 ` Krzysztof Kozlowski 2017-04-07 10:47 ` Krzysztof Kozlowski [not found] ` <CGME20170330131440epcas1p4f27192272761aa593b6cf083453e8adc@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down,up} to per SoC struct exynos_cpu_info Pankaj Dubey 2017-03-30 13:17 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down, up} " Pankaj Dubey 2017-04-07 12:04 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down,up} " Krzysztof Kozlowski 2017-04-07 12:04 ` Krzysztof Kozlowski 2017-04-07 14:12 ` pankaj.dubey 2017-04-07 14:12 ` pankaj.dubey [not found] ` <CGME20170330131442epcas5p4f2be72cb3ec506847d8e832675e682c4@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 11/12] ARM: EXYNOS: move cpu_restart as a SoC specific hook to exynos_cpu_info Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-04-07 12:23 ` Krzysztof Kozlowski 2017-04-07 12:23 ` Krzysztof Kozlowski [not found] ` <CGME20170330131444epcas5p45051cf7e6ec7a993c2c9f84254b89a19@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 12/12] ARM: EXYNOS: refactor of mach-exynos to use chipid information Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-03-30 14:01 ` Arnd Bergmann 2017-03-30 14:01 ` Arnd Bergmann 2017-03-31 6:01 ` pankaj.dubey 2017-03-31 6:01 ` pankaj.dubey 2017-03-31 8:22 ` Arnd Bergmann 2017-03-31 8:22 ` Arnd Bergmann 2017-04-03 9:25 ` pankaj.dubey 2017-04-03 9:25 ` pankaj.dubey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=f5b08b44-0bb2-e1a3-d834-1640cd37d066@samsung.com \ --to=pankaj.dubey@samsung.com \ --cc=a.hajda@samsung.com \ --cc=arnd@arndb.de \ --cc=cwchoi00@gmail.com \ --cc=grant.likely@linaro.org \ --cc=javier@osg.samsung.com \ --cc=kgene@kernel.org \ --cc=krzk@kernel.org \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=m.reichl@fivetechno.de \ --cc=m.szyprowski@samsung.com \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.