netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivien Didelot <vivien.didelot@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Marek Behún" <marek.behun@nic.cz>,
	netdev@vger.kernel.org, "Florian Fainelli" <f.fainelli@gmail.com>,
	"Vladimir Oltean" <olteanv@gmail.com>
Subject: Re: [PATCH net-next 03/10] net: dsa: mv88e6xxx: move hidden registers operations in own file
Date: Thu, 22 Aug 2019 13:21:18 -0400	[thread overview]
Message-ID: <20190822132118.GB20024@t480s.localdomain> (raw)
In-Reply-To: <20190822131047.GE13020@lunn.ch>

Hi Marek, Andrew,

On Thu, 22 Aug 2019 15:10:47 +0200, Andrew Lunn <andrew@lunn.ch> wrote:
> On Thu, Aug 22, 2019 at 01:27:17AM +0200, Marek Behún wrote:
> > This patch moves the functions operating on the hidden debug registers
> > into it's own file, hidden.c.
> 
> Humm, actually...
> 
> These are in the port register space. Maybe it would be better to move
> them into port.c/port.h?
> 
> What you really need is that they have global scope within the driver
> so you can call them. So add the functions definitions to port.h.
> 
> Vivien, what do you think?

Andrew's correct. Code accessing internal registers in the mv88e6xxx driver
is split per internal SMI device. An internal SMI device is a "column" of 32
registers found in the datasheet, accessed via its dedicated internal SMI
device address, like ports, Global 1 (often 0x1b), Global 2 (often 0x1c),
and so on. Each internal SMI device has its unique header file, describing
all registers it contains. Then if the corresponding .c file has a portion
specific enough, it can be moved to its own .c file, like global1_atu.c,
global1_vtu.c, etc.

So keep these port registers definitions ordered in port.h with a naming as
closed to the documentation as possible, prefixing them with MV88E6XXX_PORT_
(or the model of reference if that is specific to a few models only), and
please describe the bits with an ordered 0x1234 format as well. The port.h
header is fortunately already a good example of how it should be done.

Then you can include it in a new port_hidden.c file, which implements
mv88e6xxx_port_hidden_* internal helpers (or mv88e6789_port_ if specific to a
model again) to access these hidden port registers, and use them as convenience
in chip.c:mv88e6xxx_errata_setup() or wherever a feature is implemented.


Thanks a lot,

	Vivien

  reply	other threads:[~2019-08-22 17:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 23:27 [PATCH net-next 00/10] net: dsa: mv88e6xxx: Peridot/Topaz SERDES changes Marek Behún
2019-08-21 23:27 ` [PATCH net-next 01/10] net: dsa: mv88e6xxx: support 2500base-x in SGMII IRQ handler Marek Behún
2019-08-22  3:25   ` David Miller
2019-08-22  3:33     ` Marek Behún
2019-08-21 23:27 ` [PATCH net-next 02/10] net: dsa: mv88e6xxx: remove extra newline Marek Behún
2019-08-22 12:55   ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 03/10] net: dsa: mv88e6xxx: move hidden registers operations in own file Marek Behún
2019-08-22 13:04   ` Andrew Lunn
2019-08-22 13:10   ` Andrew Lunn
2019-08-22 17:21     ` Vivien Didelot [this message]
2019-08-21 23:27 ` [PATCH net-next 04/10] net: dsa: mv88e6xxx: prefix hidden register macro names with MV88E6XXX_ Marek Behún
2019-08-22 13:12   ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 05/10] net: dsa: mv88e6xxx: create chip->info->ops->serdes_get_lane method Marek Behún
2019-08-23  1:39   ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 06/10] net: dsa: mv88e6xxx: add serdes_get_lane method for Topaz family Marek Behún
2019-08-23  1:40   ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 07/10] net: dsa: mv88e6xxx: rename port cmode macro Marek Behún
2019-08-23  1:41   ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 08/10] net: dsa: mv88e6xxx: simplify SERDES code for Topaz and Peridot Marek Behún
2019-08-22  3:26   ` David Miller
2019-08-21 23:27 ` [PATCH net-next 09/10] net: dsa: mv88e6xxx: support Block Address setting in hidden registers Marek Behún
2019-08-21 23:27 ` [PATCH net-next 10/10] net: dsa: mv88e6xxx: fully support SERDES on Topaz family Marek Behún

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=20190822132118.GB20024@t480s.localdomain \
    --to=vivien.didelot@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=marek.behun@nic.cz \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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;
as well as URLs for NNTP newsgroup(s).