From: Arnd Bergmann <arnd@arndb.de>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Hanjun Guo <hanjun.guo@linaro.org>,
linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 4/4] mfd: syscon: add ACPI support
Date: Wed, 02 Dec 2015 11:44:51 +0100 [thread overview]
Message-ID: <2299982.06P4iKpkWk@wuerfel> (raw)
In-Reply-To: <1449047368-5768-5-git-send-email-wangkefeng.wang@huawei.com>
On Wednesday 02 December 2015 17:09:28 Kefeng Wang wrote:
> This enables syscon with ACPI support.
> syscon_regmap_lookup_by_dev_property() function was added. With helper
> device_get_reference_node() and acpi_dev_find_plat_dev(), it can be used
> in both DT and ACPI.
>
> The device driver can obtain syscon using _DSD method in DSDT, an example
> is shown below.
>
> Device(CTL0) {
> Name(_HID, "HISI0061")
> Name(_CRS, ResourceTemplate() {
> Memory32Fixed(ReadWrite, 0x80000000, 0x10000)
> })
> }
>
> Device(DEV0) {
> Name(_HID, "HISI00B1")
> Name(_CRS, ResourceTemplate() {
> Memory32Fixed(ReadWrite, 0x8c030000, 0x10000)
> Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive){ 192 }
> })
>
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"syscon",Package() {\_SB.CTL0} }
> }
> })
> }
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
This sounds like a bad idea:
syscon is basically a hack to let us access register that the SoC designer
couldn't fit in anywhere sane. We need something like this with devicetree
because we decided not to have any interpreted bytecode to do this behind
our back.
With ACPI, the same thing is done with AML, which is actually nicer than
syscon (once you have to deal with all the problems introduced by AML).
Use that instead.
> + pdev = acpi_dev_find_plat_dev(adev);
> + if (!pdev)
> + return ERR_PTR(-ENODEV);
> + syscon = platform_get_drvdata(pdev);
This still requires the syscon device to be probed first, which is
something we shouldn't really need any more.
A lot of syscon users depend on the regmap to be available before
device drivers are loaded, so we have changed the code to just look up
the device_node that is already present and ignore the device.
Once clps711x has been converted to DT, I think we can rip out the
syscon_regmap_lookup_by_pdevname() interface and separate the syscon
regmap handling from the device handling that we only really need
for debugfs.
> @@ -216,9 +259,16 @@ static const struct platform_device_id syscon_ids[] = {
> { }
> };
>
> +static const struct acpi_device_id syscon_acpi_match[] = {
> + { "HISI0061", 0 }, /* better to use generic ACPI ID */
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, syscon_acpi_match);
> +
> static struct platform_driver syscon_driver = {
> .driver = {
> .name = "syscon",
> + .acpi_match_table = ACPI_PTR(syscon_acpi_match),
> },
> .probe = syscon_probe,
> .id_table = syscon_ids,
We certainly don't want to list specific devices, so the other problem
aside, we wouldn't merge it until there is an official ACPI way to
specify "random crap register areas" that does not depend on a vendor
specific ID.
Arnd
next prev parent reply other threads:[~2015-12-02 10:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 9:09 [RFC PATCH 0/4] add ACPI support for syscon Kefeng Wang
2015-12-02 9:09 ` [RFC PATCH 1/4] acpi: property: Introduce helper acpi_dev_get_reference_device() Kefeng Wang
2015-12-02 9:20 ` Mika Westerberg
2015-12-02 9:09 ` [RFC PATCH 2/4] device property: Introduce helper device_get_reference_node() Kefeng Wang
2015-12-03 15:28 ` Russell King - ARM Linux
2015-12-03 23:29 ` Rafael J. Wysocki
2015-12-04 1:02 ` Rafael J. Wysocki
2015-12-11 12:35 ` Lorenzo Pieralisi
2015-12-02 9:09 ` [RFC PATCH 3/4] ACPI/platform: Introduce helper acpi_dev_find_plat_dev() Kefeng Wang
2015-12-02 9:09 ` [RFC PATCH 4/4] mfd: syscon: add ACPI support Kefeng Wang
2015-12-02 10:44 ` Arnd Bergmann [this message]
2015-12-03 10:41 ` Graeme Gregory
2015-12-03 13:01 ` Kefeng Wang
2015-12-03 15:56 ` Lorenzo Pieralisi
2015-12-07 6:15 ` Kefeng Wang
2015-12-07 8:47 ` Arnd Bergmann
2015-12-11 10:35 ` Zhangfei Gao
2015-12-11 10:51 ` Arnd Bergmann
2015-12-11 10:59 ` Graeme Gregory
2015-12-11 12:23 ` Hanjun Guo
2015-12-02 10:50 ` [RFC PATCH 0/4] add ACPI support for syscon Lorenzo Pieralisi
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=2299982.06P4iKpkWk@wuerfel \
--to=arnd@arndb.de \
--cc=hanjun.guo@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=rjw@rjwysocki.net \
--cc=wangkefeng.wang@huawei.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox