From patchwork Mon Oct 29 18:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 195123 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9581B2C008F for ; Tue, 30 Oct 2012 05:46:00 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760523Ab2J2Spy (ORCPT ); Mon, 29 Oct 2012 14:45:54 -0400 Received: from mail-ea0-f174.google.com ([209.85.215.174]:37510 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760461Ab2J2Spw (ORCPT ); Mon, 29 Oct 2012 14:45:52 -0400 Received: by mail-ea0-f174.google.com with SMTP id c13so1826941eaa.19 for ; Mon, 29 Oct 2012 11:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=403CkDnQPDxf8W8tLO70rnh8D3sB05Wjuv+X0bWOmKc=; b=BuXpgu8tcIfTTQc0ByAXElEBWJvxC54hfum+KQ/VYGYi41zU4Ji5WkqNaAUePvQipX VQcUYBduGxJw4Mm0tSN3Izim7Me0ec98ekyYdCOZ8/AgdnD1tVnDobiCXB24PqtcfK1Q L683GulKkyGPxIZA5xShylwb552PFvT8FvFeQQQaRJKtXei/23R7SSm2fOC2GTYhkNgj j5jyJWpQGYHAosAex3UoWgVx3zu0KX7v5Sdug+DYl6KbzWW8gZ1PquDhSdIg6rz4m4zT ELsefsUwIdNET2f0qtp2wz0dOQzCrN9KKYZbtuTZApOVUVebGykLMIqfvRU4VjaS4Rrz eLPg== Received: by 10.14.179.136 with SMTP id h8mr52029257eem.7.1351536352216; Mon, 29 Oct 2012 11:45:52 -0700 (PDT) Received: from localhost.localdomain (089144206154.atnat0015.highway.a1.net. [89.144.206.154]) by mx.google.com with ESMTPS id o49sm24364915eep.5.2012.10.29.11.45.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Oct 2012 11:45:51 -0700 (PDT) From: Richard Cochran To: Cc: , David Miller , Cyril Chemparathy , Mugunthan V N Subject: [PATCH net-next V3 08/10] cpsw: add a DT field for the active time stamping port Date: Mon, 29 Oct 2012 19:45:18 +0100 Message-Id: <496c255aeb2c696cbb62ac0319c97cf5fadda55b.1351535540.git.richardcochran@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Because time stamping on both external ports of the switch simultaneously is positively useless from the application's point of view, this patch provides a DT configuration method to choose the active port. Signed-off-by: Richard Cochran --- Documentation/devicetree/bindings/net/cpsw.txt | 3 +++ drivers/net/ethernet/ti/cpsw.c | 7 +++++++ include/linux/platform_data/cpsw.h | 1 + 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt index dba014f..9f61f2b 100644 --- a/Documentation/devicetree/bindings/net/cpsw.txt +++ b/Documentation/devicetree/bindings/net/cpsw.txt @@ -23,6 +23,7 @@ Required properties: - mac_control : Specifies Default MAC control register content for the specific platform - slaves : Specifies number for slaves +- cpts_active_slave : Specifies the slave to use for time stamping - slave_reg_ofs : Specifies slave register offset - sliver_reg_ofs : Specifies slave sliver register offset - phy_id : Specifies slave phy id @@ -60,6 +61,7 @@ Examples: rx_descs = <64>; mac_control = <0x20>; slaves = <2>; + cpts_active_slave = <0>; cpsw_emac0: slave@0 { slave_reg_ofs = <0x200>; sliver_reg_ofs = <0xd80>; @@ -95,6 +97,7 @@ Examples: rx_descs = <64>; mac_control = <0x20>; slaves = <2>; + cpts_active_slave = <0>; cpsw_emac0: slave@0 { slave_reg_ofs = <0x200>; sliver_reg_ofs = <0xd80>; diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index f1af5e0..f165791 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -847,6 +847,13 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, } data->slaves = prop; + if (of_property_read_u32(node, "cpts_active_slave", &prop)) { + pr_err("Missing cpts_active_slave property in the DT.\n"); + ret = -EINVAL; + goto error_ret; + } + data->cpts_active_slave = prop; + data->slave_data = kzalloc(sizeof(struct cpsw_slave_data) * data->slaves, GFP_KERNEL); if (!data->slave_data) { diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h index a052b1d..15a077e 100644 --- a/include/linux/platform_data/cpsw.h +++ b/include/linux/platform_data/cpsw.h @@ -33,6 +33,7 @@ struct cpsw_platform_data { u32 slaves; /* number of slave cpgmac ports */ struct cpsw_slave_data *slave_data; + u32 cpts_active_slave; /* time stamping slave */ u32 ale_reg_ofs; /* address lookup engine reg offset */ u32 ale_entries; /* ale table size */