From patchwork Tue Apr 28 10:08:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eilon Greenstein X-Patchwork-Id: 26546 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 9CEEDB707D for ; Tue, 28 Apr 2009 20:12:05 +1000 (EST) Received: by ozlabs.org (Postfix) id 8F7A6DDDA2; Tue, 28 Apr 2009 20:12:05 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 1E6EDDDD04 for ; Tue, 28 Apr 2009 20:12:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754276AbZD1KLw (ORCPT ); Tue, 28 Apr 2009 06:11:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753137AbZD1KLw (ORCPT ); Tue, 28 Apr 2009 06:11:52 -0400 Received: from mms1.broadcom.com ([216.31.210.17]:1135 "EHLO mms1.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbZD1KLv (ORCPT ); Tue, 28 Apr 2009 06:11:51 -0400 Received: from [10.9.200.131] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Tue, 28 Apr 2009 03:11:42 -0700 X-Server-Uuid: 02CED230-5797-4B57-9875-D5D2FEE4708A Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB01.corp.ad.broadcom.com (10.9.200.131) with Microsoft SMTP Server id 8.1.358.0; Tue, 28 Apr 2009 03:11:42 -0700 Received: from [10.185.6.119] (lb-tlvb-eliezer.il.broadcom.com [10.185.6.119]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 6AE3D74D03; Tue, 28 Apr 2009 03:11:41 -0700 (PDT) Subject: [RFC] Add clause 45 ioctl From: "Eilon Greenstein" To: netdev@vger.kernel.org, "David Miller" cc: yanivr@broadcom.com Organization: Broadcom Date: Tue, 28 Apr 2009 13:08:54 +0300 Message-ID: <1240913334.8347.6.camel@lb-tlvb-eliezer> MIME-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-WSS-ID: 65E809D43BW5103076-01-01 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, This patch adds clause 45 definitions to the mii.h. This will allow enhancing the networking device drivers ioctl to handle clause 45 related operations just as it can handle clause 22 commands today. Since clause 45 requires additional 16 bits for the bank address, the clause 22 structure cannot be used. The motivation is to allow user space applications to access PHY registers in clause 45. I'm sending this as RFC - if anyone has alternative suggestions on how user space application can access the PHY, I would appreciate it. Thanks, Eilon --- include/linux/mii.h | 17 +++++++++++++++++ include/linux/sockios.h | 3 +++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/include/linux/mii.h b/include/linux/mii.h index ad74858..328ad14 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -139,6 +139,13 @@ #define FLOW_CTRL_TX 0x01 #define FLOW_CTRL_RX 0x02 +/* Generic CL45 device addresses. */ +#define MII_CL45_DEVAD_PMA 0x01 /* The PMA device address */ +#define MII_CL45_DEVAD_WIS 0x02 /* The WIS device address */ +#define MII_CL45_DEVAD_PCS 0x03 /* The PCS device address */ +#define MII_CL45_DEVAD_XS 0x04 /* The XS device address */ +#define MII_CL45_DEVAD_AN 0x07 /* Autoneg device address */ + /* This structure is used in all SIOCxMIIxxx ioctl calls */ struct mii_ioctl_data { __u16 phy_id; @@ -147,6 +154,16 @@ struct mii_ioctl_data { __u16 val_out; }; +/* This structure is used in all SIOCxCL45xxx ioctl calls */ +struct mii_cl45_ioctl_data { + __u16 phy_id; + __u16 devad; + __u16 reg_num; + __u16 val_in; + __u16 val_out; + __u16 reserved; +}; + #ifdef __KERNEL__ #include diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 241f179..001e46b 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -83,6 +83,9 @@ #define SIOCWANDEV 0x894A /* get/set netdev parameters */ +#define SIOCGCL45PHY 0x894B /* Get address PHY for CL45 use */ +#define SIOCGCL45REG 0x894C /* Read PHY register using CL45 */ +#define SIOCSCL45REG 0x894D /* Write PHY register using CL45*/ /* ARP cache control calls. */ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ #define SIOCDARP 0x8953 /* delete ARP table entry */