From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device
Date: Wed, 01 Sep 2010 14:47:54 -0700 [thread overview]
Message-ID: <4C7ECA0A.5030107@gmail.com> (raw)
In-Reply-To: <4C7D26A1.6020705@ti.com>
On 8/31/2010 8:58 AM, Cyril Chemparathy wrote:
> Hi Ben,
>
> [...]
>>> +COBJS-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
>> Please don't use the word DRIVER here. If possible, use something more
>> verbose than "CPSW" too.
> Will TI_CPSW_SWITCH work better considering that "CPSW" is the name of
> the hardware block?
>
Sure.
> [...]
>>> +++ b/drivers/net/cpsw.c
>> Please rename this ti_cpsw.c
> Agreed.
>
> [...]
>>> +struct cpsw_priv {
>>> + struct eth_device *dev;
>>> + struct cpsw_platform_data data;
>>> + int host_port;
>>> +
>>> + struct cpsw_regs *regs;
>>> + void *dma_regs;
>>> + struct cpsw_host_regs *host_port_regs;
>>> + void *ale_regs;
>>> +
>>> + struct cpdma_desc descs[NUM_DESCS];
>>> + struct cpdma_desc *desc_free;
>>> + struct cpdma_chan rx_chan, tx_chan;
>>> +
>>> + struct cpsw_slave *slaves;
>>> +#define for_each_slave(priv, func, arg...) \
>>> + do { \
>>> + int idx; \
>>> + for (idx = 0; idx< (priv)->data.slaves; idx++) \
>>> + (func)((priv)->slaves + idx, ##arg); \
>>> + } while (0)
>>> +};
>>> +
>> Can this stuff go in a header file?
> This stuff is intended to be private within the driver. I can split
> this out into drivers/net/ti_cpsw.h.
>
If it's truly private within the driver and will never be needed by
anybody else, the source file is OK, but since you're going to create a
new header file in /include/net anyway, maybe you'll want to put some
stuff there. Your call...
> [...]
>>> diff --git a/include/netdev.h b/include/netdev.h
>>> index 94eedfe..009e2f1 100644
>>> --- a/include/netdev.h
>>> +++ b/include/netdev.h
>>> @@ -180,4 +180,33 @@ struct mv88e61xx_config {
>>> int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
>>> #endif /* CONFIG_MV88E61XX_SWITCH */
>>>
>>> +#ifdef CONFIG_DRIVER_TI_CPSW
>>> +
>>> +struct cpsw_slave_data {
>>> + u32 slave_reg_ofs;
>>> + u32 sliver_reg_ofs;
>>> + int phy_id;
>>> +};
>>> +
>>> +struct cpsw_platform_data {
>>> + u32 mdio_base;
>>> + u32 cpsw_base;
>>> + int mdio_div;
>>> + int channels; /* number of cpdma channels (symmetric) */
>>> + u32 cpdma_reg_ofs; /* cpdma register offset */
>>> + int slaves; /* number of slave cpgmac ports */
>>> + u32 ale_reg_ofs; /* address lookup engine reg offset */
>>> + int ale_entries; /* ale table size */
>>> + u32 host_port_reg_ofs; /* cpdma host port registers */
>>> + u32 hw_stats_reg_ofs; /* cpsw hw stats counters */
>>> + u32 mac_control;
>>> + struct cpsw_slave_data *slave_data;
>>> + void (*control)(int enabled);
>>> + void (*phy_init)(char *name, int addr);
>>> +};
>>> +
>> This stuff doesn't belong in this file. Definitions specific to your
>> driver should go in /include/net/ti_cpsw.h (note that you'll be creating
>> this directory, but that's where we want driver headers to go moving
>> forward. Also, please call the initialize function
>> 'ti_cpsw_initialize()'. Despite what the readme file recommends, you're
>> initializing something, not registering it. If anything, the 'init()'
>> functions are misnamed, but that's another discussion.
> Will do.
>
> We will post an updated v2 series shortly, with these changes.
>
> Thanks
> Cyril.
regards,
Ben
next prev parent reply other threads:[~2010-09-01 21:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 1:33 [U-Boot] [PATCH 0/2] tnetv107x cpsw ethernet switch driver Cyril Chemparathy
2010-08-04 1:33 ` [U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device Cyril Chemparathy
2010-08-31 5:26 ` Ben Warren
2010-08-31 15:58 ` Cyril Chemparathy
2010-09-01 21:47 ` Ben Warren [this message]
2010-09-01 15:34 ` Cyril Chemparathy
2010-09-01 21:45 ` Ben Warren
2010-08-04 1:33 ` [U-Boot] [PATCH 2/2] TI: add tnetv107x evm board support for cpsw Cyril Chemparathy
2010-08-12 22:51 ` [U-Boot] [PATCH 0/2] tnetv107x cpsw ethernet switch driver Paulraj, Sandeep
2010-08-12 23:05 ` Ben Warren
2010-08-13 1:26 ` Mike Frysinger
2010-08-13 1:50 ` Ben Warren
-- strict thread matches above, loose matches on Subject: below --
2011-10-21 7:02 [U-Boot] [PATCH 0/2] Added CPSW support Chandan Nath
2011-10-21 7:02 ` [U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device Chandan Nath
2011-10-21 15:38 ` Tom Rini
2011-11-10 5:47 ` Kumar
2011-11-10 14:40 ` Tom Rini
2011-11-11 6:01 ` Kumar
2011-11-11 14:49 ` Tom Rini
2011-11-11 15:12 ` Kumar
2011-11-28 8:23 ` Kumar
2011-11-28 14:28 ` Tom Rini
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=4C7ECA0A.5030107@gmail.com \
--to=biggerbadderben@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox