get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/189/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 189,
    "url": "http://patchwork.ozlabs.org/api/patches/189/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1220658734-13944-1-git-send-email-vgallardo@amcc.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<1220658734-13944-1-git-send-email-vgallardo@amcc.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1220658734-13944-1-git-send-email-vgallardo@amcc.com/",
    "date": "2008-09-05T23:52:14",
    "name": "ibm_newemac: Add support for GPCS, SGMII and M88E1112 PHY",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6117e21a70cb1af1fb5a39c0d07ea3a91da33bc5",
    "submitter": {
        "id": 111,
        "url": "http://patchwork.ozlabs.org/api/people/111/?format=api",
        "name": "Victor Gallardo",
        "email": "vgallardo@amcc.com"
    },
    "delegate": {
        "id": 11,
        "url": "http://patchwork.ozlabs.org/api/users/11/?format=api",
        "username": "jwboyer",
        "first_name": "Josh",
        "last_name": "Boyer",
        "email": "jwboyer@gmail.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1220658734-13944-1-git-send-email-vgallardo@amcc.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/189/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/189/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org>",
        "X-Original-To": [
            "patchwork@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork@ozlabs.org",
            "linuxppc-dev@ozlabs.org"
        ],
        "Received": [
            "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id AB021DE0D8\n\tfor <patchwork@ozlabs.org>; Sat,  6 Sep 2008 09:52:36 +1000 (EST)",
            "from sdcmail02.amcc.com (sdcmail02.amcc.com [198.137.200.73])\n\t(using TLSv1 with cipher RC4-SHA (128/128 bits))\n\t(Client CN \"Messaging Gateway Appliance Demo Cert\",\n\tIssuer \"Messaging Gateway Appliance Demo Cert\" (not verified))\n\tby ozlabs.org (Postfix) with ESMTPS id 40A69DDDE3\n\tfor <linuxppc-dev@ozlabs.org>; Sat,  6 Sep 2008 09:52:18 +1000 (EST)",
            "from sdcexch01.amcc.com (HELO sdcexchange01.amcc.com)\n\t([10.64.18.50])\n\tby sdcmail02-int1.amcc.com with ESMTP; 05 Sep 2008 16:52:15 -0700",
            "from amcc.com ([10.66.12.74]) by sdcexchange01.amcc.com with\n\tMicrosoft SMTPSVC(6.0.3790.3959); Fri, 5 Sep 2008 16:52:14 -0700",
            "(from vgallard@localhost)\n\tby amcc.com (8.13.8/8.12.2/Submit) id m85NqE7w013964;\n\tFri, 5 Sep 2008 16:52:14 -0700"
        ],
        "X-IronPort-AV": "E=Sophos;i=\"4.32,342,1217833200\"; d=\"scan'208\";a=\"1271639\"",
        "From": "Victor Gallardo <vgallardo@amcc.com>",
        "To": "linuxppc-dev@ozlabs.org;netdev@vger.kernel.org;",
        "Subject": "[PATCH] ibm_newemac: Add support for GPCS, SGMII and M88E1112 PHY",
        "Date": "Fri,  5 Sep 2008 16:52:14 -0700",
        "Message-Id": "<1220658734-13944-1-git-send-email-vgallardo@amcc.com>",
        "X-Mailer": "git-send-email 1.5.5",
        "X-OriginalArrivalTime": "05 Sep 2008 23:52:15.0080 (UTC)\n\tFILETIME=[6C355680:01C90FB2]",
        "Cc": "Victor Gallardo <vgallardo@amcc.com>, Feng Kan <fkan@amcc.com>",
        "X-BeenThere": "linuxppc-dev@ozlabs.org",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>",
        "List-Unsubscribe": "<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://ozlabs.org/pipermail/linuxppc-dev>",
        "List-Post": "<mailto:linuxppc-dev@ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@ozlabs.org?subject=help>",
        "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org",
        "Errors-To": "linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org"
    },
    "content": "From: Victor Gallardo <vgallardo@amcc.com>\n\nThis patch adds GPCS, SGMII and M88E1112 PHY support\nfor the AMCC PPC460GT/EX processors.\n\nSigned-off-by: Victor Gallardo <vgallardo@amcc.com>",
    "diff": "diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c\nindex 2e720f2..cef76fe 100644\n--- a/drivers/net/ibm_newemac/core.c\n+++ b/drivers/net/ibm_newemac/core.c\n@@ -201,13 +201,15 @@ static inline int emac_phy_supports_gige(int phy_mode)\n {\n \treturn  phy_mode == PHY_MODE_GMII ||\n \t\tphy_mode == PHY_MODE_RGMII ||\n+\t\tphy_mode == PHY_MODE_SGMII ||\n \t\tphy_mode == PHY_MODE_TBI ||\n \t\tphy_mode == PHY_MODE_RTBI;\n }\n \n static inline int emac_phy_gpcs(int phy_mode)\n {\n-\treturn  phy_mode == PHY_MODE_TBI ||\n+\treturn  phy_mode == PHY_MODE_SGMII ||\n+\t\tphy_mode == PHY_MODE_TBI ||\n \t\tphy_mode == PHY_MODE_RTBI;\n }\n \n@@ -547,8 +549,9 @@ static int emac_configure(struct emac_instance *dev)\n \tswitch (dev->phy.speed) {\n \tcase SPEED_1000:\n \t\tif (emac_phy_gpcs(dev->phy.mode)) {\n-\t\t\tmr1 |= EMAC_MR1_MF_1000GPCS |\n-\t\t\t\tEMAC_MR1_MF_IPPA(dev->phy.address);\n+\t\t\tmr1 |= EMAC_MR1_MF_1000GPCS | EMAC_MR1_MF_IPPA(\n+\t\t\t\t(dev->phy.gpcs_address != 0xffffffff) ?\n+\t\t\t\t dev->phy.gpcs_address : dev->phy.address);\n \n \t\t\t/* Put some arbitrary OUI, Manuf & Rev IDs so we can\n \t\t\t * identify this GPCS PHY later.\n@@ -660,8 +663,12 @@ static int emac_configure(struct emac_instance *dev)\n \tout_be32(&p->iser,  r);\n \n \t/* We need to take GPCS PHY out of isolate mode after EMAC reset */\n-\tif (emac_phy_gpcs(dev->phy.mode))\n-\t\temac_mii_reset_phy(&dev->phy);\n+\tif (emac_phy_gpcs(dev->phy.mode)) {\n+\t\tif (dev->phy.gpcs_address != 0xffffffff)\n+\t\t\temac_mii_reset_gpcs(&dev->phy);\n+\t\telse\n+\t\t\temac_mii_reset_phy(&dev->phy);\n+\t}\n \n \t/* Required for Pause packet support in EMAC */\n \tdev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);\n@@ -869,7 +876,9 @@ static int emac_mdio_read(struct net_device *ndev, int id, int reg)\n \tstruct emac_instance *dev = netdev_priv(ndev);\n \tint res;\n \n-\tres = __emac_mdio_read(dev->mdio_instance ? dev->mdio_instance : dev,\n+\tres = __emac_mdio_read((dev->mdio_instance &&\n+\t\t\t\tdev->phy.gpcs_address != id) ?\n+\t\t\t\tdev->mdio_instance : dev,\n \t\t\t       (u8) id, (u8) reg);\n \treturn res;\n }\n@@ -878,7 +887,9 @@ static void emac_mdio_write(struct net_device *ndev, int id, int reg, int val)\n {\n \tstruct emac_instance *dev = netdev_priv(ndev);\n \n-\t__emac_mdio_write(dev->mdio_instance ? dev->mdio_instance : dev,\n+\t__emac_mdio_write((dev->mdio_instance &&\n+\t\t\t   dev->phy.gpcs_address != id) ?\n+\t\t\t   dev->mdio_instance : dev,\n \t\t\t  (u8) id, (u8) reg, (u16) val);\n }\n \n@@ -2367,7 +2378,11 @@ static int __devinit emac_init_phy(struct emac_instance *dev)\n \t\t * XXX I probably should move these settings to the dev tree\n \t\t */\n \t\tdev->phy.address = -1;\n-\t\tdev->phy.features = SUPPORTED_100baseT_Full | SUPPORTED_MII;\n+\t\tdev->phy.features = SUPPORTED_MII;\n+\t\tif (emac_phy_supports_gige(dev->phy_mode))\n+\t\t\tdev->phy.features |= SUPPORTED_1000baseT_Full;\n+\t\telse\n+\t\t\tdev->phy.features |= SUPPORTED_100baseT_Full;\n \t\tdev->phy.pause = 1;\n \n \t\treturn 0;\n@@ -2406,7 +2421,9 @@ static int __devinit emac_init_phy(struct emac_instance *dev)\n \t\t * Note that the busy_phy_map is currently global\n \t\t * while it should probably be per-ASIC...\n \t\t */\n-\t\tdev->phy.address = dev->cell_index;\n+\t\tdev->phy.gpcs_address = dev->gpcs_address;\n+\t\tif (dev->phy.gpcs_address == 0xffffffff)\n+\t\t\tdev->phy.address = dev->cell_index;\n \t}\n \n \temac_configure(dev);\n@@ -2516,6 +2533,8 @@ static int __devinit emac_init_config(struct emac_instance *dev)\n \t\tdev->phy_address = 0xffffffff;\n \tif (emac_read_uint_prop(np, \"phy-map\", &dev->phy_map, 0))\n \t\tdev->phy_map = 0xffffffff;\n+\tif (emac_read_uint_prop(np, \"gpcs-address\", &dev->gpcs_address, 0))\n+\t\tdev->gpcs_address = 0xffffffff;\n \tif (emac_read_uint_prop(np->parent, \"clock-frequency\", &dev->opb_bus_freq, 1))\n \t\treturn -ENXIO;\n \tif (emac_read_uint_prop(np, \"tah-device\", &dev->tah_ph, 0))\n@@ -2824,6 +2843,9 @@ static int __devinit emac_probe(struct of_device *ofdev,\n \t       ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2],\n \t       ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]);\n \n+\tif (dev->phy_mode == PHY_MODE_SGMII)\n+\t\tprintk(KERN_NOTICE \"%s: in SGMII mode\\n\", ndev->name);\n+\n \tif (dev->phy.address >= 0)\n \t\tprintk(\"%s: found %s PHY (0x%02x)\\n\", ndev->name,\n \t\t       dev->phy.def->name, dev->phy.address);\ndiff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h\nindex 6545e69..7312eac 100644\n--- a/drivers/net/ibm_newemac/core.h\n+++ b/drivers/net/ibm_newemac/core.h\n@@ -190,6 +190,9 @@ struct emac_instance {\n \tstruct delayed_work\t\tlink_work;\n \tint\t\t\t\tlink_polling;\n \n+\t/* GPCS PHY infos */\n+\tu32\t\t\t\tgpcs_address;\n+\n \t/* Shared MDIO if any */\n \tu32\t\t\t\tmdio_ph;\n \tstruct of_device\t\t*mdio_dev;\ndiff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c\nindex 37bfeea..606db53 100644\n--- a/drivers/net/ibm_newemac/phy.c\n+++ b/drivers/net/ibm_newemac/phy.c\n@@ -38,6 +38,16 @@ static inline void phy_write(struct mii_phy *phy, int reg, int val)\n \tphy->mdio_write(phy->dev, phy->address, reg, val);\n }\n \n+static inline int gpcs_phy_read(struct mii_phy *phy, int reg)\n+{\n+\treturn phy->mdio_read(phy->dev, phy->gpcs_address, reg);\n+}\n+\n+static inline void gpcs_phy_write(struct mii_phy *phy, int reg, int val)\n+{\n+\tphy->mdio_write(phy->dev, phy->gpcs_address, reg, val);\n+}\n+\n int emac_mii_reset_phy(struct mii_phy *phy)\n {\n \tint val;\n@@ -62,6 +72,37 @@ int emac_mii_reset_phy(struct mii_phy *phy)\n \treturn limit <= 0;\n }\n \n+int emac_mii_reset_gpcs(struct mii_phy *phy)\n+{\n+\tint val;\n+\tint limit = 10000;\n+\n+\tval = gpcs_phy_read(phy, MII_BMCR);\n+\tval &= ~(BMCR_ISOLATE | BMCR_ANENABLE);\n+\tval |= BMCR_RESET;\n+\tgpcs_phy_write(phy, MII_BMCR, val);\n+\n+\tudelay(300);\n+\n+\twhile (limit--) {\n+\t\tval = gpcs_phy_read(phy, MII_BMCR);\n+\t\tif (val >= 0 && (val & BMCR_RESET) == 0)\n+\t\t\tbreak;\n+\t\tudelay(10);\n+\t}\n+\tif ((val & BMCR_ISOLATE) && limit > 0)\n+\t\tgpcs_phy_write(phy, MII_BMCR, val & ~BMCR_ISOLATE);\n+\n+\tif (limit > 0 && phy->mode == PHY_MODE_SGMII) {\n+\t\t/* Configure GPCS interface to recommended setting for SGMII */\n+\t\tgpcs_phy_write(phy, 0x04, 0x8120); /* AsymPause, FDX */\n+\t\tgpcs_phy_write(phy, 0x07, 0x2801); /* msg_pg, toggle */\n+\t\tgpcs_phy_write(phy, 0x00, 0x0140); /* 1Gbps, FDX     */\n+\t}\n+\n+\treturn limit <= 0;\n+}\n+\n static int genmii_setup_aneg(struct mii_phy *phy, u32 advertise)\n {\n \tint ctl, adv;\n@@ -332,6 +373,33 @@ static int m88e1111_init(struct mii_phy *phy)\n \treturn  0;\n }\n \n+static int m88e1112_init(struct mii_phy *phy)\n+{\n+\t/*\n+\t * Marvell 88E1112 PHY needs to have the SGMII MAC\n+\t * interace (page 2) properly configured to\n+\t * communicate with the 460EX/GT GPCS interface.\n+\t */\n+\n+\tu16 reg_short;\n+\n+\tpr_debug(\"%s: Marvell 88E1112 Ethernet\\n\", __func__);\n+\n+\t/* Set access to Page 2 */\n+\tphy_write(phy, 0x16, 0x0002);\n+\n+\tphy_write(phy, 0x00, 0x0040); /* 1Gbps */\n+\treg_short = (u16)(phy_read(phy, 0x1a));\n+\treg_short |= 0x8000; /* bypass Auto-Negotiation */\n+\tphy_write(phy, 0x1a, reg_short);\n+\temac_mii_reset_phy(phy); /* reset MAC interface */\n+\n+\t/* Reset access to Page 0 */\n+\tphy_write(phy, 0x16, 0x0000);\n+\n+\treturn  0;\n+}\n+\n static int et1011c_init(struct mii_phy *phy)\n {\n \tu16 reg_short;\n@@ -384,11 +452,27 @@ static struct mii_phy_def m88e1111_phy_def = {\n \t.ops\t\t= &m88e1111_phy_ops,\n };\n \n+static struct mii_phy_ops m88e1112_phy_ops = {\n+\t.init\t\t= m88e1112_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 m88e1112_phy_def = {\n+\t.phy_id\t\t= 0x01410C90,\n+\t.phy_id_mask\t= 0x0ffffff0,\n+\t.name\t\t= \"Marvell 88E1112 Ethernet\",\n+\t.ops\t\t= &m88e1112_phy_ops,\n+};\n+\n 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&m88e1111_phy_def,\n+\t&m88e1112_phy_def,\n \t&genmii_phy_def,\n \tNULL\n };\ndiff --git a/drivers/net/ibm_newemac/phy.h b/drivers/net/ibm_newemac/phy.h\nindex 1b65c81..5d2bf4c 100644\n--- a/drivers/net/ibm_newemac/phy.h\n+++ b/drivers/net/ibm_newemac/phy.h\n@@ -57,6 +57,7 @@ struct mii_phy {\n \t\t\t\t   or determined automaticaly */\n \tint address;\t\t/* PHY address */\n \tint mode;\t\t/* PHY mode */\n+\tint gpcs_address;\t/* GPCS PHY address */\n \n \t/* 1: autoneg enabled, 0: disabled */\n \tint autoneg;\n@@ -81,5 +82,6 @@ struct mii_phy {\n  */\n int emac_mii_phy_probe(struct mii_phy *phy, int address);\n int emac_mii_reset_phy(struct mii_phy *phy);\n+int emac_mii_reset_gpcs(struct mii_phy *phy);\n \n #endif /* __IBM_NEWEMAC_PHY_H */\n",
    "prefixes": []
}