Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1668233
| From | Salil Mehta <salil.mehta@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC |
| Date | 2017-06-17 14:00 +0200 |
| Message-ID | <tTkyt-6Bw-1@gated-at.bofh.it> (permalink) |
| References | <tS3gl-5Od-5@gated-at.bofh.it> <tS3gm-5Od-29@gated-at.bofh.it> <tS6xz-7Me-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Andrew,
> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch]
> Sent: Wednesday, June 14, 2017 3:43 AM
> To: Salil Mehta
> Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y);
> mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; Linuxarm
> Subject: Re: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to
> HNS3 Ethernet driver for hip08 SoC
>
> > +struct hclge_mdio_cfg_cmd {
> > + u8 ctrl_bit;
> > + u8 prtad; /* The external port address */
> > + u8 devad; /* The external device address */
> > + u8 rsvd;
> > + __le16 addr_c45;/* Only valid for c45 */
> > + __le16 data_wr;
> > + __le16 data_rd;
> > + __le16 sta;
> > +};
> > +
> > +static int hclge_mdio_write(struct mii_bus *bus, int phy_id, int
> regnum,
> > + u16 data)
> > +{
> > + struct hclge_dev *hdev = (struct hclge_dev *)bus->priv;
> > + struct hclge_mdio_cfg_cmd *mdio_cmd;
> > + enum hclge_cmd_status status;
> > + struct hclge_desc desc;
> > + u8 is_c45, devad;
> > + u16 reg;
> > +
> > + if (!bus)
> > + return -EINVAL;
> > +
> > + is_c45 = !!(regnum & MII_ADDR_C45);
> > + devad = ((regnum >> 16) & 0x1f);
> > + reg = (u16)(regnum & 0xffff);
> > +
> > + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MDIO_CONFIG, false);
> > +
> > + mdio_cmd = (struct hclge_mdio_cfg_cmd *)desc.data;
> > +
> > + mdio_cmd->ctrl_bit |= HCLGE_MDIO_CTRL_START_BIT;
> > + mdio_cmd->prtad = phy_id & HCLGE_MDIO_CTRL_PRTAD_MSK;
> > + mdio_cmd->data_wr = cpu_to_le16(data);
> > + mdio_cmd->devad = devad & HCLGE_MDIO_CTRL_DEVAD_MSK;
> > +
> > + if (is_c45) {
> > + /* Set phy addr */
> > + mdio_cmd->addr_c45 = cpu_to_le16(reg);
> > + } else {
> > + /* C22 write reg and data */
> > + mdio_cmd->ctrl_bit = HCLGE_MDIO_IS_C22(!is_c45);
> > + mdio_cmd->ctrl_bit |=
> HCLGE_MDIO_CTRL_OP(HCLGE_MDIO_C22_WRITE);
> > + }
>
> When doing C22, i don't see you putting the reg into mdio_cmd anywhere?
>
You are right. Will remove.
Thanks
Salil
> Also
>
> mdio_cmd->ctrl_bit = HCLGE_MDIO_IS_C22(!is_c45);
>
> can be pulled of the if/then/else since it takes is_c45 as a
> parameter, or simplified.
>
> Andrew
Sure, thanks will do.
Salil
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-06-14 01:20 +0200
Re: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Florian Fainelli <f.fainelli@gmail.com> - 2017-06-14 01:50 +0200
RE: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-06-17 12:50 +0200
Re: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Andrew Lunn <andrew@lunn.ch> - 2017-06-14 04:50 +0200
RE: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-06-17 14:00 +0200
Re: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Andrew Lunn <andrew@lunn.ch> - 2017-06-14 05:00 +0200
RE: [PATCH V2 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-06-17 14:00 +0200
csiph-web