Message ID | 20160725131023.30656-4-vigneshr@ti.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
On Mon, Jul 25, 2016 at 06:40:22PM +0530, Vignesh R wrote: > On DRA72 EVM, cpsw slaves may be muxed with other modules. This > selection is controlled by a pcf gpio line. Add support for cpsw driver > to acquire mode-gpios and select the appropriate slave using gpio APIs. > > Signed-off-by: Vignesh R <vigneshr@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Minor nit below: > @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) > return -ENOENT; > } > > + > + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); Extra blank line added.
On 7/25/2016 7:08 PM, Tom Rini wrote: > On Mon, Jul 25, 2016 at 06:40:22PM +0530, Vignesh R wrote: > >> On DRA72 EVM, cpsw slaves may be muxed with other modules. This >> selection is controlled by a pcf gpio line. Add support for cpsw driver >> to acquire mode-gpios and select the appropriate slave using gpio APIs. >> >> Signed-off-by: Vignesh R <vigneshr@ti.com> > > Reviewed-by: Tom Rini <trini@konsulko.com> > > Minor nit below: > >> @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) >> return -ENOENT; >> } >> >> + >> + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); > > Extra blank line added. I added blank line for readability. So, that code block handling toggling of "mode-gpios" is separated from the rest. I can remove that if that seems unnecessary.
Dear "R, Vignesh", In message <a210f61e-bf51-a946-013c-dd98fd9a17b0@ti.com> you wrote: > > >> @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) > >> return -ENOENT; > >> } > >> > >> + > >> + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); > > > > Extra blank line added. > > I added blank line for readability. So, that code block handling > toggling of "mode-gpios" is separated from the rest. I can remove that > if that seems unnecessary. There was already a blank line which provides enough separation. No need to have multiple consecutive blank lines. Best regards, Wolfgang Denk
On 7/26/2016 12:26 PM, Wolfgang Denk wrote: > Dear "R, Vignesh", > > In message <a210f61e-bf51-a946-013c-dd98fd9a17b0@ti.com> you wrote: >> >>>> @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) >>>> return -ENOENT; >>>> } >>>> >>>> + >>>> + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); >>> >>> Extra blank line added. >> >> I added blank line for readability. So, that code block handling >> toggling of "mode-gpios" is separated from the rest. I can remove that >> if that seems unnecessary. > > There was already a blank line which provides enough separation. No > need to have multiple consecutive blank lines. Sorry, will clean that up in v2. Thanks! Regards Vignesh
On Tue, Jul 26, 2016 at 12:07:26PM +0530, R, Vignesh wrote: > > > On 7/25/2016 7:08 PM, Tom Rini wrote: > > On Mon, Jul 25, 2016 at 06:40:22PM +0530, Vignesh R wrote: > > > >> On DRA72 EVM, cpsw slaves may be muxed with other modules. This > >> selection is controlled by a pcf gpio line. Add support for cpsw driver > >> to acquire mode-gpios and select the appropriate slave using gpio APIs. > >> > >> Signed-off-by: Vignesh R <vigneshr@ti.com> > > > > Reviewed-by: Tom Rini <trini@konsulko.com> > > > > Minor nit below: > > > >> @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) > >> return -ENOENT; > >> } > >> > >> + > >> + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); > > > > Extra blank line added. > > I added blank line for readability. So, that code block handling > toggling of "mode-gpios" is separated from the rest. I can remove that > if that seems unnecessary. Two empty lines in a row just isn't done so yes please, thanks.
On Tuesday 26 July 2016 05:43 PM, Tom Rini wrote: > On Tue, Jul 26, 2016 at 12:07:26PM +0530, R, Vignesh wrote: >> >> >> On 7/25/2016 7:08 PM, Tom Rini wrote: >>> On Mon, Jul 25, 2016 at 06:40:22PM +0530, Vignesh R wrote: >>> >>>> On DRA72 EVM, cpsw slaves may be muxed with other modules. This >>>> selection is controlled by a pcf gpio line. Add support for cpsw driver >>>> to acquire mode-gpios and select the appropriate slave using gpio APIs. >>>> >>>> Signed-off-by: Vignesh R <vigneshr@ti.com> >>> >>> Reviewed-by: Tom Rini <trini@konsulko.com> >>> >>> Minor nit below: >>> >>>> @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) >>>> return -ENOENT; >>>> } >>>> >>>> + >>>> + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); >>> >>> Extra blank line added. >> >> I added blank line for readability. So, that code block handling >> toggling of "mode-gpios" is separated from the rest. I can remove that >> if that seems unnecessary. > > Two empty lines in a row just isn't done so yes please, thanks. Sorry, I overlooked two empty lines. Will fix this in v2. Thanks for the review.
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 2ce4ec69f1df..83be336cf39c 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -22,6 +22,7 @@ #include <netdev.h> #include <cpsw.h> #include <asm/errno.h> +#include <asm/gpio.h> #include <asm/io.h> #include <phy.h> #include <asm/arch/cpu.h> @@ -1152,12 +1153,14 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); struct cpsw_priv *priv = dev_get_priv(dev); + struct gpio_desc *mode_gpios; const char *phy_mode; const void *fdt = gd->fdt_blob; int node = dev->of_offset; int subnode; int slave_index = 0; int active_slave; + int num_mode_gpios; int ret; pdata->iobase = dev_get_addr(dev); @@ -1203,6 +1206,16 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) return -ENOENT; } + + num_mode_gpios = gpio_get_list_count(dev, "mode-gpios"); + if (num_mode_gpios > 0) { + mode_gpios = malloc(sizeof(struct gpio_desc) * + num_mode_gpios); + gpio_request_list_by_name(dev, "mode-gpios", mode_gpios, + num_mode_gpios, GPIOD_IS_OUT); + free(mode_gpios); + } + active_slave = fdtdec_get_int(fdt, node, "active_slave", 0); priv->data.active_slave = active_slave;
On DRA72 EVM, cpsw slaves may be muxed with other modules. This selection is controlled by a pcf gpio line. Add support for cpsw driver to acquire mode-gpios and select the appropriate slave using gpio APIs. Signed-off-by: Vignesh R <vigneshr@ti.com> --- drivers/net/cpsw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)