{"id":808527,"url":"http://patchwork.ozlabs.org/api/1.2/patches/808527/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1504241089.4974.67.camel@kernel.crashing.org/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504241089.4974.67.camel@kernel.crashing.org>","list_archive_url":null,"date":"2017-09-01T04:44:49","name":"net: ethernet: ibm-emac: Add 5482 PHY init for OpenBlocks 600","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"a3788e7597e57cd3d0c88d3be1369c8ae6ebd952","submitter":{"id":38,"url":"http://patchwork.ozlabs.org/api/1.2/people/38/?format=json","name":"Benjamin Herrenschmidt","email":"benh@kernel.crashing.org"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1504241089.4974.67.camel@kernel.crashing.org/mbox/","series":[{"id":948,"url":"http://patchwork.ozlabs.org/api/1.2/series/948/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=948","date":"2017-09-01T04:44:49","name":"net: ethernet: ibm-emac: Add 5482 PHY init for OpenBlocks 600","version":1,"mbox":"http://patchwork.ozlabs.org/series/948/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808527/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808527/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xk69P3PfTz9s7p\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 14:44:57 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751365AbdIAEoy (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 00:44:54 -0400","from gate.crashing.org ([63.228.1.57]:55387 \"EHLO\n\tgate.crashing.org\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1750996AbdIAEox (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 1 Sep 2017 00:44:53 -0400","from localhost (localhost.localdomain [127.0.0.1])\n\tby gate.crashing.org (8.14.1/8.13.8) with ESMTP id v814inR0009452\n\tfor <netdev@vger.kernel.org>; Thu, 31 Aug 2017 23:44:51 -0500"],"Message-ID":"<1504241089.4974.67.camel@kernel.crashing.org>","Subject":"[PATCH] net: ethernet: ibm-emac: Add 5482 PHY init for OpenBlocks\n\t600","From":"Benjamin Herrenschmidt <benh@kernel.crashing.org>","To":"netdev@vger.kernel.org","Date":"Fri, 01 Sep 2017 14:44:49 +1000","Content-Type":"text/plain; charset=\"UTF-8\"","X-Mailer":"Evolution 3.24.5 (3.24.5-1.fc26) ","Mime-Version":"1.0","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"The vendor patches initialize those registers to get the\nPHY working properly.\n\nSadly I don't have that PHY spec and whatever Broadcom PHY\ncode we already have don't seem to document these two shadow\nregisters (unless I miscalculated the address) so I'm keeping\nthis as \"vendor magic for that board\". The vendor has long\nabandoned that product, but I find it handy to test ppc405\nkernels and so would like to keep it alive upstream :-)\n\nSigned-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>\n---\n\nNote: Ideally, the whole driver should switch over to the\ngeneric PHY layer. However this is a much bigger undertaking\nwhich requires access to a bunch of HW to test, and for which\nI have neither the time nor the HW available these days.\n\n(Some of the HW could prove hard to find ...)\n---\n drivers/net/ethernet/ibm/emac/phy.c | 30 ++++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)","diff":"diff --git a/drivers/net/ethernet/ibm/emac/phy.c b/drivers/net/ethernet/ibm/emac/phy.c\nindex 35865d05fccd..daa10de542fb 100644\n--- a/drivers/net/ethernet/ibm/emac/phy.c\n+++ b/drivers/net/ethernet/ibm/emac/phy.c\n@@ -24,6 +24,7 @@\n #include <linux/mii.h>\n #include <linux/ethtool.h>\n #include <linux/delay.h>\n+#include <linux/of.h>\n \n #include \"emac.h\"\n #include \"phy.h\"\n@@ -363,6 +364,34 @@ static struct mii_phy_def bcm5248_phy_def = {\n \t.ops\t\t= &generic_phy_ops\n };\n \n+static int bcm5482_init(struct mii_phy *phy)\n+{\n+\tif (!of_machine_is_compatible(\"plathome,obs600\"))\n+\t\treturn 0;\n+\n+\t/* Magic inits from vendor original patches */\n+\tphy_write(phy, 0x1c, 0xa410);\n+\tphy_write(phy, 0x1c, 0x8804);\n+\n+\treturn 0;\n+}\n+\n+static const struct mii_phy_ops bcm5482_phy_ops = {\n+\t.init\t\t= bcm5482_init,\n+\t.setup_aneg\t= genmii_setup_aneg,\n+\t.setup_forced\t= genmii_setup_forced,\n+\t.poll_link\t= genmii_poll_link,\n+\t.read_link\t= genmii_read_link\n+};\n+\n+static struct mii_phy_def bcm5482_phy_def = {\n+\n+\t.phy_id\t\t= 0x0143bcb0,\n+\t.phy_id_mask\t= 0x0ffffff0,\n+\t.name\t\t= \"BCM5482 Gigabit Ethernet\",\n+\t.ops\t\t= &bcm5482_phy_ops\n+};\n+\n static int m88e1111_init(struct mii_phy *phy)\n {\n \tpr_debug(\"%s: Marvell 88E1111 Ethernet\\n\", __func__);\n@@ -499,6 +528,7 @@ static struct mii_phy_def *mii_phy_table[] = {\n \t&et1011c_phy_def,\n \t&cis8201_phy_def,\n \t&bcm5248_phy_def,\n+\t&bcm5482_phy_def,\n \t&m88e1111_phy_def,\n \t&m88e1112_phy_def,\n \t&ar8035_phy_def,\n","prefixes":[]}