All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Lee <liguozhu@hisilicon.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: <linux-arm-kernel@lists.infradead.org>, <robh+dt@kernel.org>,
	<pawel.moll@arm.com>, <mark.rutland@arm.com>,
	<ijc+devicetree@hellion.org.uk>, <galak@codeaurora.org>,
	<catalin.marinas@arm.com>, <will.deacon@arm.com>,
	<Yisen.Zhuang@huawei.com>, <davem@davemloft.net>,
	<paul.gortmaker@windriver.com>, <dingtianhong@huawei.com>,
	<zhangfei.gao@linaro.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linuxarm@huawei.com>, <salil.mehta@huawei.com>,
	<huangdaode@hisilicon.com>, Kenneth Lee <liguozhu@huawei.com>
Subject: Re: [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support
Date: Mon, 17 Aug 2015 17:17:50 +0800	[thread overview]
Message-ID: <20150817091750.GA134983@Turing-Arch-b> (raw)
In-Reply-To: <2142879.tTtWetb0nc@wuerfel>

Thanks, Arnd, 

You are right. This is the same IP as hip04_mdio.c. We just mis-understand the
hardware design. We will merge them and re-submit the patches.

On Fri, Aug 14, 2015 at 10:57:28PM +0200, Arnd Bergmann wrote:
> On Friday 14 August 2015 18:30:20 Kenneth Lee wrote:
> 
> > +#define MDIO_BASE_ADDR                 0x403C0000
> 
> Does not belong in here (and is not used)
> 
> > +#define MDIO_COMMAND_REG               0x0
> > +#define MDIO_ADDR_REG                  0x4
> > +#define MDIO_WDATA_REG                 0x8
> > +#define MDIO_RDATA_REG                 0xc
> > +#define MDIO_STA_REG                   0x10
> 
> These look suspiciously similar to definitions from
> drivers/net/ethernet/hisilicon/hip04_mdio.c.
> 
> Could the hardware be related? If so, please try to share
> the common parts.
> 
> > +static inline void mdio_write_reg(void *base, u32 reg, u32 value)
> > +{
> > +       u8 __iomem *reg_addr = ACCESS_ONCE(base);
> > +
> > +       writel(value, reg_addr + reg);
> > +}
> > +
> > +#define MDIO_WRITE_REG(a, reg, value) \
> > +       mdio_write_reg((a)->vbase, (reg), (value))
> > 
> 
> Something seems wrong here: why do you have an ACCESS_ONCE() on a
> local variable? Doesn't this just make the code less efficient
> without providing lockless access to shared variables?
> 
> The types are inconsistent here, you should get a warning from
> running this through 'make C=1' because of the missing __iomem
> annotation of the pointer.
> 
> Also, why both a macro and an inline function? Just use an inline
> function.
> 
> 	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Kenneth Lee <liguozhu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: <linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	<robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	<pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	<mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	<galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	<catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	<will.deacon-5wv7dgnIgG8@public.gmane.org>,
	<Yisen.Zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	<paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>,
	<dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	<zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	<salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	<huangdaode-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>,
	Kenneth Lee <liguozhu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support
Date: Mon, 17 Aug 2015 17:17:50 +0800	[thread overview]
Message-ID: <20150817091750.GA134983@Turing-Arch-b> (raw)
In-Reply-To: <2142879.tTtWetb0nc@wuerfel>

Thanks, Arnd, 

You are right. This is the same IP as hip04_mdio.c. We just mis-understand the
hardware design. We will merge them and re-submit the patches.

On Fri, Aug 14, 2015 at 10:57:28PM +0200, Arnd Bergmann wrote:
> On Friday 14 August 2015 18:30:20 Kenneth Lee wrote:
> 
> > +#define MDIO_BASE_ADDR                 0x403C0000
> 
> Does not belong in here (and is not used)
> 
> > +#define MDIO_COMMAND_REG               0x0
> > +#define MDIO_ADDR_REG                  0x4
> > +#define MDIO_WDATA_REG                 0x8
> > +#define MDIO_RDATA_REG                 0xc
> > +#define MDIO_STA_REG                   0x10
> 
> These look suspiciously similar to definitions from
> drivers/net/ethernet/hisilicon/hip04_mdio.c.
> 
> Could the hardware be related? If so, please try to share
> the common parts.
> 
> > +static inline void mdio_write_reg(void *base, u32 reg, u32 value)
> > +{
> > +       u8 __iomem *reg_addr = ACCESS_ONCE(base);
> > +
> > +       writel(value, reg_addr + reg);
> > +}
> > +
> > +#define MDIO_WRITE_REG(a, reg, value) \
> > +       mdio_write_reg((a)->vbase, (reg), (value))
> > 
> 
> Something seems wrong here: why do you have an ACCESS_ONCE() on a
> local variable? Doesn't this just make the code less efficient
> without providing lockless access to shared variables?
> 
> The types are inconsistent here, you should get a warning from
> running this through 'make C=1' because of the missing __iomem
> annotation of the pointer.
> 
> Also, why both a macro and an inline function? Just use an inline
> function.
> 
> 	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Kenneth Lee <liguozhu-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	Yisen.Zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org,
	dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	huangdaode-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
	Kenneth Lee <liguozhu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support
Date: Mon, 17 Aug 2015 17:17:50 +0800	[thread overview]
Message-ID: <20150817091750.GA134983@Turing-Arch-b> (raw)
In-Reply-To: <2142879.tTtWetb0nc@wuerfel>

Thanks, Arnd, 

You are right. This is the same IP as hip04_mdio.c. We just mis-understand the
hardware design. We will merge them and re-submit the patches.

On Fri, Aug 14, 2015 at 10:57:28PM +0200, Arnd Bergmann wrote:
> On Friday 14 August 2015 18:30:20 Kenneth Lee wrote:
> 
> > +#define MDIO_BASE_ADDR                 0x403C0000
> 
> Does not belong in here (and is not used)
> 
> > +#define MDIO_COMMAND_REG               0x0
> > +#define MDIO_ADDR_REG                  0x4
> > +#define MDIO_WDATA_REG                 0x8
> > +#define MDIO_RDATA_REG                 0xc
> > +#define MDIO_STA_REG                   0x10
> 
> These look suspiciously similar to definitions from
> drivers/net/ethernet/hisilicon/hip04_mdio.c.
> 
> Could the hardware be related? If so, please try to share
> the common parts.
> 
> > +static inline void mdio_write_reg(void *base, u32 reg, u32 value)
> > +{
> > +       u8 __iomem *reg_addr = ACCESS_ONCE(base);
> > +
> > +       writel(value, reg_addr + reg);
> > +}
> > +
> > +#define MDIO_WRITE_REG(a, reg, value) \
> > +       mdio_write_reg((a)->vbase, (reg), (value))
> > 
> 
> Something seems wrong here: why do you have an ACCESS_ONCE() on a
> local variable? Doesn't this just make the code less efficient
> without providing lockless access to shared variables?
> 
> The types are inconsistent here, you should get a warning from
> running this through 'make C=1' because of the missing __iomem
> annotation of the pointer.
> 
> Also, why both a macro and an inline function? Just use an inline
> function.
> 
> 	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: liguozhu@hisilicon.com (Kenneth Lee)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support
Date: Mon, 17 Aug 2015 17:17:50 +0800	[thread overview]
Message-ID: <20150817091750.GA134983@Turing-Arch-b> (raw)
In-Reply-To: <2142879.tTtWetb0nc@wuerfel>

Thanks, Arnd, 

You are right. This is the same IP as hip04_mdio.c. We just mis-understand the
hardware design. We will merge them and re-submit the patches.

On Fri, Aug 14, 2015 at 10:57:28PM +0200, Arnd Bergmann wrote:
> On Friday 14 August 2015 18:30:20 Kenneth Lee wrote:
> 
> > +#define MDIO_BASE_ADDR                 0x403C0000
> 
> Does not belong in here (and is not used)
> 
> > +#define MDIO_COMMAND_REG               0x0
> > +#define MDIO_ADDR_REG                  0x4
> > +#define MDIO_WDATA_REG                 0x8
> > +#define MDIO_RDATA_REG                 0xc
> > +#define MDIO_STA_REG                   0x10
> 
> These look suspiciously similar to definitions from
> drivers/net/ethernet/hisilicon/hip04_mdio.c.
> 
> Could the hardware be related? If so, please try to share
> the common parts.
> 
> > +static inline void mdio_write_reg(void *base, u32 reg, u32 value)
> > +{
> > +       u8 __iomem *reg_addr = ACCESS_ONCE(base);
> > +
> > +       writel(value, reg_addr + reg);
> > +}
> > +
> > +#define MDIO_WRITE_REG(a, reg, value) \
> > +       mdio_write_reg((a)->vbase, (reg), (value))
> > 
> 
> Something seems wrong here: why do you have an ACCESS_ONCE() on a
> local variable? Doesn't this just make the code less efficient
> without providing lockless access to shared variables?
> 
> The types are inconsistent here, you should get a warning from
> running this through 'make C=1' because of the missing __iomem
> annotation of the pointer.
> 
> Also, why both a macro and an inline function? Just use an inline
> function.
> 
> 	Arnd

  reply	other threads:[~2015-08-17  9:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 10:30 [PATCH 0/5] net: Hisilicon Network Subsystem support Kenneth Lee
2015-08-14 10:30 ` Kenneth Lee
2015-08-14 10:30 ` Kenneth Lee
2015-08-14 10:30 ` Kenneth Lee
2015-08-14 10:30 ` [PATCH 1/5] net: add Hisilicon Network Subsystem support (config and documents) Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 20:49   ` Arnd Bergmann
2015-08-14 20:49     ` Arnd Bergmann
2015-08-17  1:28     ` 答复: " Liguozhu (Kenneth)
2015-08-17  1:28       ` Liguozhu (Kenneth)
2015-08-17  1:28       ` Liguozhu (Kenneth)
2015-08-21 14:00       ` Arnd Bergmann
2015-08-21 14:00         ` Arnd Bergmann
2015-08-21 14:00         ` Arnd Bergmann
2015-08-21 14:00         ` Arnd Bergmann
2015-08-27  9:50         ` Kenneth Lee
2015-08-27  9:50           ` Kenneth Lee
2015-08-27  9:50           ` Kenneth Lee
2015-08-14 10:30 ` [PATCH 2/5] net: add Hisilicon Network Subsystem hnae framework support Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-17 19:25   ` David Miller
2015-08-17 19:25     ` David Miller
2015-08-17 19:25     ` David Miller
2015-08-18  0:12   ` Alexey Klimov
2015-08-18  0:12     ` Alexey Klimov
2015-08-18  0:12     ` Alexey Klimov
2015-08-21  6:36     ` Kenneth Lee
2015-08-21  6:36       ` Kenneth Lee
2015-08-21  6:36       ` Kenneth Lee
2015-08-14 10:30 ` [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 20:57   ` Arnd Bergmann
2015-08-14 20:57     ` Arnd Bergmann
2015-08-17  9:17     ` Kenneth Lee [this message]
2015-08-17  9:17       ` Kenneth Lee
2015-08-17  9:17       ` Kenneth Lee
2015-08-17  9:17       ` Kenneth Lee
2015-08-21 14:01       ` Arnd Bergmann
2015-08-21 14:01         ` Arnd Bergmann
2015-08-21 14:01         ` Arnd Bergmann
2015-08-14 10:30 ` [PATCH 4/5] net: add Hisilicon Network Subsystem DSAF support Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 10:30 ` [PATCH 5/5] net: add Hisilicon Network Subsystem basic ethernet support Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee
2015-08-14 10:30   ` Kenneth Lee

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=20150817091750.GA134983@Turing-Arch-b \
    --to=liguozhu@hisilicon.com \
    --cc=Yisen.Zhuang@huawei.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dingtianhong@huawei.com \
    --cc=galak@codeaurora.org \
    --cc=huangdaode@hisilicon.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=liguozhu@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=will.deacon@arm.com \
    --cc=zhangfei.gao@linaro.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 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.