From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] document network driver framework
Date: Thu, 23 Jul 2009 23:49:46 +0200 [thread overview]
Message-ID: <20090723214946.GE9480@game.jcrosoft.org> (raw)
In-Reply-To: <1247965449-23375-2-git-send-email-vapier@gentoo.org>
On 21:04 Sat 18 Jul , Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> Ben: some things to note:
> - i adopted Jean's proposed naming scheme in the CONFIG section
> - i deprecated calling the driver-specific entry point
> "xxx_initialization()" in favor of "xxx_register()" because the
> former is way too confusing with everyone also having "xxx_init()"
>
> doc/README.drivers.eth | 199 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 199 insertions(+), 0 deletions(-)
> create mode 100644 doc/README.drivers.eth
>
> diff --git a/doc/README.drivers.eth b/doc/README.drivers.eth
> new file mode 100644
> index 0000000..00b4eb1
> --- /dev/null
> +++ b/doc/README.drivers.eth
> @@ -0,0 +1,199 @@
> +-----------------------
> + Ethernet Driver Guide
> +-----------------------
> +
> +The networking stack in Das U-Boot is designed for multiple network devices
> +to be easily added and controlled at runtime. This guide is meant for people
> +who wish to review the net driver stack with an eye towards implementing your
> +own ethernet device driver. Here we will describe a new pseudo 'APE' driver.
> +
> +----------------
> + CONFIG Options
> +----------------
> +
> +The common config defines your device should respect (if applicable):
> + CONFIG_MII - configure in MII mode
> + CONFIG_RMII - configure in RMII mode
how will you deal you on your board you have a MII and a RMII chip used
I think need to be configure via drivers specifc CONFIG if your driver can not
deal with 2 different instance config or via driver init param
> +
> + CONFIG_CMD_MII - support the MII command
> +
> +If you want to add config options specific to your driver, you should use the
> +naming convention:
> + CONFIG_NET_<DRIVERNAME>_<OPTION>
> +For example, if the APE driver could operate in either 16bit or 32bit mode,
> +there would probably be the option:
> + CONFIG_NET_APE_32BIT - operate in 32bit mode rather than 16bit default
> +
> +And to control whether your driver is even enabled, you should use:
> + CONFIG_SYS_NET_<DRIVERNAME>
In my proposition CONFIG_SYS_ will be not use for driver enabling but for
hardware specific information
> +So the APE driver would look like:
> + CONFIG_SYS_NET_APE
so it will be
CONFIG_NET_APE
> +
> +------------------
> + Driver Functions
> +------------------
> +
> +All functions you will be implementing in this document have the return value
> +meaning of 0 for success and non-zero for failure.
> +
<snip>
> +----------------
> + CONFIG_CMD_MII
> +----------------
> +
> +If your device supports banging arbitrary values on the MII bus (pretty much
> +every device does), you should add support for the mii command. Doing so is
> +fairly trivial and makes debugging mii issues a lot easier at runtime.
> +
> +After you have called eth_register() in your driver's register function, add
> +a call to miiphy_register() like so:
> +#ifdef CONFIG_CMD_MII
> + miiphy_register(dev->name, mii_read, mii_write);
> +#endif
> +
> +And then define the mii_read and mii_write functions if you haven't already.
> +Their syntax is straightforward:
> + int mii_read(char *devname, uchar addr, uchar reg, ushort *val);
> + int mii_write(char *devname, uchar addr, uchar reg, ushort val);
> +
> +The read function should read the register 'reg' from the phy at address 'addr'
> +and store the result in the pointer 'val'. The implementation for the write
> +function should logically follow.
we will rewrite this api when we will push the phylib
Best Regards,
J.
next prev parent reply other threads:[~2009-07-23 21:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 1:39 [U-Boot] eth/net driver documentation Mike Frysinger
2009-07-16 17:36 ` Ben Warren
2009-07-19 1:04 ` [U-Boot] [PATCH 1/2] net: rename NetRxPkt to NetRxPacket Mike Frysinger
2009-07-21 4:49 ` Ben Warren
2009-07-19 1:04 ` [U-Boot] [PATCH 2/2] document network driver framework Mike Frysinger
2009-07-21 5:09 ` Ben Warren
2009-07-21 6:28 ` Mike Frysinger
2009-07-21 7:32 ` Wolfgang Denk
2009-07-21 20:38 ` Mike Frysinger
2009-07-21 20:55 ` Ben Warren
2009-07-21 21:08 ` Mike Frysinger
2009-07-21 7:27 ` Wolfgang Denk
2009-07-22 23:00 ` Andy Fleming
2009-07-23 0:16 ` Mike Frysinger
2009-07-23 21:49 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2009-07-23 22:06 ` Wolfgang Denk
2009-07-23 22:14 ` Ben Warren
2009-07-23 22:24 ` Wolfgang Denk
2009-09-09 18:41 ` [U-Boot] [PATCH v2] " Mike Frysinger
2009-09-22 18:34 ` Wolfgang Denk
2009-10-04 19:12 ` Wolfgang Denk
2009-10-04 22:07 ` Ben Warren
2009-10-05 6:05 ` Ben Warren
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=20090723214946.GE9480@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--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 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.