Message ID | 1457860062-5514-4-git-send-email-wxt@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Caesar, [auto build test ERROR on next-20160311] [also build test ERROR on v4.5-rc7] [cannot apply to rockchip/for-next net-next/master v4.5-rc7 v4.5-rc6 v4.5-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Caesar-Wang/arc_emac-fixes-the-emac-issues-and-cleanup-emac-drivers/20160313-171602 config: s390-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=s390 All errors (new ones prefixed by >>): drivers/net/ethernet/arc/emac_mdio.c: In function 'arc_mdio_reset': >> drivers/net/ethernet/arc/emac_mdio.c:112:3: error: implicit declaration of function 'gpiod_set_value_cansleep' [-Werror=implicit-function-declaration] gpiod_set_value_cansleep(data->reset_gpio, 1); ^ drivers/net/ethernet/arc/emac_mdio.c: In function 'arc_mdio_probe': >> drivers/net/ethernet/arc/emac_mdio.c:149:2: error: implicit declaration of function 'devm_gpiod_get_optional' [-Werror=implicit-function-declaration] data->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", ^ >> drivers/net/ethernet/arc/emac_mdio.c:150:10: error: 'GPIOD_OUT_LOW' undeclared (first use in this function) GPIOD_OUT_LOW); ^ drivers/net/ethernet/arc/emac_mdio.c:150:10: note: each undeclared identifier is reported only once for each function it appears in cc1: some warnings being treated as errors vim +/gpiod_set_value_cansleep +112 drivers/net/ethernet/arc/emac_mdio.c 106 int arc_mdio_reset(struct mii_bus *bus) 107 { 108 struct arc_emac_priv *priv = bus->priv; 109 struct arc_emac_mdio_bus_data *data = &priv->bus_data; 110 111 if (data->reset_gpio) { > 112 gpiod_set_value_cansleep(data->reset_gpio, 1); 113 msleep(data->msec); 114 gpiod_set_value_cansleep(data->reset_gpio, 0); 115 } 116 117 return 0; 118 } 119 120 /** 121 * arc_mdio_probe - MDIO probe function. 122 * @priv: Pointer to ARC EMAC private data structure. 123 * 124 * returns: 0 on success, -ENOMEM when mdiobus_alloc 125 * (to allocate memory for MII bus structure) fails. 126 * 127 * Sets up and registers the MDIO interface. 128 */ 129 int arc_mdio_probe(struct arc_emac_priv *priv) 130 { 131 struct arc_emac_mdio_bus_data *data = &priv->bus_data; 132 struct device_node *np = priv->dev->of_node; 133 struct mii_bus *bus; 134 int error; 135 136 bus = mdiobus_alloc(); 137 if (!bus) 138 return -ENOMEM; 139 140 priv->bus = bus; 141 bus->priv = priv; 142 bus->parent = priv->dev; 143 bus->name = "Synopsys MII Bus", 144 bus->read = &arc_mdio_read; 145 bus->write = &arc_mdio_write; 146 bus->reset = &arc_mdio_reset; 147 148 /* optional reset-related properties */ > 149 data->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", > 150 GPIOD_OUT_LOW); 151 if (IS_ERR(data->reset_gpio)) { 152 error = PTR_ERR(data->reset_gpio); 153 dev_err(priv->dev, "Failed to request gpio: %d\n", error); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/net/ethernet/arc/emac.h b/drivers/net/ethernet/arc/emac.h index dae1ac3..1a40403 100644 --- a/drivers/net/ethernet/arc/emac.h +++ b/drivers/net/ethernet/arc/emac.h @@ -102,6 +102,11 @@ struct buffer_state { DEFINE_DMA_UNMAP_LEN(len); }; +struct arc_emac_mdio_bus_data { + struct gpio_desc *reset_gpio; + int msec; +}; + /** * struct arc_emac_priv - Storage of EMAC's private information. * @dev: Pointer to the current device. @@ -131,6 +136,7 @@ struct arc_emac_priv { struct device *dev; struct phy_device *phy_dev; struct mii_bus *bus; + struct arc_emac_mdio_bus_data bus_data; void __iomem *regs; struct clk *clk; diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c index d5ee986..946ea54 100644 --- a/drivers/net/ethernet/arc/emac_mdio.c +++ b/drivers/net/ethernet/arc/emac_mdio.c @@ -99,6 +99,25 @@ static int arc_mdio_write(struct mii_bus *bus, int phy_addr, } /** + * arc_mdio_reset + * @bus: points to the mii_bus structure + * Description: reset the MII bus + */ +int arc_mdio_reset(struct mii_bus *bus) +{ + struct arc_emac_priv *priv = bus->priv; + struct arc_emac_mdio_bus_data *data = &priv->bus_data; + + if (data->reset_gpio) { + gpiod_set_value_cansleep(data->reset_gpio, 1); + msleep(data->msec); + gpiod_set_value_cansleep(data->reset_gpio, 0); + } + + return 0; +} + +/** * arc_mdio_probe - MDIO probe function. * @priv: Pointer to ARC EMAC private data structure. * @@ -109,6 +128,8 @@ static int arc_mdio_write(struct mii_bus *bus, int phy_addr, */ int arc_mdio_probe(struct arc_emac_priv *priv) { + struct arc_emac_mdio_bus_data *data = &priv->bus_data; + struct device_node *np = priv->dev->of_node; struct mii_bus *bus; int error; @@ -122,6 +143,21 @@ int arc_mdio_probe(struct arc_emac_priv *priv) bus->name = "Synopsys MII Bus", bus->read = &arc_mdio_read; bus->write = &arc_mdio_write; + bus->reset = &arc_mdio_reset; + + /* optional reset-related properties */ + data->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(data->reset_gpio)) { + error = PTR_ERR(data->reset_gpio); + dev_err(priv->dev, "Failed to request gpio: %d\n", error); + return error; + } + + of_property_read_u32(np, "phy-reset-duration", &data->msec); + /* A sane reset duration should not be longer than 1s */ + if (data->msec > 1000) + data->msec = 1; snprintf(bus->id, MII_BUS_ID_SIZE, "%s", bus->name);