From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-ey0-f177.google.com ([209.85.215.177]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Q8zGL-0001No-7O for barebox@lists.infradead.org; Sun, 10 Apr 2011 18:21:30 +0000 Received: by eyh6 with SMTP id 6so1638811eyh.36 for ; Sun, 10 Apr 2011 11:21:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20110410105159.GA18343@game.jcrosoft.org> References: <1302358087-9756-1-git-send-email-franck.jullien@gmail.com> <1302358087-9756-2-git-send-email-franck.jullien@gmail.com> <20110410040649.GA8392@game.jcrosoft.org> <20110410105159.GA18343@game.jcrosoft.org> Date: Sun, 10 Apr 2011 20:21:26 +0200 Message-ID: From: Franck JULLIEN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1036340106==" Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH] [v2] Nios2: Add Altera TSE MAC driver To: Jean-Christophe PLAGNIOL-VILLARD Cc: barebox --===============1036340106== Content-Type: multipart/alternative; boundary=001517447908f7fe6004a094861b --001517447908f7fe6004a094861b Content-Type: text/plain; charset=ISO-8859-1 2011/4/10 Jean-Christophe PLAGNIOL-VILLARD > > > index 0000000..2687377 > > > --- /dev/null > > > + > > > +static int tse_get_ethaddr(struct eth_device *edev, unsigned char > *m) > > > +{ > > > + /* There is no eeprom */ > > so return the content of the register no? > > > > Well, the register is reseted to 0 when the MAC starts so there is no > > Ethernet address > > to get. > > > except this function is supposed to return the mac address of the device at > any time so after a set of it it will not be true any more > If I implement the function I get a "eth@eth0: got MAC address from EEPROM: 00:00:00:00:00:00" at startup. That why I returned -1 as what I could find int at91_ether.c...... Or, I could find something to return -1 as long as the MAC address hasn't been set. > > > > > + return -1; > > > +} > > > + > > > +static int tse_eth_send(struct eth_device *edev, void *packet, > int > > length) > > > +{ > > > + > > > + struct altera_tse_priv *priv = edev->priv; > > > + struct alt_sgdma_registers *tx_sgdma = priv->sgdma_tx; > > > + struct alt_sgdma_descriptor *tx_desc = (struct > > alt_sgdma_descriptor *)priv->tx_desc; > > > + > > > + struct alt_sgdma_descriptor *tx_desc_cur = (struct > > alt_sgdma_descriptor *)&tx_desc[0]; > > > + > > > + flush_dcache_range((uint32_t)packet, (uint32_t)packet + > length); > > > + alt_sgdma_construct_descriptor_burst( > > > + (struct alt_sgdma_descriptor *)&tx_desc[0], > > > + (struct alt_sgdma_descriptor *)&tx_desc[1], > > > + (uint32_t *)packet, /* read addr */ > > > + (uint32_t *)0, /* */ > > > + length, /* length or EOP ,will change > for > > each tx */ > > > + 0x1, /* gen eop */ > > > + 0x0, /* read fixed */ > > > + 0x1, /* write fixed or sop */ > > > + 0x0, /* read burst */ > > > + 0x0, /* write burst */ > > > + 0x0 /* channel */ > > please use tab for indent I see other in the patch please check > > > > I use tab for indent, spaces for alignment. I checked the patch with > > checkpatch and it > > didn't find errors..... > try to use tab when u can even for alignment please > OK........ > > > > > > > + > > why this? > > > > Because sometimes (often ?), hardware doesn't run first time. So I > like to > > have some information on MII bus running correctly....One day I had a > PHY > > getting the address 1 and sometimes this f***ing PHY got 31 and this > > kind of auto scan helped me to immediately find the problem...... > > I could remove those function if it is a problem.... > so it's no the right place as it's phy specific and not ehtern drivers > specific > We could put this in the MII code ? Or should I simply remove it ? > > Best Regards, > J. > --001517447908f7fe6004a094861b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2011/4/10 Jean-Christophe PLAGNIOL-VILLA= RD <plagnioj@= jcrosoft.com>
> =A0 =A0 =A0> index 0000000..2687377
> =A0 =A0 =A0> --- /dev/null
> =A0 =A0 =A0> +
> =A0 =A0 =A0> +static int tse_get_ethaddr(struct eth_device *edev, u= nsigned char *m)
> =A0 =A0 =A0> +{
> =A0 =A0 =A0> + =A0 =A0 /* There is no eeprom */
> =A0 =A0 =A0so return the content of the register no?
>
> =A0 =A0Well, the register is reseted to 0 when the MAC starts so there= is no
> =A0 =A0Ethernet address
> =A0 =A0to get.
>
except this function is supposed to return the mac address of the dev= ice at
any time so after a set of it it will not be true any more
=

If I implement the function I get a=A0"eth@eth0: g= ot MAC address from EEPROM: 00:00:00:00:00:00"=A0at startup.
That why I returned -1 as what I could find int at91_ether.c......
Or, I could find something to return -1 as long as the MAC address hasn&#= 39;t been set.

=A0
>
> =A0 =A0 =A0> + =A0 =A0 return -1;
> =A0 =A0 =A0> +}
> =A0 =A0 =A0> +
> =A0 =A0 =A0> +static int tse_eth_send(struct eth_device *edev, void= *packet, int
> =A0 =A0 =A0length)
> =A0 =A0 =A0> +{
> =A0 =A0 =A0> +
> =A0 =A0 =A0> + =A0 =A0 struct altera_tse_priv *priv =3D edev->pr= iv;
> =A0 =A0 =A0> + =A0 =A0 struct alt_sgdma_registers *tx_sgdma =3D pri= v->sgdma_tx;
> =A0 =A0 =A0> + =A0 =A0 struct alt_sgdma_descriptor *tx_desc =3D (st= ruct
> =A0 =A0 =A0alt_sgdma_descriptor *)priv->tx_desc;
> =A0 =A0 =A0> +
> =A0 =A0 =A0> + =A0 =A0 struct alt_sgdma_descriptor *tx_desc_cur =3D= (struct
> =A0 =A0 =A0alt_sgdma_descriptor *)&tx_desc[0];
> =A0 =A0 =A0> +
> =A0 =A0 =A0> + =A0 =A0 flush_dcache_range((uint32_t)packet, (uint32= _t)packet + length);
> =A0 =A0 =A0> + =A0 =A0 alt_sgdma_construct_descriptor_burst(
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 (struct alt_sgdma_descriptor= *)&tx_desc[0],
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 (struct alt_sgdma_descriptor= *)&tx_desc[1],
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 (uint32_t *)packet, =A0/* re= ad addr */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 (uint32_t *)0, =A0 =A0 =A0 /= * =A0 =A0 =A0 =A0 =A0 */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 length, =A0 =A0 =A0 =A0 =A0 = =A0 =A0/* length or EOP ,will change for
> =A0 =A0 =A0each tx */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x1, =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 /* gen eop */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x0, =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 /* read fixed */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x1, =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 /* write fixed or sop */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x0, =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 /* read burst */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x0, =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 /* write burst */
> =A0 =A0 =A0> + =A0 =A0 =A0 =A0 =A0 =A0 0x0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0/* channel */
> =A0 =A0 =A0please use tab for indent I see other in the patch please c= heck
>
> =A0 =A0I use tab for indent, spaces for alignment. I checked the patch= with
> =A0 =A0checkpatch and it
> =A0 =A0didn't find errors.....
try to use tab when u can even for alignment please

OK........
=A0
>
>
> =A0 =A0 =A0> +
> =A0 =A0 =A0why this?
>
> =A0 =A0Because sometimes (often ?), hardware doesn't run first tim= e. So I like to
> =A0 =A0have some information on MII bus running correctly....One day I= had a PHY
> =A0 =A0getting the address 1 and sometimes this f***ing PHY got 31 and= this
> =A0 =A0kind of auto scan helped me to immediately find the problem....= ..
> =A0 =A0I could remove those function if it is a problem....
so it's no the right place as it's phy specific and not ehter= n drivers
specific

We could put this in the MII c= ode ? Or should I simply remove it ?
=A0

Best Regards,
J.

--001517447908f7fe6004a094861b-- --===============1036340106== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox --===============1036340106==--