From: Krzysztof Kozlowski <krzk@kernel.org>
To: andi.shyti@kernel.org, linux-i2c@vger.kernel.org,
Hans Hu <HansHu-oc@zhaoxin.com>
Cc: cobechen@zhaoxin.com, TonyWWang@zhaoxin.com
Subject: Re: [PATCH v3] i2c: add support for Zhaoxin I2C controller
Date: Wed, 7 Jun 2023 15:55:55 +0200 [thread overview]
Message-ID: <4c2d8675-5cc0-ec6e-f352-b032600b9469@kernel.org> (raw)
In-Reply-To: <87c0be06-0ac4-5d34-671c-5668739bdb8b@zhaoxin.com>
Your email is corrupted. It was sent with "Reply to:
0489dec4-cd7a-4f50-e811-d4798d514fb4@kernel.org":
Reply-To: <0489dec4-cd7a-4f50-e811-d4798d514fb4@kernel.org>
In-Reply-To: <0489dec4-cd7a-4f50-e811-d4798d514fb4@kernel.org>
On 07/06/2023 14:33, Hans Hu wrote:
>>> +
>>> +static int zxi2c_parse_resources(struct zxi2c *i2c)
>>> +{
>>> + struct platform_device *pdev = to_platform_device(i2c->dev);
>>> + struct resource *res;
>>> +
>>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> + i2c->regs = devm_ioremap_resource(&pdev->dev, res);
>> There is a helper for these two.
>
>
> I want to use the lower 8 bits of the physical address to
> distinguish the controller's index, to set reset_bitmask.
OK
>
>
>>> + if (IS_ERR(i2c->regs))
>>> + return dev_err_probe(&pdev->dev, PTR_ERR(i2c->regs),
>>> + "get base addr failed\n");
>>> +
>>> + if (res->start & 0x20)
>>> + i2c->reset_bitmask = BIT(4);
>>> + else
>>> + i2c->reset_bitmask = BIT(5);
>>> +
>>> + i2c->irq = platform_get_irq(pdev, 0);
>>> + if (i2c->irq < 0)
>>> + return dev_err_probe(&pdev->dev, i2c->irq,
>>> + "get irq failed\n");
>>> +
>>> + zxi2c_get_bus_speed(i2c);
>>> +
>>> + i2c->hrv = get_reversion(i2c->regs);
>>> +
>>> + i2c->dynamic = get_dynamic_clock(i2c->regs);
>>> + set_dynamic_clock(i2c->regs, i2c->dynamic);
>>> +
>>> + i2c->fstp = get_fstp_value(i2c->regs);
>>> + zxi2c_set_bus_speed(i2c);
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +static int zxi2c_probe(struct platform_device *pdev)
>>> +{
>>> + int error;
>>> + struct zxi2c *i2c;
>>> + struct pci_dev *pci;
>>> + struct device *dev;
>>> +
>>> + /* make sure this is zhaoxin platform */
>> Why? How can you match to different platform?
>>
>
> In case a platform device named "IIC1D17" is also reported on
> non-zhaoxin platform, this driver may also be registered successfully,
> even if it shouldn't. In theory.
Why shouldn't it be registered on other platform? It's the same device,
isn't it?
Best regards,
Krzysztof
next prev parent reply other threads:[~2023-06-07 13:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 5:01 [PATCH v3] i2c: add support for Zhaoxin I2C controller Hans Hu
2023-06-05 14:56 ` Andi Shyti
2023-06-06 6:04 ` Hans Hu
2023-06-06 8:34 ` Krzysztof Kozlowski
2023-06-07 12:33 ` Hans Hu
2023-06-07 13:55 ` Krzysztof Kozlowski [this message]
2023-06-08 3:08 ` Hans Hu
2023-06-08 6:37 ` Krzysztof Kozlowski
2023-06-08 8:50 ` Hans Hu
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=4c2d8675-5cc0-ec6e-f352-b032600b9469@kernel.org \
--to=krzk@kernel.org \
--cc=HansHu-oc@zhaoxin.com \
--cc=TonyWWang@zhaoxin.com \
--cc=andi.shyti@kernel.org \
--cc=cobechen@zhaoxin.com \
--cc=linux-i2c@vger.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: 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