aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2012-10-29 04:45:18 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-01 12:21:32 -0400
commit78ca0b287314ad6b7b06161b3ff9b13e8a8bcce0 (patch)
tree99ab480436bf31cb253c334f57b5b9b039ad9f0a
parent6b60393e08f9263c7b129d54eeb261e8f970175c (diff)
cpsw: add a DT field for the active time stamping port
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 <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/devicetree/bindings/net/cpsw.txt3
-rw-r--r--drivers/net/ethernet/ti/cpsw.c7
-rw-r--r--include/linux/platform_data/cpsw.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index dba014fc5e7b..9f61f2b51681 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -23,6 +23,7 @@ Required properties:
23- mac_control : Specifies Default MAC control register content 23- mac_control : Specifies Default MAC control register content
24 for the specific platform 24 for the specific platform
25- slaves : Specifies number for slaves 25- slaves : Specifies number for slaves
26- cpts_active_slave : Specifies the slave to use for time stamping
26- slave_reg_ofs : Specifies slave register offset 27- slave_reg_ofs : Specifies slave register offset
27- sliver_reg_ofs : Specifies slave sliver register offset 28- sliver_reg_ofs : Specifies slave sliver register offset
28- phy_id : Specifies slave phy id 29- phy_id : Specifies slave phy id
@@ -60,6 +61,7 @@ Examples:
60 rx_descs = <64>; 61 rx_descs = <64>;
61 mac_control = <0x20>; 62 mac_control = <0x20>;
62 slaves = <2>; 63 slaves = <2>;
64 cpts_active_slave = <0>;
63 cpsw_emac0: slave@0 { 65 cpsw_emac0: slave@0 {
64 slave_reg_ofs = <0x200>; 66 slave_reg_ofs = <0x200>;
65 sliver_reg_ofs = <0xd80>; 67 sliver_reg_ofs = <0xd80>;
@@ -95,6 +97,7 @@ Examples:
95 rx_descs = <64>; 97 rx_descs = <64>;
96 mac_control = <0x20>; 98 mac_control = <0x20>;
97 slaves = <2>; 99 slaves = <2>;
100 cpts_active_slave = <0>;
98 cpsw_emac0: slave@0 { 101 cpsw_emac0: slave@0 {
99 slave_reg_ofs = <0x200>; 102 slave_reg_ofs = <0x200>;
100 sliver_reg_ofs = <0xd80>; 103 sliver_reg_ofs = <0xd80>;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f1af5e08cabb..f16579123c1b 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,
847 } 847 }
848 data->slaves = prop; 848 data->slaves = prop;
849 849
850 if (of_property_read_u32(node, "cpts_active_slave", &prop)) {
851 pr_err("Missing cpts_active_slave property in the DT.\n");
852 ret = -EINVAL;
853 goto error_ret;
854 }
855 data->cpts_active_slave = prop;
856
850 data->slave_data = kzalloc(sizeof(struct cpsw_slave_data) * 857 data->slave_data = kzalloc(sizeof(struct cpsw_slave_data) *
851 data->slaves, GFP_KERNEL); 858 data->slaves, GFP_KERNEL);
852 if (!data->slave_data) { 859 if (!data->slave_data) {
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index a052b1dca957..15a077eb0689 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -33,6 +33,7 @@ struct cpsw_platform_data {
33 33
34 u32 slaves; /* number of slave cpgmac ports */ 34 u32 slaves; /* number of slave cpgmac ports */
35 struct cpsw_slave_data *slave_data; 35 struct cpsw_slave_data *slave_data;
36 u32 cpts_active_slave; /* time stamping slave */
36 37
37 u32 ale_reg_ofs; /* address lookup engine reg offset */ 38 u32 ale_reg_ofs; /* address lookup engine reg offset */
38 u32 ale_entries; /* ale table size */ 39 u32 ale_entries; /* ale table size */