public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/7] usb: eth: introduce support for Moschip USB ethernet
Date: Mon, 24 Feb 2014 18:48:23 +0100	[thread overview]
Message-ID: <201402241848.23793.marex@denx.de> (raw)
In-Reply-To: <20140223201620.GH3327@book.gsilab.sittig.org>

On Sunday, February 23, 2014 at 09:16:20 PM, Gerhard Sittig wrote:
> On Mon, Feb 17, 2014 at 21:57 +0100, Marek Vasut wrote:
> > On Monday, February 17, 2014 at 08:35:23 PM, Gerhard Sittig wrote:
> > 
> > [...]
> > 
> > > +int mcs7830_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
> > > +			 struct eth_device *eth)
> > > +{
> > > +	debug("%s()\n", __func__);
> > > +	if (!eth) {
> > > +		debug("%s: missing parameter.\n", __func__);
> > > +		return 0;
> > > +	}
> > > +
> > > +	snprintf(eth->name, sizeof(eth->name), "%s%d",
> > > +		 MCS7830_BASE_NAME, mcs7830_iface_idx++);
> > > +	eth->init = mcs7830_init;
> > > +	eth->send = mcs7830_send;
> > > +	eth->recv = mcs7830_recv;
> > > +	eth->halt = mcs7830_halt;
> > > +	eth->write_hwaddr = mcs7830_write_mac;
> > > +	eth->priv = ss;
> > > +
> > > +	if (mcs7830_basic_reset(ss))
> > > +		return 0;
> > > +
> > > +#ifdef DEBUG
> > > +	(void)mcs7830_read_config(eth);
> > 
> > So this is debug-only function? You might want to put the entire function
> > into #ifdef DEBUG and then have an #else , where you define the function
> > as an empty one. The GCC shall handle the rest then as well, but you
> > won't have this ugly ifdef in a function.
> 
> I thought about this for a while.
> 
> Usually you'd expect separate control and status registers in
> hardware.  Where you write to control, and read back from status.
> Here those two aspects appear to have been mixed into one
> "config" register, and only in hindsight the reading became
> unused.  It's not so much an intent, but more of a byproduct.
> 
> During development (before the driver became operational), I
> could not tell whether I had to read-modify-write that config
> register.  Following the Linux driver's approach, currently only
> fixed values get written to the adapter and nothing gets read
> back.
> 
> Later the shadow in the driver's private data was introduced,
> such that "updates" neither need to read back what was written
> before.  And since neither multicast nor promiscuous mode may
> apply to bootloader operation, even those updates may never need
> not occur.
> 
> In the meantime I'd even tend to support the removal of the
> config register read routine.  Adding code "just in case" is a
> programmer's sin that may not be acceptable in U-Boot, since the
> cost outweights the benefit.
> 
> The current implementation (v3, with "maybe unused" decoration)
> might be acceptable.  But should feedback suggest that v4 is
> needed, I will remove that routine as well.

If you feel like removing the routine, then please remove it .

Best regards,
Marek Vasut

  reply	other threads:[~2014-02-24 17:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 19:35 [U-Boot] [PATCH v2 0/7] usb: eth: introduce Moschip MCS7830 driver Gerhard Sittig
2014-02-17 19:35 ` [U-Boot] [PATCH v2 1/7] include: move the BIT() macro into the common.h header file Gerhard Sittig
2014-02-17 21:01   ` Wolfgang Denk
2014-02-17 21:33     ` Gerhard Sittig
2014-02-17 19:35 ` [U-Boot] [PATCH v2 2/7] usb: eth: don't ifdef routine declarations in usb_ether.h Gerhard Sittig
2014-02-17 22:20   ` Simon Glass
2014-02-17 19:35 ` [U-Boot] [PATCH v2 3/7] usb: eth: introduce support for Moschip USB ethernet Gerhard Sittig
2014-02-17 20:57   ` Marek Vasut
2014-02-23 20:16     ` Gerhard Sittig
2014-02-24 17:48       ` Marek Vasut [this message]
2014-02-17 21:11   ` Wolfgang Denk
2014-02-17 21:22     ` Marek Vasut
2014-02-17 22:41       ` Wolfgang Denk
2014-02-18 11:24         ` Marek Vasut
2014-02-17 19:35 ` [U-Boot] [PATCH v2 4/7] config: alpha-sort USB ethernet items for Asix and SMSC Gerhard Sittig
2014-02-17 19:35 ` [U-Boot] [PATCH v2 5/7] config: enable Moschip USB ethernet support for several boards Gerhard Sittig
2014-02-17 19:35 ` [U-Boot] [PATCH v2 6/7] config: enable USB ethernet for taskit stamp9g20 Gerhard Sittig
2014-02-17 19:35 ` [U-Boot] [PATCH v2 7/7] usb: doc: update README.usb to list all USB ethernet options Gerhard Sittig

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=201402241848.23793.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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