Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
Hi Jagan, On 12 October 2016 at 10:16, Jagan Teki wrote: > Hi Simon, > > On Wed, Oct 12, 2016 at 2:28 AM, Simon Glass wrote: >> Hi Jagan, >> >> On 9 October 2016 at 08:51, Jagan Teki wrote: >>> >>> Hi Simon, >>> >>> On Thu, Oct 6, 2016 at 4:25 PM, Jagan Teki wrote: >>> > From: Jagan Teki >>> > >>> > This patch add driver model support for fec_mxc driver. >>> > >>> > Cc: Simon Glass >>> > Cc: Joe Hershberger >>> > Cc: Peng Fan >>> > Cc: Stefano Babic >>> > Cc: Michael Trimarchi >>> > Signed-off-by: Jagan Teki >>> > --- >>> > drivers/net/fec_mxc.c | 314 >>> > ++ >>> > drivers/net/fec_mxc.h | 4 + >>> > 2 files changed, 271 insertions(+), 47 deletions(-) >>> > >>> >> [...] >>> >>> This look OK now, let me know if you have any inputs. >> >> Is there a change log please? > > Added on cover-letter[1], forgot to add you :) > > [1] > http://u-boot.10912.n7.nabble.com/PATCH-v5-0-5-net-fec-mxc-Convert-to-DM-td269625.html It's easier if you add it to the individual patch. Anyway, Joe is reviewing this so I will leave it to him. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
Hi Simon, On Wed, Oct 12, 2016 at 2:28 AM, Simon Glass wrote: > Hi Jagan, > > On 9 October 2016 at 08:51, Jagan Teki wrote: >> >> Hi Simon, >> >> On Thu, Oct 6, 2016 at 4:25 PM, Jagan Teki wrote: >> > From: Jagan Teki >> > >> > This patch add driver model support for fec_mxc driver. >> > >> > Cc: Simon Glass >> > Cc: Joe Hershberger >> > Cc: Peng Fan >> > Cc: Stefano Babic >> > Cc: Michael Trimarchi >> > Signed-off-by: Jagan Teki >> > --- >> > drivers/net/fec_mxc.c | 314 >> > ++ >> > drivers/net/fec_mxc.h | 4 + >> > 2 files changed, 271 insertions(+), 47 deletions(-) >> > >> > [...] >> >> This look OK now, let me know if you have any inputs. > > Is there a change log please? Added on cover-letter[1], forgot to add you :) [1] http://u-boot.10912.n7.nabble.com/PATCH-v5-0-5-net-fec-mxc-Convert-to-DM-td269625.html thanks! -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
On Wed, Oct 12, 2016 at 2:15 AM, Joe Hershberger wrote: > On Thu, Oct 6, 2016 at 12:55 PM, Jagan Teki wrote: >> From: Jagan Teki >> >> This patch add driver model support for fec_mxc driver. >> >> Cc: Simon Glass >> Cc: Joe Hershberger >> Cc: Peng Fan >> Cc: Stefano Babic >> Cc: Michael Trimarchi >> Signed-off-by: Jagan Teki >> --- >> drivers/net/fec_mxc.c | 314 >> ++ >> drivers/net/fec_mxc.h | 4 + >> 2 files changed, 271 insertions(+), 47 deletions(-) >> >> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c >> index 0838d58..c0ec976 100644 >> --- a/drivers/net/fec_mxc.c >> +++ b/drivers/net/fec_mxc.c >> @@ -9,6 +9,7 @@ >> */ >> >> #include >> +#include >> #include >> #include >> #include >> @@ -368,11 +369,8 @@ static int fec_get_hwaddr(int dev_id, unsigned char >> *mac) >> return !is_valid_ethaddr(mac); >> } >> >> -static int fec_set_hwaddr(struct eth_device *dev) >> +static int _fec_set_hwaddr(struct fec_priv *fec, uchar *mac) >> { >> - uchar *mac = dev->enetaddr; >> - struct fec_priv *fec = (struct fec_priv *)dev->priv; >> - >> writel(0, &fec->eth->iaddr1); >> writel(0, &fec->eth->iaddr2); >> writel(0, &fec->eth->gaddr1); >> @@ -426,9 +424,8 @@ static void fec_reg_setup(struct fec_priv *fec) >> * Start the FEC engine >> * @param[in] dev Our device to handle >> */ >> -static int fec_open(struct eth_device *edev) >> +static int fec_open(struct fec_priv *fec) >> { >> - struct fec_priv *fec = (struct fec_priv *)edev->priv; >> int speed; >> uint32_t addr, size; >> int i; >> @@ -534,14 +531,13 @@ static int fec_open(struct eth_device *edev) >> return 0; >> } >> >> -static int fec_init(struct eth_device *dev, bd_t* bd) >> +static int _fec_init(struct fec_priv *fec, uchar *mac) >> { >> - struct fec_priv *fec = (struct fec_priv *)dev->priv; >> uint32_t mib_ptr = (uint32_t)&fec->eth->rmon_t_drop; >> int i; >> >> /* Initialize MAC address */ >> - fec_set_hwaddr(dev); >> + _fec_set_hwaddr(fec, mac); >> >> /* >> * Setup transmit descriptors, there are two in total. >> @@ -587,7 +583,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd) >> if (fec->xcv_type != SEVENWIRE) >> miiphy_restart_aneg(dev); >> #endif >> - fec_open(dev); >> + fec_open(fec); >> return 0; >> } >> >> @@ -595,9 +591,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd) >> * Halt the FEC engine >> * @param[in] dev Our device to handle >> */ >> -static void fec_halt(struct eth_device *dev) >> +static void _fec_halt(struct fec_priv *fec) >> { >> - struct fec_priv *fec = (struct fec_priv *)dev->priv; >> int counter = 0x; >> >> /* >> @@ -637,7 +632,7 @@ static void fec_halt(struct eth_device *dev) >> * @param[in] length Data count in bytes >> * @return 0 on success >> */ >> -static int fec_send(struct eth_device *dev, void *packet, int length) >> +static int _fec_send(struct fec_priv *fec, void *packet, int length) >> { >> unsigned int status; >> uint32_t size, end; >> @@ -649,8 +644,6 @@ static int fec_send(struct eth_device *dev, void >> *packet, int length) >> * This routine transmits one frame. This routine only accepts >> * 6-byte Ethernet addresses. >> */ >> - struct fec_priv *fec = (struct fec_priv *)dev->priv; >> - >> /* >> * Check for valid length of data. >> */ >> @@ -777,14 +770,14 @@ out: >> return ret; >> } >> >> + >> /** >> * Pull one frame from the card >> * @param[in] dev Our ethernet device to handle >> * @return Length of packet read >> */ >> -static int fec_recv(struct eth_device *dev) >> +static int _fec_recv(struct fec_priv *fec, uchar *mac) >> { >> - struct fec_priv *fec = (struct fec_priv *)dev->priv; >> struct fec_bd *rbd = &fec->rbd_base[fec->rbd_index]; >> unsigned long ievent; >> int frame_length, len = 0; >> @@ -800,8 +793,8 @@ static int fec_recv(struct eth_device *dev) >> writel(ievent, &fec->eth->ievent); >> debug("fec_recv: ievent 0x%lx\n", ievent); >> if (ievent & FEC_IEVENT_BABR) { >> - fec_halt(dev); >> - fec_init(dev, fec->bd); >> + _fec_halt(fec); >> + _fec_init(fec, mac); >> printf("some error: 0x%08lx\n", ievent); >> return 0; >> } >> @@ -813,10 +806,10 @@ static int fec_recv(struct eth_device *dev) >> if (ievent & FEC_IEVENT_GRA) { >> /* Graceful stop complete */ >> if (readl(&fec->eth->x_cntrl) & 0x0001) { >> - fec_halt(dev); >> + _fec_halt(fec); >> writel(~0x0001 & readl(&fec->eth->x_cntrl), >>
Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
Hi Jagan, On 9 October 2016 at 08:51, Jagan Teki wrote: > > Hi Simon, > > On Thu, Oct 6, 2016 at 4:25 PM, Jagan Teki wrote: > > From: Jagan Teki > > > > This patch add driver model support for fec_mxc driver. > > > > Cc: Simon Glass > > Cc: Joe Hershberger > > Cc: Peng Fan > > Cc: Stefano Babic > > Cc: Michael Trimarchi > > Signed-off-by: Jagan Teki > > --- > > drivers/net/fec_mxc.c | 314 > > ++ > > drivers/net/fec_mxc.h | 4 + > > 2 files changed, 271 insertions(+), 47 deletions(-) > > > [...] > > This look OK now, let me know if you have any inputs. Is there a change log please? Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
On Thu, Oct 6, 2016 at 12:55 PM, Jagan Teki wrote: > From: Jagan Teki > > This patch add driver model support for fec_mxc driver. > > Cc: Simon Glass > Cc: Joe Hershberger > Cc: Peng Fan > Cc: Stefano Babic > Cc: Michael Trimarchi > Signed-off-by: Jagan Teki > --- > drivers/net/fec_mxc.c | 314 > ++ > drivers/net/fec_mxc.h | 4 + > 2 files changed, 271 insertions(+), 47 deletions(-) > > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c > index 0838d58..c0ec976 100644 > --- a/drivers/net/fec_mxc.c > +++ b/drivers/net/fec_mxc.c > @@ -9,6 +9,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -368,11 +369,8 @@ static int fec_get_hwaddr(int dev_id, unsigned char *mac) > return !is_valid_ethaddr(mac); > } > > -static int fec_set_hwaddr(struct eth_device *dev) > +static int _fec_set_hwaddr(struct fec_priv *fec, uchar *mac) > { > - uchar *mac = dev->enetaddr; > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > - > writel(0, &fec->eth->iaddr1); > writel(0, &fec->eth->iaddr2); > writel(0, &fec->eth->gaddr1); > @@ -426,9 +424,8 @@ static void fec_reg_setup(struct fec_priv *fec) > * Start the FEC engine > * @param[in] dev Our device to handle > */ > -static int fec_open(struct eth_device *edev) > +static int fec_open(struct fec_priv *fec) > { > - struct fec_priv *fec = (struct fec_priv *)edev->priv; > int speed; > uint32_t addr, size; > int i; > @@ -534,14 +531,13 @@ static int fec_open(struct eth_device *edev) > return 0; > } > > -static int fec_init(struct eth_device *dev, bd_t* bd) > +static int _fec_init(struct fec_priv *fec, uchar *mac) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > uint32_t mib_ptr = (uint32_t)&fec->eth->rmon_t_drop; > int i; > > /* Initialize MAC address */ > - fec_set_hwaddr(dev); > + _fec_set_hwaddr(fec, mac); > > /* > * Setup transmit descriptors, there are two in total. > @@ -587,7 +583,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd) > if (fec->xcv_type != SEVENWIRE) > miiphy_restart_aneg(dev); > #endif > - fec_open(dev); > + fec_open(fec); > return 0; > } > > @@ -595,9 +591,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd) > * Halt the FEC engine > * @param[in] dev Our device to handle > */ > -static void fec_halt(struct eth_device *dev) > +static void _fec_halt(struct fec_priv *fec) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > int counter = 0x; > > /* > @@ -637,7 +632,7 @@ static void fec_halt(struct eth_device *dev) > * @param[in] length Data count in bytes > * @return 0 on success > */ > -static int fec_send(struct eth_device *dev, void *packet, int length) > +static int _fec_send(struct fec_priv *fec, void *packet, int length) > { > unsigned int status; > uint32_t size, end; > @@ -649,8 +644,6 @@ static int fec_send(struct eth_device *dev, void *packet, > int length) > * This routine transmits one frame. This routine only accepts > * 6-byte Ethernet addresses. > */ > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > - > /* > * Check for valid length of data. > */ > @@ -777,14 +770,14 @@ out: > return ret; > } > > + > /** > * Pull one frame from the card > * @param[in] dev Our ethernet device to handle > * @return Length of packet read > */ > -static int fec_recv(struct eth_device *dev) > +static int _fec_recv(struct fec_priv *fec, uchar *mac) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > struct fec_bd *rbd = &fec->rbd_base[fec->rbd_index]; > unsigned long ievent; > int frame_length, len = 0; > @@ -800,8 +793,8 @@ static int fec_recv(struct eth_device *dev) > writel(ievent, &fec->eth->ievent); > debug("fec_recv: ievent 0x%lx\n", ievent); > if (ievent & FEC_IEVENT_BABR) { > - fec_halt(dev); > - fec_init(dev, fec->bd); > + _fec_halt(fec); > + _fec_init(fec, mac); > printf("some error: 0x%08lx\n", ievent); > return 0; > } > @@ -813,10 +806,10 @@ static int fec_recv(struct eth_device *dev) > if (ievent & FEC_IEVENT_GRA) { > /* Graceful stop complete */ > if (readl(&fec->eth->x_cntrl) & 0x0001) { > - fec_halt(dev); > + _fec_halt(fec); > writel(~0x0001 & readl(&fec->eth->x_cntrl), > &fec->eth->x_cntrl); > - fec_init(dev, fec->bd); > + _fec_init(fec, mac); > } > } > > @@ -970,6 +963,71 @@ static void fec_free_descs(
Re: [U-Boot] [PATCH v5 2/5] net: fec_mxc: Convert into driver model
Hi Simon, On Thu, Oct 6, 2016 at 4:25 PM, Jagan Teki wrote: > From: Jagan Teki > > This patch add driver model support for fec_mxc driver. > > Cc: Simon Glass > Cc: Joe Hershberger > Cc: Peng Fan > Cc: Stefano Babic > Cc: Michael Trimarchi > Signed-off-by: Jagan Teki > --- > drivers/net/fec_mxc.c | 314 > ++ > drivers/net/fec_mxc.h | 4 + > 2 files changed, 271 insertions(+), 47 deletions(-) > > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c > index 0838d58..c0ec976 100644 > --- a/drivers/net/fec_mxc.c > +++ b/drivers/net/fec_mxc.c > @@ -9,6 +9,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -368,11 +369,8 @@ static int fec_get_hwaddr(int dev_id, unsigned char *mac) > return !is_valid_ethaddr(mac); > } > > -static int fec_set_hwaddr(struct eth_device *dev) > +static int _fec_set_hwaddr(struct fec_priv *fec, uchar *mac) > { > - uchar *mac = dev->enetaddr; > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > - > writel(0, &fec->eth->iaddr1); > writel(0, &fec->eth->iaddr2); > writel(0, &fec->eth->gaddr1); > @@ -426,9 +424,8 @@ static void fec_reg_setup(struct fec_priv *fec) > * Start the FEC engine > * @param[in] dev Our device to handle > */ > -static int fec_open(struct eth_device *edev) > +static int fec_open(struct fec_priv *fec) > { > - struct fec_priv *fec = (struct fec_priv *)edev->priv; > int speed; > uint32_t addr, size; > int i; > @@ -534,14 +531,13 @@ static int fec_open(struct eth_device *edev) > return 0; > } > > -static int fec_init(struct eth_device *dev, bd_t* bd) > +static int _fec_init(struct fec_priv *fec, uchar *mac) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > uint32_t mib_ptr = (uint32_t)&fec->eth->rmon_t_drop; > int i; > > /* Initialize MAC address */ > - fec_set_hwaddr(dev); > + _fec_set_hwaddr(fec, mac); > > /* > * Setup transmit descriptors, there are two in total. > @@ -587,7 +583,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd) > if (fec->xcv_type != SEVENWIRE) > miiphy_restart_aneg(dev); > #endif > - fec_open(dev); > + fec_open(fec); > return 0; > } > > @@ -595,9 +591,8 @@ static int fec_init(struct eth_device *dev, bd_t* bd) > * Halt the FEC engine > * @param[in] dev Our device to handle > */ > -static void fec_halt(struct eth_device *dev) > +static void _fec_halt(struct fec_priv *fec) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > int counter = 0x; > > /* > @@ -637,7 +632,7 @@ static void fec_halt(struct eth_device *dev) > * @param[in] length Data count in bytes > * @return 0 on success > */ > -static int fec_send(struct eth_device *dev, void *packet, int length) > +static int _fec_send(struct fec_priv *fec, void *packet, int length) > { > unsigned int status; > uint32_t size, end; > @@ -649,8 +644,6 @@ static int fec_send(struct eth_device *dev, void *packet, > int length) > * This routine transmits one frame. This routine only accepts > * 6-byte Ethernet addresses. > */ > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > - > /* > * Check for valid length of data. > */ > @@ -777,14 +770,14 @@ out: > return ret; > } > > + > /** > * Pull one frame from the card > * @param[in] dev Our ethernet device to handle > * @return Length of packet read > */ > -static int fec_recv(struct eth_device *dev) > +static int _fec_recv(struct fec_priv *fec, uchar *mac) > { > - struct fec_priv *fec = (struct fec_priv *)dev->priv; > struct fec_bd *rbd = &fec->rbd_base[fec->rbd_index]; > unsigned long ievent; > int frame_length, len = 0; > @@ -800,8 +793,8 @@ static int fec_recv(struct eth_device *dev) > writel(ievent, &fec->eth->ievent); > debug("fec_recv: ievent 0x%lx\n", ievent); > if (ievent & FEC_IEVENT_BABR) { > - fec_halt(dev); > - fec_init(dev, fec->bd); > + _fec_halt(fec); > + _fec_init(fec, mac); > printf("some error: 0x%08lx\n", ievent); > return 0; > } > @@ -813,10 +806,10 @@ static int fec_recv(struct eth_device *dev) > if (ievent & FEC_IEVENT_GRA) { > /* Graceful stop complete */ > if (readl(&fec->eth->x_cntrl) & 0x0001) { > - fec_halt(dev); > + _fec_halt(fec); > writel(~0x0001 & readl(&fec->eth->x_cntrl), > &fec->eth->x_cntrl); > - fec_init(dev, fec->bd); > + _fec_init(fec, mac); > } > } > > @@ -970,6 +963,71 @@ static void fec_f