public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Yinbo Zhu <zhuyinbo@loongson.cn>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhanghongchen <zhanghongchen@loongson.cn>
Subject: Re: [PATCH v8 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support
Date: Fri, 11 Nov 2022 13:23:48 +0200	[thread overview]
Message-ID: <Y24wxDsrLf1ACQsG@smile.fi.intel.com> (raw)
In-Reply-To: <1c8b897b-9dca-cb36-3281-e98ab29e0921@loongson.cn>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1555 bytes --]

On Fri, Nov 11, 2022 at 11:53:37AM +0800, Yinbo Zhu wrote:
> ÔÚ 2022/11/9 ÏÂÎç11:40, Andy Shevchenko дµÀ:
> > On Wed, Nov 09, 2022 at 02:11:21PM +0800, Yinbo Zhu wrote:

...

> > > +static const unsigned int lio_pins[]    = {};
> > > +static const unsigned int uart2_pins[]  = {};
> > > +static const unsigned int uart1_pins[]  = {};
> > > +static const unsigned int camera_pins[] = {};
> > > +static const unsigned int dvo1_pins[]   = {};
> > > +static const unsigned int dvo0_pins[]   = {};
> > 
> > No sure what this means.
> There are some fuzzy reuse relationships on loongson2, e.g., lio can be
> reused as gpio, which is one of the reserved gpios but the manual not
> indicates this gpio index.

The rule of thumb is to avoid putting something you are not able to test.

...

> > > +	unsigned long reg = (unsigned long)pctrl->reg_base +
> > > +				loongson2_pmx_groups[group_num].reg;
> > 
> > Why casting?!
> There are some registers that determine the pin reuse relationship. For
> example, register A determines the sdio reuse relationship, and register
> A+offset determines the uart reuse relationship

I'm asking about something different. Why do you need casting for iomem offset?

...

> > > +	val = readl((void *)reg);
> > 
> > Ouch.

^^^ You see, this is a real issue with code, without fix which it's no go.

...

> > > +	writel(val, (void *)reg);
> > 
> > Ouch!
> I will keep writel/readl.

Yes, but you need to take care about annotations of the addresses (__iomem)
and remove ugly castings.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2022-11-11 11:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  6:11 [PATCH v8 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support Yinbo Zhu
2022-11-09  6:11 ` [PATCH v8 2/2] dt-bindings: pinctrl: add loongson-2 pinctrl Yinbo Zhu
2022-11-09  6:42 ` [PATCH v8 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support Yinbo Zhu
2022-11-09  8:30   ` Linus Walleij
2022-11-09 15:01     ` Andy Shevchenko
2022-11-09 15:41       ` Andy Shevchenko
2022-11-10  8:17       ` Linus Walleij
2022-11-11  3:59         ` Yinbo Zhu
2022-11-09 15:40 ` Andy Shevchenko
2022-11-11  3:53   ` Yinbo Zhu
2022-11-11 11:23     ` Andy Shevchenko [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=Y24wxDsrLf1ACQsG@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=zhanghongchen@loongson.cn \
    --cc=zhuyinbo@loongson.cn \
    /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