From patchwork Wed Sep 11 19:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Frieder Vogt X-Patchwork-Id: 13800980 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1EB1BA26C for ; Wed, 11 Sep 2024 19:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082443; cv=none; b=awshh0aOXLTOrbfsxTAe5dSX4gjTDEpm+UODDij0qi7B4Yas9ifQwZW+PdFf5oRWDmyyaMbIq0Cf2z1gi3Zz/E7+yj3+Ew0O97Gyvui3z04wDXZWT/lQQxw2rCT5ilUKVZZk35yW5q4Umjq5h7YPvO5NaoEXFtq71lv4xRi2VxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082443; c=relaxed/simple; bh=17+oqs+YPZ09Gz/uELJ4TqyCi1fPXYhH5b+1eyfecck=; h=MIME-Version:Message-ID:From:To:Cc:Subject:Content-Type:Date; b=P6JzOBwxIpQbjKuQXpNq34lDuJFWFyPTicN65epdgSxSu0xPTrXhbY00eTe1vlaBIuLMNDdNXxI+nZBbMjetTqMRQPKyF8czY0+h6EKczah3OQhWXkNQXiMlCmbo986MODCEMbKnyU9tV3XksRjUq55pIEcbwkMTpuJ802v+oUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net; spf=pass smtp.mailfrom=gmx.net; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b=AcncK/Ey; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b="AcncK/Ey" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726082420; x=1726687220; i=hfdevel@gmx.net; bh=QXH6pChaI3gjNezksD2qXQA8L9JmPM8LZed8pHslnH0=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=AcncK/EyAz63tubdQxhlr93D/t8XFqSd8DwEtrxUDYHdIJKIOXmEotXhwtUP0NhJ LYDV2TZ2wbsKv1/0VV5APN0+gn5KuetYGszPqj94NL7h18JOTdLxbC56JVHUAulFk NDsxPuoLN5RhrpXJ0r5tZEo5zZRLhapW+XjkMUcr33Hzvu6st1vIWoKpTJADVR0lv PcpPxdKT3U0GYT8CfIqcGU0RgGlRR4NS6z0NUEM4VE8ek8vmwWffn0YzwCySgNNCF K+o/OhZQXz1aKCMiQnbqCdgduc4vIjTndG5cy7psOrqzi0LYT4tNRadB64mkT0TR2 k2rm2NQkLxLWumLoKA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [77.33.175.99] ([77.33.175.99]) by web-mail.gmx.net (3c-app-gmx-bs04.server.lan [172.19.170.53]) (via HTTP); Wed, 11 Sep 2024 21:20:20 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: From: Hans-Frieder Vogt To: netdev@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , FUJITA Tomonori , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next 1/5] net: phy: aquantia: add probe function to aqr105 for firmware loading Date: Wed, 11 Sep 2024 21:20:20 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:9s1Yz162xvNpIJqlfYiAQqOnk2dsOaSDseM0fU8e2/sH02CWcZXxjG6xG0r9mkanQlk51 CYpa8QZ+0dakd8oLRXHDv2DdlC02xk+hvVHo+/gdwNKN4lpVX96oN2AZrwciCna78Y8lzVDBZCFE vhRPq1ZjtbBZaqWCXaeOLLPaWynokr7OzkUkPxDBvpWd+JgBaQjhpySoQcX1aalSqySeaDrAvj2N h8Lj3qWQHBbu9XK+bwqgIWRIEVmeV2t1MmU1eZNt+cuSHMPIFG97Ck2K4pNlWNl/c3GhKcdiJDN+ Xg= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UbxCvXVH+x4=;yCNtB2LfyZfyAK8NMwZpyDh0/CJ QE1LHxMIByWRj8zg7lEWSpNzW2bf+W2tsUG7elTSqcpwT7uFN3Ce7kNURF+2xJRpjfm2J4AtO bLTAeUe5FUDQNk375HGdnRm7nPnR71Y63L7zAp0LKfD2k/MQEWUBSKjYzY21b3oKjT/8/tLGh WZx8hx2c58KivDQl6wueJtdzhTJtqKXGhHBmj1caDYW9HatpPqN+ght1BtDvM4Rn3sljpUZzy D2N9FF9Xhli5lRxKB9iQasuWp0O4U7acswbAFBids9Rej5NYZ5zGTkbZQhgNJuptYwHUlAnSV /WAkNPTzLtYRipHQHzjepPnALLycECKo+Gcu1Nf9XSo+X3y1PRVssRopiGAY2+jZSo0n3U6nX f18h+j7fEtcVaOHnl5JXdU5WuUTv8HqZ8cQ2xHdWBR08msYd5FByw+e/YYWfEIWv7rII78KYV TTimdDNA37NShW7suMJNlqSR8Z0ddNYNJ1IaLB74E+twWwZW9QQ6oAqvCzXLw/ssCVAhOKoxq KLEVxetUKRsQ7d4BVhZNfCbWNehAh1pzsWhwr+ymfT+aKf5QPR2t3XbjQdQKUgGZuStgWqkFt jcygB87R/h+O8k6hEy9u0LbKeprSem5/pEsDkp/Fevjefp9eepTf60lLiiwGgtHMwPb+Rj69l FNnTc3REZ4I6XRsdLUPZsYc4nzO241C85xcx2yzZgw== X-Patchwork-Delegate: kuba@kernel.org Re-use the AQR107 probe function to load the firmware on the AQR105 (and to probe the HWMON). Signed-off-by: Hans-Frieder Vogt Reviewed-by: Andrew Lunn --- drivers/net/phy/aquantia/aquantia_main.c | 1 + 1 file changed, 1 insertion(+) -- 2.45.2 diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index e982e9ce44a5..54dab6db85f2 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -787,6 +787,7 @@ static struct phy_driver aqr_driver[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQR105), .name = "Aquantia AQR105", + .probe = aqr107_probe, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, From patchwork Wed Sep 11 19:24:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Frieder Vogt X-Patchwork-Id: 13800982 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9506B192D74 for ; Wed, 11 Sep 2024 19:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082680; cv=none; b=GBzxKxrmocCU+fEROpZS+2gmjQUcKr2JBl/LRsa4RlCA4zD4oh9YuME+Bh5SQoenvM0JocL5BvZe4vPrJAFk2F/zpZf0O2le4fcMqGRAh3RMYoXkis9ybPw4T8jFDln/gXmNH07/McYtOG7/TSXpUbhMku5kE7VvPOddJJr7mKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082680; c=relaxed/simple; bh=tNiAZCle51jqrkXYn5fjS8qWYzP1wL1CUYmfLIKRg4c=; h=MIME-Version:Message-ID:From:To:Cc:Subject:Content-Type:Date; b=QCOAGR7zwWCMDEROh+jQ4ZE3pkaxm/x89th2KbBDVTz20uq/G5CVDc2eep7oCqHRLWQDEJYTveQrQl/iSF9H3LWJ6RyNJAD0VXktiRpqlLtw5o8/cFYStQMY9VFdQIJa8fLP/AGdAl34Nw9VgsbK5N7iR8iiWsc7qIyWBk9mH9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net; spf=pass smtp.mailfrom=gmx.net; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b=HX7lo8dS; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b="HX7lo8dS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726082664; x=1726687464; i=hfdevel@gmx.net; bh=8nFendPoiLS8InoQAVnryr6+OGW+V7/nQ7F9M3f93SY=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=HX7lo8dSycTUbKzjJ/tVi8vUOXZizuy8AdQ8xk1r/Tuac5pmaewNL8mxeHLLcxyl ufMkYzuf+PxkELh8YVAUDGGTl8UY/cq8x0wnD0ZmdSRuhjOSuc5ywtdNo5rY1+k2K 2+JXeToMnfDtvLjxAMSxbESr3YchsL2Y8ev5JZ7sTMFMFjzPTpZxUFZ0oDYaRqZxM chFMPGZBahePmn3Hgb83i2pTeUfncNstQmAfweXN3xeJ9tHgB0bttEnYSi6e8lP6t A82s3VGA2S0TW2JyDGWlv4I5bkfKfJdOsN8cc9pW+zx55GN3SoIZ7D/NkU+aNH35p DS3AkamWKngUfDlqyg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [77.33.175.99] ([77.33.175.99]) by web-mail.gmx.net (3c-app-gmx-bs04.server.lan [172.19.170.53]) (via HTTP); Wed, 11 Sep 2024 21:24:24 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: From: Hans-Frieder Vogt To: netdev@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , FUJITA Tomonori , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next 2/5] net: phy: aquantia: allow firmware loading after aqr_wait_reset_complete Date: Wed, 11 Sep 2024 21:24:24 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:mMBphi7bkX4AUm+mxy8HUUGHKdM52rq/eM39vWPWYFItetmMffGPWcIZToy7oEHtci3cU 72lSdvUo5T+BkiszPVIqwYqWzf40DQTKZtd2hOlii99Q1uXiKSp+KKyGdgMsfllTsA1D22Ueskla ZRHuu3p8Yb8454AsVgX+YOexTkVTw5ceXe+XWDS4wKcXeLL+QaJmIZsCcXH4EAMQzIODVadBiisj BcAJYMY0EAQgVwadQyg1JQLwF4q/T6U8kVdeBoEE0YtpERiE81IQkZvOugao8X8UcAi4aeIRK+8Y rk= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:d4fzLlV0n6E=;40eqnngj4NuG/+TkKTqK+fdefjA W/usz+QbC3rm7VzppnsiHgRisQDBTnJj9WMQFQWb3meqeICWcrXlOM6JsHrn80mCnetX4ecN6 xMmhdwWzf66iEgOgscr1IfF275o4g0wJkFBSC0HCOFDJHaPWtTHwMbmzTCVg10mgOvpQg7uvC +be4X//ZrJDK/HJq1HpOzJrXtDU+MyRnIDYOtv5/i7aDfTCLDLjfuAzjg4kSQxsSAnwbl4Ba6 cCL6oHNIgNTbbxcl/NiqcoJiZc1GpeO5I5O1slqEZgn7GxI4KGMDzfTSTQXQYKfGQ9jLmvlo4 SHbKVsvOJGKdg7LQGtroVvw9DLkqSwj45DfLC+Jl4Jga4YWCC2g2+Qjte5azH8+jroflNqjd7 PgKJFSp78nt02N2PpTcK/2+SqFROqof6fp1N6EuzLlZzop+jeRmllL3R9w1bYbFQtvDpKXbfq WXbbxP80p8tCwRQhLRyTz1lAtrs2Y+RFK3VuM3c5Mh4C2ElGXpFmmb48MB3xNf17piMweNC5A 2mB9M0FWH/dWPoEESa6HT3EgAjDPp9K1XeqKqQv3EGjanF0+lRt7nFQynhi6dzLRWiw4eWdR8 95iX+/fbpZ3cSjsv37qjUcUbJ5VByhz/jAqi688/lvkICTnGLiz41qmjNQ9dHMrU2e9mzGUcy TjHqS+sb4SgZMqrvaSALcMMu63c62RxbBiVwKXIJ0g== X-Patchwork-Delegate: kuba@kernel.org Allow firmware loading from nvmem or fs. As discussed in https://lore.kernel.org/netdev/20240806112747.soclko5vex2f2c64@skbuf/ the return value -ETIMEDOUT (returned by aqr_wait_reset_complete when the firmware version is still 0 after 2s) needs to be let through. Otherwise, this will prevent loading of an external firmware. Signed-off-by: Hans-Frieder Vogt --- drivers/net/phy/aquantia/aquantia_firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.45.2 diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c index 524627a36c6f..090fcc9a3413 100644 --- a/drivers/net/phy/aquantia/aquantia_firmware.c +++ b/drivers/net/phy/aquantia/aquantia_firmware.c @@ -354,7 +354,7 @@ int aqr_firmware_load(struct phy_device *phydev) int ret; ret = aqr_wait_reset_complete(phydev); - if (ret) + if (ret != -ETIMEDOUT) return ret; /* Check if the firmware is not already loaded by pooling From patchwork Wed Sep 11 19:27:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Frieder Vogt X-Patchwork-Id: 13800983 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4268B1BA29C for ; Wed, 11 Sep 2024 19:27:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082871; cv=none; b=hcJKA6xETFKGgxOE8fwb8D86r5CibOkbpBH1V4D+pyze1B6pH50qOBxB9tGTldNNa4FuqBxC6g/8cBOXfMVNsaPK9IkAR0PWLtA7kWOFocHNpAxvFsms04j+YZUnG9X4QlXE3pTXUmQADHeS0pkOJmJ3WnmJoHbTPZkJ8d7zNpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726082871; c=relaxed/simple; bh=lUOdI08Vx4SefFAuM+p0mEpSr1iSzuxYiI5fqxsjtzw=; h=MIME-Version:Message-ID:From:To:Cc:Subject:Content-Type:Date; b=u5dOjx91474BX9m94emPHAAXYkIMzcPVbD/g/waRKhVMEwncZfwtBUTaZoJf1fchC/Rwbsmw1lP0N6Dl2rDmC+dVNxB9HihHPNF2jkXR03NiyzstxWfGxQwYC2X8PE41EmPhEGghAj6PSYGvIpC4aAlReR3Wx+pMOhs0HvQU4LE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net; spf=pass smtp.mailfrom=gmx.net; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b=RBJyTk1P; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b="RBJyTk1P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726082854; x=1726687654; i=hfdevel@gmx.net; bh=Fv1gg/XEC1jWs8cdC4B0MIL9Lzw5Bj+WFa+gSMVEOoU=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=RBJyTk1PT2GluHTNBIfqTnNQXEx1RItRP1ZY5OY85aA2wysE3Qwz+kauzEIngh0Y 3W8pvKI+N1ypcfrBxXe86h4WQUyJSh2JRH55zKg9u5Z43RTs4505+f1luchFL8Oy2 Xi8kL7wmX2fzYZ5ovOMu+y7Qc/MJxirx2M6F/0YJJ+S+LrcSaYQ1lc0bc1OENrop/ 21R0aMzix9Q3RTZXxh9ZBLaHSEXU0C8EZLZ/lPqrL+k21vc70sSSqzKXubzjmVm5L mxTV8XJPOaQmJGW04EBe5RkVlJlP4kkRj96dUKjrg/jvXLIcFzelAgmsDYSPAdEAI HMhiqqFAU/wow6H68w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [77.33.175.99] ([77.33.175.99]) by web-mail.gmx.net (3c-app-gmx-bs04.server.lan [172.19.170.53]) (via HTTP); Wed, 11 Sep 2024 21:27:34 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: From: Hans-Frieder Vogt To: netdev@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , FUJITA Tomonori , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next 3/5] net: phy: aquantia: search for firmware-name in fwnode Date: Wed, 11 Sep 2024 21:27:34 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:mrjw6ct8KCO1+iQHGsNmo8OJQ2c9Z7GrnSSdIc0PhpkXotDhVbadIxg+gxNQn0Tcu4l3R BSEc6IsF1pMk+xKfK2HxqbzNipLYrqgDHW1nZANvo/EtqRI63VpukUUXV0OOsSOqrL8AIupKp5El Ep40gJUeEsqbRogdOulQ7Nk+dL2xp7VYRd26QthzfDL+URVVvhB3KkqLLM2z+qbsYdafoZ2/FmHP Kk1AIGfCaCYsykMkarcYFVdKeuJty7btRbmKAsVYTz70gd3cpmYCUlrMCLMxbxNme19N6f4am18+ U4= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:TQ1U5C2TOP0=;jJwaKw3sfrn99dXFbkbRLvkC6SJ /VZeAVtV92AKJ3KYL9YaccNSLKISt+4fdaWoX9sG77jzsqR4CdTneFXbND8TJ2yg6k6mtkcUh YI42SZg7VELuvhuB7Ytt5qmDMl4BGcqrUAEoNZLhksKKq0h8X7LwX6Phr+ABVrtmsuvtxMMWw bS6MI/WsTPQYrYdxqeEjlTO7avB8vSx0Jn9R8aoZt2XBEB5cxD5JuYGrOtVvII39/d52Sg+AL Xl1reHko6/d4xnyKzhnw4RmjvxOdKCcbMsb7BsWFwX+v1ZwKRl6GablducfryfrBFpDf3C17N Wjnqi5RjZHmN5xucckM4XMhoJ3xzp8ssrrFlqVZ9StBk4E0acOFQshZfWAJUdpCDagNcPlreG h8fRtIwDUzKyHjywYtzNZGAf0fL2imBHjfm0AmQFzyJ2gcnu0b6Q2w4BBm88SpIGpdwahfR/9 +7LbQxxNyEXtEaf1dCQHmpafcEGO8rLEUatltuHVCvIsL6LbdKHBwUenf3iTBj42J4+3avhIi QAi9cqTEO1eqWmjCBsgHMJ28/jAaOptelD/RhoPoKMx2U2xtBhbXGe1p6i3rpDPEnvx2wmpDy 8nxu7gSvn1cEKXo5ioX/v5u/mPumO1ogMmiRQJZldz1c0/6akztq5bs/L+b3+KlTcvvj8nHTH 64KkZShEEGjnKZXud9CJetwxNWa9Ms7fP6Ppu4wzIw== X-Patchwork-Delegate: kuba@kernel.org For loading of a firmware file over the filesystem, and if the system is non-device-tree, try finding firmware-name from the software node (or: fwnode) of the mdio device. This software node may have been provided by the MAC or MDIO driver. Signed-off-by: Hans-Frieder Vogt --- drivers/net/phy/aquantia/aquantia_firmware.c | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 2.45.2 diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c index 090fcc9a3413..f6154f815d72 100644 --- a/drivers/net/phy/aquantia/aquantia_firmware.c +++ b/drivers/net/phy/aquantia/aquantia_firmware.c @@ -324,14 +324,37 @@ static int aqr_firmware_load_nvmem(struct phy_device *phydev) static int aqr_firmware_load_fs(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; + struct fwnode_handle *fw_node; const struct firmware *fw; const char *fw_name; + u32 phy_id; int ret; ret = of_property_read_string(dev->of_node, "firmware-name", &fw_name); - if (ret) + /* check if there is an fwnode connected to mdio */ + if (ret && dev->parent->fwnode) { + fw_node = fwnode_get_phy_node(dev->parent->fwnode); + if (fw_node) { + ret = fwnode_get_phy_id(fw_node, &phy_id); + if (ret) + goto cleanup_fwnode; + phy_id &= phydev->drv->phy_id_mask; + if (phy_id != (phydev->drv->phy_id & + phydev->drv->phy_id_mask)) + goto cleanup_fwnode; + + ret = fwnode_property_read_string(fw_node, + "firmware-name", + &fw_name); + } +cleanup_fwnode: + fwnode_handle_put(fw_node); + } + if (ret) { + phydev_err(phydev, "failed to read firmware name: %d\n", ret); return ret; + } ret = request_firmware(&fw, fw_name, dev); if (ret) { From patchwork Wed Sep 11 19:30:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Frieder Vogt X-Patchwork-Id: 13800984 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F146218C3E for ; Wed, 11 Sep 2024 19:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083072; cv=none; b=ZXVPQMMfkTg4FFIWMqSfobwFHYnRCt1n5qSCJEsCbU+NiKp/jd9g8hYj+RYZ7FlxVJmubSXQVI29NMbjf3pGq7ROArq6R4j7jLJgZUNY+DWFRbUtPeSKfCfYjaIDpmhonhCjNG5UTnlsWf/96MWW8WPlD73b6UVTFnsgxz5biuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083072; c=relaxed/simple; bh=FHEbTnBp5+7TgiYrC6JAXSlr3DErEOupHRmIx10enl4=; h=MIME-Version:Message-ID:From:To:Cc:Subject:Content-Type:Date; b=AXB45PtE7t+rr7zWOiSdgwphVALi27Gg3luEYeqF7TFpDjpE+GoffEJXP8s5vP5SzGKGby/blEuY6xtNY1PBG/gKbAe6aLlSpkylKuoWm6lDT2TGWsXnFz3oqTAtpLVMcfo7N+39JBvBkI4YfXPcaMPWxCL0yVVwvyhp+PsLSyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net; spf=pass smtp.mailfrom=gmx.net; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b=O85F12Ly; arc=none smtp.client-ip=212.227.15.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b="O85F12Ly" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726083054; x=1726687854; i=hfdevel@gmx.net; bh=iHGaEfRfQzTmDTdU8afcjGZKpdmQKgRW5L2Oq2i3a4g=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=O85F12LyKBw1hilchJNFtnqgva1pcLhUGEoJgq91tzZVF/sAgT6Eq3W+UiVmVv4A YsmedSLXxO32FoXnmgqb8w803MToy7WsiQKOFNrhnT/+lZjto8gjiq/b33lpp0gjC dLuPTtF+ZLQ6AD83l2kVM0qdxn2AXI1/BRhXyZ2c2D/YHTsw6SPjU0nbdK5i3MjdT aVSBzX2+fv0XbAuzwwi54XKNxVinTQNW8/29Ymb2onuYMEg3SKkWDBrlCDagOEkli upbfblLEs+eE/hTAPt8HXHkdkCYlNCklhHY8c5kyZe/FDgoZdIFTPRUc10RvHjisv oSrhOUXm9Eu0HBFQcA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [77.33.175.99] ([77.33.175.99]) by web-mail.gmx.net (3c-app-gmx-bs04.server.lan [172.19.170.53]) (via HTTP); Wed, 11 Sep 2024 21:30:54 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: From: Hans-Frieder Vogt To: netdev@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , FUJITA Tomonori , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next 4/5] net: tn40xx: enable driver to support TN4010 cards with AQR105 PHY Date: Wed, 11 Sep 2024 21:30:54 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:KXxVLJQdL6qX1u9igV5h9l3GWGQSFYtfjo4/ggw+bO2wjoXSueWjxxC0ciOrScjf9/T+A QhEqlmDjAKdkxWBFT5rlNfSiHLoAaHxSyT1v+JZ/CVQZJNmhAkagDLXwyKDQNrYQiaXHN67iZFrG y0CkhfBRJgbkJSZ/5DPi/bHAa++MWUagV38wgqKQ17uXjOe346KOUxOh0MIOI2zFkqwhOpzlbcDr G+IGaHnZR+tzvOiPqx8giRXMcBOF2cBlMywR+Xa6KJcdWaTZPvOVgr84c+qVpuar5Ecxn/+ggNOL us= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UeqX7MJJLRI=;DKcM56hnnPFHaEdItpCX2aUSdgI CaqUXGbSkcshbSOZ3tLfAfmm9fzzXmMHuG8u1E6TbOsVkaOtaNKZ/A+0q3vonlBEb0GCiqRBF IpPXDZ9WTgLgns3FkrpKhLrKQcfsLbBDZ2fxSzNjzXFP/WnJFSO9ZyXQMOFBp65IXeHcloHKF qxdAPxhr0JXN7mY/fGWzadRPg9f0YQmareAZJ5ZLXYnkiRPbo3U6gNwBOdOBkzQGF6byrfryq FtYQBM0M/j98tpMxjDDBGBnYVTxzejsRnGAMiL7Cx0F+2y4c8vll+3P0cB2gS15/6am7UmYXV G0fvM3UVu5yW8k5yzL1iCyp+uGuQhbANEiKoc99RsGKJ5h98++24kTFQqF9OjoXNizGvT/3s4 DP69+oPbvBaNanoN42LMcoe/cOlEUc2RQFRSHNqH6Bm8p4UhokIADgf0jUoIeQR/6YETmKfFn eYrbPgDp7AciDNBCG5zUBwZpYZYX6Hv41N2/+9EsZnlnwxICyaEFySsP7MY9XJCh3fmYAQ+/d xulxr31fZJ0GMtD7viMTYB9NjfcbUFlenoiCiJ7LliB4c1sz2w599lGsi7hwmD2KdqzP0uthV +vg9R6/yFtaGm57oqdZuSHQoVP4zygrhScXMIeX6cbUN9mkVlqfveAITu5qdQx56+hi27KuGG 4QJLBBa2UbKZg78CNMc247Qa8wGDGWPhwvEMgIle0g== X-Patchwork-Delegate: kuba@kernel.org Prepare the tn40xx driver to load for Tehuti TN9510 cards and set bit 3 in the TN40_REG_MDIO_CMD_STAT register, because otherwise the AQR105 PHY will not be found. The function of bit 3 is unclear, but may have something to do with the length of the preamble in MDIO communication. Signed-off-by: Hans-Frieder Vogt --- drivers/net/ethernet/tehuti/tn40.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.45.2 diff --git a/drivers/net/ethernet/tehuti/tn40.c b/drivers/net/ethernet/tehuti/tn40.c index 259bdac24cf2..4e6f2f781ffc 100644 --- a/drivers/net/ethernet/tehuti/tn40.c +++ b/drivers/net/ethernet/tehuti/tn40.c @@ -1760,6 +1760,9 @@ static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_unset_drvdata; } + /* essential for identification of some PHYs is bit 3 set */ + ret = tn40_read_reg(priv, TN40_REG_MDIO_CMD_STAT); + tn40_write_reg(priv, TN40_REG_MDIO_CMD_STAT, ret | 0x8); ret = tn40_mdiobus_init(priv); if (ret) { dev_err(&pdev->dev, "failed to initialize mdio bus.\n"); @@ -1832,6 +1835,7 @@ static const struct pci_device_id tn40_id_table[] = { PCI_VENDOR_ID_ASUSTEK, 0x8709) }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, 0x4022, PCI_VENDOR_ID_EDIMAX, 0x8103) }, + { PCI_VDEVICE(TEHUTI, 0x4025), 0 }, { } }; From patchwork Wed Sep 11 19:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Frieder Vogt X-Patchwork-Id: 13800985 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 288E358AC4 for ; Wed, 11 Sep 2024 19:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083304; cv=none; b=Uq6+kjdog+2TP6r6RiicLFKQJAukGNyDbA2xy5eq+DwK7uzpMOZZ5wiG66wAc7O/L6V8FSLUE6wMjZNOb6HVVzZSMMIhwGzKq3E2E5y8mUYHaUlFSbrymoWqLNlRQdChoESmDpCK/j7/Zcny2inxEMhMsEPPCmx5KjZymE7qoyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726083304; c=relaxed/simple; bh=axuNo1nZ2tu+F0uU6zs0BBBVhTEUVv7cZlRk5j+0yU8=; h=MIME-Version:Message-ID:From:To:Cc:Subject:Content-Type:Date; b=sjfP/kXG2FgU4KcG19gz1JhzUTRctkentC9dWVV68yHCSaojhxIGlt1W69ePOIzCfqml7xAc8vOWUWxV80+xM9WT9WbEoDGIV4Zke1RcoH4/GIjYqYNmGXhBLkfLuYFrXXKZldDjchP8u5zYpDzA5F0n4VkpkB5VYthqloIMvPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net; spf=pass smtp.mailfrom=gmx.net; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b=ksk2lRff; arc=none smtp.client-ip=212.227.15.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=hfdevel@gmx.net header.b="ksk2lRff" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726083287; x=1726688087; i=hfdevel@gmx.net; bh=jT6lr+wj/vlcXsGK+AgyJh78W0qnZTV364UzhMOA6P0=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=ksk2lRff8fX9qB1pFkQ9Z+xHrfCXUrMjgtlNHlICP5O4jm7Uye6w2VxbkTGywwhX iX2kUB9Jcy53pRSUwYY52ja4r/Amus4/ChobN2iyOfolNKzVNVOfJsHLe1V1Ay+nH ljUhSrnl5f/yoV26xtLR521vHCig03ImAOgReSxFNGsDOqcOkokmNGgFcCBOfv/K6 rtUQqaOcjqaY+wy1ZdJ15VxKO5Ymyf44TzFsXgOh56IzNM+jYDmwxVC8zfX4LotEc cLbIutXDaGZwfG/eZtWp6fUufi3PzRzanUiCIlDNZ1VeFhlZ+QOtnIQdpEDSFLl0W y97eyQkOwkhXaZxP3Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [77.33.175.99] ([77.33.175.99]) by web-mail.gmx.net (3c-app-gmx-bs04.server.lan [172.19.170.53]) (via HTTP); Wed, 11 Sep 2024 21:34:47 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: From: Hans-Frieder Vogt To: netdev@vger.kernel.org Cc: Andrew Lunn , Heiner Kallweit , Russell King , FUJITA Tomonori , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next 5/5] net: tn40xx: register swnode and connect it to the mdiobus Date: Wed, 11 Sep 2024 21:34:47 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:DOTfdgfSNfF7nZLdh5ovdzHc711UDiIr1Bpr+ZhYU2oI7vQqQtUnCPmF+tAHng/8ZMw6P MuLn/FBMVWS0fcW6tR0W6agCNjBOsUhs+7vVgQQV58cP2Yw/achgtEwQoxWbcvFF0m2yp1g0Rqki hpWD5K35zrLrsccdtu/03p6rS+IynecIHlorYIbH0+Q1CkPp2NGxQamRlQvcgVl5+Lqnww2dsdSX wRhhmsIMiSRAvjKQuwoq8PPB/92ApzpudGvjVjYaSTG19Twl0xkAF1wg+Hl533z++N0e/b3Ajo/f rc= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:1YdswcYv9EQ=;D83lWTlp3uGf/sGNg5E+cqvDQkL mt88iYtZgl5zqyKUkzE51flFuWBUIc4V6TEgmFXiaZrhzJf1vCVLoXLEJHkAysukDO7YLWPow dYJ5/Dtr90ruj2agqDT5tKy45W1cn43F8p2PNCBJn3VbP+kDxOb07fQ0cL7pQnSUNf7nigzH7 /C6cDzE3om/An2VRX42K+ilSckfrx5zyg7pijD0flm89h/HlXCpdbedtQhSGKOTzvuYvItgcl 4/n1sqNUfh3/Chi46gfVwQgCmnLucUlqLUP8JrFuty4fMXYIWpc+E/yz7DmohDxXDdxFrn4+P FXvdmR+kR5PPvrFrjIa6nOQNQT6TP+V+JmvHRMebQyK85Ew5bVcMlLtsVWzMgr8HO8zF4TfH0 wLwTttp4FON9nQNmik5TyskWnivLje7X9gl5rZbFAKgCCtKIYS0+NO/i6Ma5WpTmVNcbdJTov pBeLh4FEXvXSf0O3T7yglzp76SyUd85i2yZk7u/0gh1rROYZ/DSd+2rBj6S22g7jOT8uqqymG WA+ctead7byDg6JH8gbI6DYPC1hEJeKGcek2HOGuIiFUB2mNtT4vaNZBBrPRwRzRoc1IK8xNT p/IbVw650Ws7zT2z99zfpAN0VgTxGtrxlwIeuKq9441QRVc/3GJSO1eVj4B76Tajr8rohUdNq 83O9+xLwZU3bKvDSKzF87iKIrbKqSdu4cxYmLflo4Q== X-Patchwork-Delegate: kuba@kernel.org Create a software node (or fwnode) for the mdio function and a linked node for the Aquantia AQR105 PHY, providing a firmware-name to allow the PHY to load a MAC/MDIO specific firmware. I suggest to place the firmware in the directory, where there is already the firmware for the TN4010 MAC, so avoid pollution of the firmware directory. There is currently a little problem in the code that leads to an extra increment of the usage counter of the software node priv->nodes.group[SWNODE_MDIO] somewhere. Therefore, I need to unregister it twice. This is hopefully only a temporary workaround. Signed-off-by: Hans-Frieder Vogt --- drivers/net/ethernet/tehuti/tn40.c | 10 +++- drivers/net/ethernet/tehuti/tn40.h | 25 ++++++++++ drivers/net/ethernet/tehuti/tn40_mdio.c | 63 ++++++++++++++++++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) -- 2.45.2 diff --git a/drivers/net/ethernet/tehuti/tn40.c b/drivers/net/ethernet/tehuti/tn40.c index 4e6f2f781ffc..240a79a08d58 100644 --- a/drivers/net/ethernet/tehuti/tn40.c +++ b/drivers/net/ethernet/tehuti/tn40.c @@ -1781,7 +1781,7 @@ static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret = tn40_phy_register(priv); if (ret) { dev_err(&pdev->dev, "failed to set up PHY.\n"); - goto err_free_irq; + goto err_unregister_swnodes; } ret = tn40_priv_init(priv); @@ -1798,6 +1798,10 @@ static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return 0; err_unregister_phydev: tn40_phy_unregister(priv); +err_unregister_swnodes: + device_remove_software_node(&priv->mdio->dev); + software_node_unregister_node_group(priv->nodes.group); + software_node_unregister(priv->nodes.group[SWNODE_MDIO]); err_free_irq: pci_free_irq_vectors(pdev); err_unset_drvdata: @@ -1819,6 +1823,10 @@ static void tn40_remove(struct pci_dev *pdev) unregister_netdev(ndev); tn40_phy_unregister(priv); + /* cleanup software nodes */ + device_remove_software_node(&priv->mdio->dev); + software_node_unregister_node_group(priv->nodes.group); + software_node_unregister(priv->nodes.group[SWNODE_MDIO]); pci_free_irq_vectors(priv->pdev); pci_set_drvdata(pdev, NULL); iounmap(priv->regs); diff --git a/drivers/net/ethernet/tehuti/tn40.h b/drivers/net/ethernet/tehuti/tn40.h index 490781fe5120..1897c79333f8 100644 --- a/drivers/net/ethernet/tehuti/tn40.h +++ b/drivers/net/ethernet/tehuti/tn40.h @@ -4,6 +4,7 @@ #ifndef _TN40_H_ #define _TN40_H_ +#include #include "tn40_regs.h" #define TN40_DRV_NAME "tn40xx" @@ -102,10 +103,34 @@ struct tn40_txdb { int size; /* Number of elements in the db */ }; +#define NODE_PROP(_NAME, _PROP) ( \ + (const struct software_node) { \ + .name = _NAME, \ + .properties = _PROP, \ + }) + +enum tn40_swnodes { + SWNODE_MDIO, + SWNODE_PHY, + SWNODE_MAX +}; + +struct tn40_nodes { + char phy_name[32]; + char mdio_name[32]; + struct property_entry phy_props[2]; + struct property_entry mdio_props[1]; + struct software_node_ref_args phy_ref[1]; + struct software_node swnodes[SWNODE_MAX]; + const struct software_node *group[SWNODE_MAX + 1]; +}; + struct tn40_priv { struct net_device *ndev; struct pci_dev *pdev; + struct tn40_nodes nodes; + struct napi_struct napi; /* RX FIFOs: 1 for data (full) descs, and 2 for free descs */ struct tn40_rxd_fifo rxd_fifo0; diff --git a/drivers/net/ethernet/tehuti/tn40_mdio.c b/drivers/net/ethernet/tehuti/tn40_mdio.c index af18615d64a8..bbd95fabbea0 100644 --- a/drivers/net/ethernet/tehuti/tn40_mdio.c +++ b/drivers/net/ethernet/tehuti/tn40_mdio.c @@ -14,6 +14,8 @@ (FIELD_PREP(TN40_MDIO_PRTAD_MASK, (port)))) #define TN40_MDIO_CMD_READ BIT(15) +#define AQR105_FIRMWARE "tehuti/aqr105-tn40xx.cld" + static void tn40_mdio_set_speed(struct tn40_priv *priv, u32 speed) { void __iomem *regs = priv->regs; @@ -111,6 +113,44 @@ static int tn40_mdio_write_c45(struct mii_bus *mii_bus, int addr, int devnum, return tn40_mdio_write(mii_bus->priv, addr, devnum, regnum, val); } +/* registers an mdio handle and an aqr105 PHY + * tn40_mdio-%id { + * phy-handle = <&tn40_aqr105_phy>; + * }; + * tn40_aqr105_phy { + * compatible = "ethernet-phy-id03a1.b4a3"; + * firmware-name = AQR105_FIRMWARE; + * }; + */ +static int tn40_swnodes_register(struct tn40_priv *priv) +{ + struct tn40_nodes *nodes = &priv->nodes; + struct pci_dev *pdev = priv->pdev; + struct software_node *swnodes; + u32 id; + + id = pci_dev_id(pdev); + + snprintf(nodes->phy_name, sizeof(nodes->phy_name), "tn40_aqr105_phy"); + snprintf(nodes->mdio_name, sizeof(nodes->mdio_name), "tn40_mdio-%x", + id); + + swnodes = nodes->swnodes; + + nodes->phy_props[0] = PROPERTY_ENTRY_STRING("compatible", + "ethernet-phy-id03a1.b4a3"); + nodes->phy_props[1] = PROPERTY_ENTRY_STRING("firmware-name", + AQR105_FIRMWARE); + swnodes[SWNODE_PHY] = NODE_PROP(nodes->phy_name, nodes->phy_props); + nodes->phy_ref[0] = SOFTWARE_NODE_REFERENCE(&swnodes[SWNODE_PHY]); + + nodes->mdio_props[0] = PROPERTY_ENTRY_REF_ARRAY("phy", nodes->phy_ref); + swnodes[SWNODE_MDIO] = NODE_PROP(nodes->mdio_name, nodes->mdio_props); + nodes->group[SWNODE_PHY] = &swnodes[SWNODE_PHY]; + nodes->group[SWNODE_MDIO] = &swnodes[SWNODE_MDIO]; + return software_node_register_node_group(nodes->group); +} + int tn40_mdiobus_init(struct tn40_priv *priv) { struct pci_dev *pdev = priv->pdev; @@ -130,13 +170,34 @@ int tn40_mdiobus_init(struct tn40_priv *priv) bus->read_c45 = tn40_mdio_read_c45; bus->write_c45 = tn40_mdio_write_c45; + ret = tn40_swnodes_register(priv); + if (ret) { + pr_err("swnodes failed\n"); + return ret; + } + + ret = device_add_software_node(&bus->dev, + priv->nodes.group[SWNODE_MDIO]); + if (ret) { + dev_err(&pdev->dev, "device_add_software_node failed: %d\n", + ret); + } + ret = devm_mdiobus_register(&pdev->dev, bus); if (ret) { dev_err(&pdev->dev, "failed to register mdiobus %d %u %u\n", ret, bus->state, MDIOBUS_UNREGISTERED); - return ret; + goto err_swnodes_unregister; } tn40_mdio_set_speed(priv, TN40_MDIO_SPEED_6MHZ); priv->mdio = bus; return 0; + +err_swnodes_unregister: + device_remove_software_node(&bus->dev); + software_node_unregister_node_group(priv->nodes.group); + software_node_unregister(priv->nodes.group[SWNODE_MDIO]); + return ret; } + +MODULE_FIRMWARE(AQR105_FIRMWARE);