From: qianfan <qianfanguijin@163.com>
To: Samuel Holland <samuel@sholland.org>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: question: How to toggle gpio when init_early
Date: Thu, 5 May 2022 08:23:53 +0800 [thread overview]
Message-ID: <ee4fe3db-e45b-aa19-a708-1feda62e7e17@163.com> (raw)
In-Reply-To: <1915b311-05f5-f650-262a-24cbb5ff69e0@sholland.org>
在 2022/5/3 7:36, Samuel Holland 写道:
> On 4/28/22 11:30 PM, qianfan wrote:
>> Hi everyone:
>>
>> I want toggle a gpio when machine_desc->init_early, but failed.
>>
>> The gpio is pd24, and I searched the datasheet of r40, the address of PD_DAT
>> register
>> is 0x01c20800 + 3 * 0x24 + 0x10. So I modify this register by __raw_readl and
>> __raw_writel.
>> The system can't startup when I adding those code.
>>
>> Seems the physical address can't touch due to mmu.
>> Can I get some advice?
> You need to call ioremap() to get a virtual address for the MMIO region. But you
I had searched the other mach, some of others has a map_io callback, which
create mmu rules by iotable_init. Copy that idea, I can toggle the gpio
pin.
> really should be using the GPIO API and not raw MMIO. And you really should be
> using devicetree and not touching the machine description. For example, if this
> is for a GPIO-connected watchdog or LED or regulator, Linux already has
> devicetree drivers for these.
Yes, I had enabled the gpio-wdt driver but the sunxi pinctrl/gpio driver
are registed to later. I had sniffer the hardware signals and found it
takes about 3 seconds when gpio-wdt driver ready after u-boot.
sunxi-pinctrl driver are deferred probe and ready when late_init.
Next is the console logs:
[ 0.265181] init_late
[ 0.293427] sun4i-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 1.760130] gpio_wdt start
So I want add something in machine_desc.
Seems there doesn't has a better way touching gpio watchdog before gpio-wdt
ready.
>
> Regards,
> Samuel
prev parent reply other threads:[~2022-05-05 0:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 4:30 question: How to toggle gpio when init_early qianfan
2022-05-02 23:36 ` Samuel Holland
2022-05-05 0:23 ` qianfan [this message]
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=ee4fe3db-e45b-aa19-a708-1feda62e7e17@163.com \
--to=qianfanguijin@163.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=samuel@sholland.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