From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753802AbbHERSS (ORCPT ); Wed, 5 Aug 2015 13:18:18 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:63749 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753199AbbHERSQ convert rfc822-to-8bit (ORCPT ); Wed, 5 Aug 2015 13:18:16 -0400 Date: Wed, 5 Aug 2015 18:18:13 +0100 From: Liviu Dudau To: Ryan Harkin Cc: Mirko Lindner , Stephen Hemminger , netdev , lkml Subject: Re: [PATCH] sky2: Add module parameter for passing the MAC address Message-ID: <20150805171812.GH20890@e106497-lin.cambridge.arm.com> References: <1438789854-29194-1-git-send-email-Liviu.Dudau@arm.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) X-OriginalArrivalTime: 05 Aug 2015 17:18:13.0068 (UTC) FILETIME=[B58358C0:01D0CFA2] X-MC-Unique: qJJ1yoKfTceA8Tqyf3K3Bw-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 05, 2015 at 06:15:37PM +0100, Ryan Harkin wrote: > On 5 August 2015 at 16:50, Liviu Dudau <[1]Liviu.Dudau@arm.com> wrote: > > For designs where EEPROMs are not connected to PCI Yukon2 > chips we need to get the MAC address from the firmware. > Add a module parameter called 'mac_address' for this. It > will be used if no DT node can be found and the B2_MAC > register holds an invalid value. > > Signed-off-by: Liviu Dudau <[2]Liviu.Dudau@arm.com> > > Looks good to me.  FWIW, you can have a tested or reviewed-by at your preference: > Tested-by: Ryan Harkin <[3]ryan.harkin@linaro.org> > Reviewed-by: Ryan Harkin <[4]ryan.harkin@linaro.org> > Thanks Ryan, I think one can provide both tags, so I will use them together. Best regards, Liviu >   > > --- >  drivers/net/ethernet/marvell/sky2.c | 14 +++++++++++++- >  1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c > index d9f4498..a977d95 100644 > --- a/drivers/net/ethernet/marvell/sky2.c > +++ b/drivers/net/ethernet/marvell/sky2.c > @@ -101,6 +101,10 @@ static int legacy_pme = 0; >  module_param(legacy_pme, int, 0); >  MODULE_PARM_DESC(legacy_pme, "Legacy power management"); > > +/* Ugh!  Let the firmware tell us the hardware address */ > +static int mac_address[ETH_ALEN] = { 0, }; > +module_param_array(mac_address, int, NULL, 0); > + >  static const struct pci_device_id sky2_id_table[] = { >         { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */ >         { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ > @@ -4811,13 +4815,21 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, >         /* try to get mac address in the following order: >          * 1) from device tree data >          * 2) from internal registers set by bootloader > +        * 3) from the command line parameter >          */ >         iap = of_get_mac_address(hw->pdev->dev.of_node); >         if (iap) >                 memcpy(dev->dev_addr, iap, ETH_ALEN); > -       else > +       else { >                 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, >                               ETH_ALEN); > +               if (!is_valid_ether_addr(&dev->dev_addr[0])) { > +                       int i; > + > +                       for (i = 0; i < ETH_ALEN; i++) > +                               dev->dev_addr[i] = mac_address[i]; > +               } > +       } > >         return dev; >  } > -- > 2.4.6 > > References > > Visible links > 1. mailto:Liviu.Dudau@arm.com > 2. mailto:Liviu.Dudau@arm.com > 3. mailto:ryan.harkin@linaro.org > 4. mailto:ryan.harkin@linaro.org -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯