* [PATCH 0/4] macb: more fixes
@ 2013-02-05 10:12 Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-05 10:12 UTC (permalink / raw)
To: barebox
HI,
The following changes since commit e43e1498f65fe03cfc6b2744247eeccf27b26876:
MIPS: pbl: fix none compression support (2013-02-05 09:43:17 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/macb
for you to fetch changes up to 450794f1d7ab6de54ebfab9d8a615d0ed6a1850e:
macb: drop non used define (2013-02-05 03:42:40 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (4):
macb: use dev_xx message
macb: register the phy after the macb is init
macb: report timeout on send
macb: drop non used define
drivers/net/macb.c | 46 ++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] macb: use dev_xx message
2013-02-05 10:12 [PATCH 0/4] macb: more fixes Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-05 10:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 2/4] macb: register the phy after the macb is init Jean-Christophe PLAGNIOL-VILLARD
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-05 10:15 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 18ac3f8..15b1e93 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -96,7 +96,7 @@ struct macb_device {
int phy_addr;
- const struct device *dev;
+ const struct device_d *dev;
struct eth_device netdev;
phy_interface_t interface;
@@ -112,7 +112,7 @@ static int macb_send(struct eth_device *edev, void *packet,
struct macb_device *macb = edev->priv;
unsigned long ctrl;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
ctrl = length & TXBUF_FRMLEN_MASK;
ctrl |= TXBUF_FRAME_END | TXBUF_WRAP;
@@ -123,15 +123,15 @@ static int macb_send(struct eth_device *edev, void *packet,
dma_flush_range((ulong) packet, (ulong)packet + length);
macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART));
- wait_on_timeout(100 * MSECOND,
+ ret = wait_on_timeout(100 * MSECOND,
!(macb->tx_ring[0].ctrl & TXBUF_USED));
ctrl = macb->tx_ring[0].ctrl;
if (ctrl & TXBUF_UNDERRUN)
- printf("TX underrun\n");
+ dev_err(macb->dev, "TX underrun\n");
if (ctrl & TXBUF_EXHAUSTED)
- printf("TX buffers exhausted in mid frame\n");
+ dev_err(macb->dev, "TX buffers exhausted in mid frame\n");
/* No one cares anyway */
return 0;
@@ -142,7 +142,7 @@ static void reclaim_rx_buffers(struct macb_device *macb,
{
unsigned int i;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
i = macb->rx_tail;
while (i > new_tail) {
@@ -170,7 +170,7 @@ static int macb_recv(struct eth_device *edev)
int wrapped = 0;
u32 status;
-// printf("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
for (;;) {
if (!(macb->rx_ring[rx_tail].addr & RXADDR_USED))
@@ -235,7 +235,7 @@ static int macb_open(struct eth_device *edev)
{
struct macb_device *macb = edev->priv;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
/* Obtain the PHY's address/id */
return phy_device_connect(edev, &macb->miibus, macb->phy_addr,
@@ -249,7 +249,7 @@ static int macb_init(struct eth_device *edev)
unsigned long paddr, val = 0;
int i;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
/*
* macb_halt should have been called at some point before now,
@@ -318,7 +318,7 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg)
int value;
uint64_t start;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
netctl = macb_readl(macb, NCR);
netctl |= MACB_BIT(MPE);
@@ -335,7 +335,7 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg)
do {
netstat = macb_readl(macb, NSR);
if (is_timeout(start, SECOND)) {
- printf("phy read timed out\n");
+ dev_err(macb->dev, "phy read timed out\n");
return -1;
}
} while (!(netstat & MACB_BIT(IDLE)));
@@ -357,7 +357,7 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value)
unsigned long netstat;
unsigned long frame;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
netctl = macb_readl(macb, NCR);
netctl |= MACB_BIT(MPE);
@@ -384,7 +384,9 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value)
static int macb_get_ethaddr(struct eth_device *edev, unsigned char *adr)
{
- debug("%s\n", __func__);
+ struct macb_device *macb = edev->priv;
+
+ dev_dbg(macb->dev, "%s\n", __func__);
return -1;
}
@@ -393,7 +395,7 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
{
struct macb_device *macb = edev->priv;
- debug("%s\n", __func__);
+ dev_dbg(macb->dev, "%s\n", __func__);
/* set hardware address */
macb_writel(macb, SA1B, adr[0] | adr[1] << 8 | adr[2] << 16 | adr[3] << 24);
@@ -412,7 +414,7 @@ static int macb_probe(struct device_d *dev)
struct clk *pclk;
if (!dev->platform_data) {
- printf("macb: no platform_data\n");
+ dev_err(dev, "macb: no platform_data\n");
return -ENODEV;
}
pdata = dev->platform_data;
@@ -421,6 +423,8 @@ static int macb_probe(struct device_d *dev)
edev->priv = (struct macb_device *)(edev + 1);
macb = edev->priv;
+ macb->dev = dev;
+
edev->init = macb_init;
edev->open = macb_open;
edev->send = macb_send;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] macb: register the phy after the macb is init
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-05 10:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 19:35 ` Sascha Hauer
2013-02-05 10:15 ` [PATCH 3/4] macb: report timeout on send Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-05 10:15 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 15b1e93..8eac4a8 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
macb_writel(macb, NCFGR, ncfgr);
- mdiobus_register(&macb->miibus);
eth_register(edev);
+ mdiobus_register(&macb->miibus);
return 0;
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] macb: report timeout on send
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 2/4] macb: register the phy after the macb is init Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-05 10:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 4/4] macb: drop non used define Jean-Christophe PLAGNIOL-VILLARD
2013-02-08 8:36 ` [PATCH 1/4] macb: use dev_xx message Sascha Hauer
3 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-05 10:15 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 8eac4a8..641b365 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -111,6 +111,7 @@ static int macb_send(struct eth_device *edev, void *packet,
{
struct macb_device *macb = edev->priv;
unsigned long ctrl;
+ int ret;
dev_dbg(macb->dev, "%s\n", __func__);
@@ -132,9 +133,10 @@ static int macb_send(struct eth_device *edev, void *packet,
dev_err(macb->dev, "TX underrun\n");
if (ctrl & TXBUF_EXHAUSTED)
dev_err(macb->dev, "TX buffers exhausted in mid frame\n");
+ if (ret)
+ dev_err(macb->dev,"TX timeout\n");
- /* No one cares anyway */
- return 0;
+ return ret;
}
static void reclaim_rx_buffers(struct macb_device *macb,
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] macb: drop non used define
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 2/4] macb: register the phy after the macb is init Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 3/4] macb: report timeout on send Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-05 10:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-08 8:36 ` [PATCH 1/4] macb: use dev_xx message Sascha Hauer
3 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-05 10:15 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/macb.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 641b365..9d2dfd2 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -68,10 +68,6 @@ struct macb_dma_desc {
#define RXBUF_FRAME_START 0x00004000
#define RXBUF_FRAME_END 0x00008000
#define RXBUF_TYPEID_MATCH 0x00400000
-#define RXBUF_ADDR4_MATCH 0x00800000
-#define RXBUF_ADDR3_MATCH 0x01000000
-#define RXBUF_ADDR2_MATCH 0x02000000
-#define RXBUF_ADDR1_MATCH 0x04000000
#define RXBUF_BROADCAST 0x80000000
#define TXBUF_FRMLEN_MASK 0x000007ff
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-05 10:15 ` [PATCH 2/4] macb: register the phy after the macb is init Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-06 19:35 ` Sascha Hauer
2013-02-06 19:37 ` Sascha Hauer
2013-02-06 20:16 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 2 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-06 19:35 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/net/macb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 15b1e93..8eac4a8 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
>
> macb_writel(macb, NCFGR, ncfgr);
>
> - mdiobus_register(&macb->miibus);
> eth_register(edev);
> + mdiobus_register(&macb->miibus);
Why?
Most other drivers do it the other way round and you do not provide
information why this is done.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-06 19:35 ` Sascha Hauer
@ 2013-02-06 19:37 ` Sascha Hauer
2013-02-06 20:16 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-06 19:37 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Feb 06, 2013 at 08:35:40PM +0100, Sascha Hauer wrote:
> On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > drivers/net/macb.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index 15b1e93..8eac4a8 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
> >
> > macb_writel(macb, NCFGR, ncfgr);
> >
> > - mdiobus_register(&macb->miibus);
> > eth_register(edev);
> > + mdiobus_register(&macb->miibus);
>
> Why?
>
> Most other drivers do it the other way round and you do not provide
> information why this is done.
Applied the other patches.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-06 19:35 ` Sascha Hauer
2013-02-06 19:37 ` Sascha Hauer
@ 2013-02-06 20:16 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 20:32 ` Sascha Hauer
1 sibling, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-06 20:16 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 20:35 Wed 06 Feb , Sascha Hauer wrote:
> On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > drivers/net/macb.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index 15b1e93..8eac4a8 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
> >
> > macb_writel(macb, NCFGR, ncfgr);
> >
> > - mdiobus_register(&macb->miibus);
> > eth_register(edev);
> > + mdiobus_register(&macb->miibus);
>
> Why?
>
> Most other drivers do it the other way round and you do not provide
> information why this is done.
because the is not ready
as we init it as _init which is done during the eth_register
Best Regards,
J.
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-06 20:16 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-06 20:32 ` Sascha Hauer
2013-02-06 20:34 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2013-02-06 20:32 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Feb 06, 2013 at 09:16:24PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:35 Wed 06 Feb , Sascha Hauer wrote:
> > On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > ---
> > > drivers/net/macb.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > > index 15b1e93..8eac4a8 100644
> > > --- a/drivers/net/macb.c
> > > +++ b/drivers/net/macb.c
> > > @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
> > >
> > > macb_writel(macb, NCFGR, ncfgr);
> > >
> > > - mdiobus_register(&macb->miibus);
> > > eth_register(edev);
> > > + mdiobus_register(&macb->miibus);
> >
> > Why?
> >
> > Most other drivers do it the other way round and you do not provide
> > information why this is done.
> because the is not ready
>
> as we init it as _init which is done during the eth_register
Then you should probably call macb_init from your probe function
manually. This implicit dependency is not good.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-06 20:32 ` Sascha Hauer
@ 2013-02-06 20:34 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 20:39 ` Sascha Hauer
0 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-06 20:34 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 21:32 Wed 06 Feb , Sascha Hauer wrote:
> On Wed, Feb 06, 2013 at 09:16:24PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 20:35 Wed 06 Feb , Sascha Hauer wrote:
> > > On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > ---
> > > > drivers/net/macb.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > > > index 15b1e93..8eac4a8 100644
> > > > --- a/drivers/net/macb.c
> > > > +++ b/drivers/net/macb.c
> > > > @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
> > > >
> > > > macb_writel(macb, NCFGR, ncfgr);
> > > >
> > > > - mdiobus_register(&macb->miibus);
> > > > eth_register(edev);
> > > > + mdiobus_register(&macb->miibus);
> > >
> > > Why?
> > >
> > > Most other drivers do it the other way round and you do not provide
> > > information why this is done.
> > because the is not ready
> >
> > as we init it as _init which is done during the eth_register
>
> Then you should probably call macb_init from your probe function
> manually. This implicit dependency is not good.
so init callback is for what?
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] macb: register the phy after the macb is init
2013-02-06 20:34 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-06 20:39 ` Sascha Hauer
0 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-06 20:39 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Feb 06, 2013 at 09:34:28PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 21:32 Wed 06 Feb , Sascha Hauer wrote:
> > On Wed, Feb 06, 2013 at 09:16:24PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 20:35 Wed 06 Feb , Sascha Hauer wrote:
> > > > On Tue, Feb 05, 2013 at 11:15:04AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > > > > ---
> > > > > drivers/net/macb.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > > > > index 15b1e93..8eac4a8 100644
> > > > > --- a/drivers/net/macb.c
> > > > > +++ b/drivers/net/macb.c
> > > > > @@ -476,8 +476,8 @@ static int macb_probe(struct device_d *dev)
> > > > >
> > > > > macb_writel(macb, NCFGR, ncfgr);
> > > > >
> > > > > - mdiobus_register(&macb->miibus);
> > > > > eth_register(edev);
> > > > > + mdiobus_register(&macb->miibus);
> > > >
> > > > Why?
> > > >
> > > > Most other drivers do it the other way round and you do not provide
> > > > information why this is done.
> > > because the is not ready
> > >
> > > as we init it as _init which is done during the eth_register
> >
> > Then you should probably call macb_init from your probe function
> > manually. This implicit dependency is not good.
>
> so init callback is for what?
For being scheduled to be removed.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] macb: use dev_xx message
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2013-02-05 10:15 ` [PATCH 4/4] macb: drop non used define Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-08 8:36 ` Sascha Hauer
3 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2013-02-08 8:36 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Tue, Feb 05, 2013 at 11:15:03AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> drivers/net/macb.c | 34 +++++++++++++++++++---------------
> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 18ac3f8..15b1e93 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -96,7 +96,7 @@ struct macb_device {
>
> int phy_addr;
>
> - const struct device *dev;
> + const struct device_d *dev;
> struct eth_device netdev;
>
> phy_interface_t interface;
> @@ -112,7 +112,7 @@ static int macb_send(struct eth_device *edev, void *packet,
> struct macb_device *macb = edev->priv;
> unsigned long ctrl;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> ctrl = length & TXBUF_FRMLEN_MASK;
> ctrl |= TXBUF_FRAME_END | TXBUF_WRAP;
> @@ -123,15 +123,15 @@ static int macb_send(struct eth_device *edev, void *packet,
> dma_flush_range((ulong) packet, (ulong)packet + length);
> macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART));
>
> - wait_on_timeout(100 * MSECOND,
> + ret = wait_on_timeout(100 * MSECOND,
> !(macb->tx_ring[0].ctrl & TXBUF_USED));
This hunk belongs to patch 3/4 and breaks compiling here. Fixed that up.
Sascha
>
> ctrl = macb->tx_ring[0].ctrl;
>
> if (ctrl & TXBUF_UNDERRUN)
> - printf("TX underrun\n");
> + dev_err(macb->dev, "TX underrun\n");
> if (ctrl & TXBUF_EXHAUSTED)
> - printf("TX buffers exhausted in mid frame\n");
> + dev_err(macb->dev, "TX buffers exhausted in mid frame\n");
>
> /* No one cares anyway */
> return 0;
> @@ -142,7 +142,7 @@ static void reclaim_rx_buffers(struct macb_device *macb,
> {
> unsigned int i;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> i = macb->rx_tail;
> while (i > new_tail) {
> @@ -170,7 +170,7 @@ static int macb_recv(struct eth_device *edev)
> int wrapped = 0;
> u32 status;
>
> -// printf("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> for (;;) {
> if (!(macb->rx_ring[rx_tail].addr & RXADDR_USED))
> @@ -235,7 +235,7 @@ static int macb_open(struct eth_device *edev)
> {
> struct macb_device *macb = edev->priv;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> /* Obtain the PHY's address/id */
> return phy_device_connect(edev, &macb->miibus, macb->phy_addr,
> @@ -249,7 +249,7 @@ static int macb_init(struct eth_device *edev)
> unsigned long paddr, val = 0;
> int i;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> /*
> * macb_halt should have been called at some point before now,
> @@ -318,7 +318,7 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg)
> int value;
> uint64_t start;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> netctl = macb_readl(macb, NCR);
> netctl |= MACB_BIT(MPE);
> @@ -335,7 +335,7 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg)
> do {
> netstat = macb_readl(macb, NSR);
> if (is_timeout(start, SECOND)) {
> - printf("phy read timed out\n");
> + dev_err(macb->dev, "phy read timed out\n");
> return -1;
> }
> } while (!(netstat & MACB_BIT(IDLE)));
> @@ -357,7 +357,7 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value)
> unsigned long netstat;
> unsigned long frame;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> netctl = macb_readl(macb, NCR);
> netctl |= MACB_BIT(MPE);
> @@ -384,7 +384,9 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value)
>
> static int macb_get_ethaddr(struct eth_device *edev, unsigned char *adr)
> {
> - debug("%s\n", __func__);
> + struct macb_device *macb = edev->priv;
> +
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> return -1;
> }
> @@ -393,7 +395,7 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
> {
> struct macb_device *macb = edev->priv;
>
> - debug("%s\n", __func__);
> + dev_dbg(macb->dev, "%s\n", __func__);
>
> /* set hardware address */
> macb_writel(macb, SA1B, adr[0] | adr[1] << 8 | adr[2] << 16 | adr[3] << 24);
> @@ -412,7 +414,7 @@ static int macb_probe(struct device_d *dev)
> struct clk *pclk;
>
> if (!dev->platform_data) {
> - printf("macb: no platform_data\n");
> + dev_err(dev, "macb: no platform_data\n");
> return -ENODEV;
> }
> pdata = dev->platform_data;
> @@ -421,6 +423,8 @@ static int macb_probe(struct device_d *dev)
> edev->priv = (struct macb_device *)(edev + 1);
> macb = edev->priv;
>
> + macb->dev = dev;
> +
> edev->init = macb_init;
> edev->open = macb_open;
> edev->send = macb_send;
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-02-08 8:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-05 10:12 [PATCH 0/4] macb: more fixes Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 1/4] macb: use dev_xx message Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 2/4] macb: register the phy after the macb is init Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 19:35 ` Sascha Hauer
2013-02-06 19:37 ` Sascha Hauer
2013-02-06 20:16 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 20:32 ` Sascha Hauer
2013-02-06 20:34 ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-06 20:39 ` Sascha Hauer
2013-02-05 10:15 ` [PATCH 3/4] macb: report timeout on send Jean-Christophe PLAGNIOL-VILLARD
2013-02-05 10:15 ` [PATCH 4/4] macb: drop non used define Jean-Christophe PLAGNIOL-VILLARD
2013-02-08 8:36 ` [PATCH 1/4] macb: use dev_xx message Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox