* [PATCH 10/11] genetlink.h: Remove extern from function prototypes
From: Joe Perches @ 2013-09-20 18:23 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, linux-kernel
In-Reply-To: <597c1b62607f823af60dc4a99d59373dddfb7837.1379701322.git.joe@perches.com>
There are a mix of function prototypes with and without extern
in the kernel sources. Standardize on not using extern for
function prototypes.
Function prototypes don't need to be written with extern.
extern is assumed by the compiler. Its use is as unnecessary as
using auto to declare automatic/local variables in a block.
Signed-off-by: Joe Perches <joe@perches.com>
---
include/net/genetlink.h | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8e0b6c8..9b787b6 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -122,7 +122,7 @@ struct genl_ops {
struct list_head ops_list;
};
-extern int __genl_register_family(struct genl_family *family);
+int __genl_register_family(struct genl_family *family);
static inline int genl_register_family(struct genl_family *family)
{
@@ -130,8 +130,8 @@ static inline int genl_register_family(struct genl_family *family)
return __genl_register_family(family);
}
-extern int __genl_register_family_with_ops(struct genl_family *family,
- struct genl_ops *ops, size_t n_ops);
+int __genl_register_family_with_ops(struct genl_family *family,
+ struct genl_ops *ops, size_t n_ops);
static inline int genl_register_family_with_ops(struct genl_family *family,
struct genl_ops *ops, size_t n_ops)
@@ -140,18 +140,18 @@ static inline int genl_register_family_with_ops(struct genl_family *family,
return __genl_register_family_with_ops(family, ops, n_ops);
}
-extern int genl_unregister_family(struct genl_family *family);
-extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
-extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
-extern int genl_register_mc_group(struct genl_family *family,
- struct genl_multicast_group *grp);
-extern void genl_unregister_mc_group(struct genl_family *family,
- struct genl_multicast_group *grp);
-extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
- u32 group, struct nlmsghdr *nlh, gfp_t flags);
+int genl_unregister_family(struct genl_family *family);
+int genl_register_ops(struct genl_family *, struct genl_ops *ops);
+int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
+int genl_register_mc_group(struct genl_family *family,
+ struct genl_multicast_group *grp);
+void genl_unregister_mc_group(struct genl_family *family,
+ struct genl_multicast_group *grp);
+void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
+ u32 group, struct nlmsghdr *nlh, gfp_t flags);
void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
- struct genl_family *family, int flags, u8 cmd);
+ struct genl_family *family, int flags, u8 cmd);
/**
* genlmsg_nlhdr - Obtain netlink header from user specified header
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related
* [PATCH 11/11] icmp.h: Remove extern from function prototypes
From: Joe Perches @ 2013-09-20 18:23 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, linux-kernel
In-Reply-To: <597c1b62607f823af60dc4a99d59373dddfb7837.1379701322.git.joe@perches.com>
There are a mix of function prototypes with and without extern
in the kernel sources. Standardize on not using extern for
function prototypes.
Function prototypes don't need to be written with extern.
extern is assumed by the compiler. Its use is as unnecessary as
using auto to declare automatic/local variables in a block.
Signed-off-by: Joe Perches <joe@perches.com>
---
include/net/icmp.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 081439f..970028e 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -39,10 +39,10 @@ struct net_proto_family;
struct sk_buff;
struct net;
-extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
-extern int icmp_rcv(struct sk_buff *skb);
-extern void icmp_err(struct sk_buff *, u32 info);
-extern int icmp_init(void);
-extern void icmp_out_count(struct net *net, unsigned char type);
+void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
+int icmp_rcv(struct sk_buff *skb);
+void icmp_err(struct sk_buff *skb, u32 info);
+int icmp_init(void);
+void icmp_out_count(struct net *net, unsigned char type);
#endif /* _ICMP_H */
--
1.8.1.2.459.gbcd45b4.dirty
^ permalink raw reply related
* Re: [PATCH net-next v2 1/2] xen-netback: add a vif-is-connected flag
From: David Miller @ 2013-09-20 18:40 UTC (permalink / raw)
To: paul.durrant; +Cc: netdev, xen-devel, david.vrabel, wei.liu2, ian.campbell
In-Reply-To: <1379685460-25032-2-git-send-email-paul.durrant@citrix.com>
From: Paul Durrant <paul.durrant@citrix.com>
Date: Fri, 20 Sep 2013 14:57:39 +0100
> @@ -169,6 +169,7 @@ struct xenvif {
>
> /* Miscellaneous private stuff. */
> struct net_device *dev;
> + bool connected;
> };
>
> static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
...
> + vif->connected = 1;
...
> + vif->connected = 0;
Please use 'true' and 'false' when assigning values to something
of "bool" type.
Also these look like bug fixes, and are thus more appropriately
targetted at 'net' and even potentially -stable as well.
^ permalink raw reply
* Re: [PATCH 1/2] net: emaclite: Not necessary to call devm_iounmap
From: David Miller @ 2013-09-20 18:41 UTC (permalink / raw)
To: michal.simek; +Cc: netdev, monstr, renner, libo.chen, gregkh, linux-kernel
In-Reply-To: <196d8368eee2d45eeeab40e96e2971f78ed8a79b.1378969499.git.michal.simek@xilinx.com>
From: Michal Simek <michal.simek@xilinx.com>
Date: Thu, 12 Sep 2013 09:05:10 +0200
> devm_iounmap is called automatically.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH 2/2] net: emaclite: Code cleanup
From: David Miller @ 2013-09-20 18:41 UTC (permalink / raw)
To: michal.simek; +Cc: netdev, monstr, renner, libo.chen, gregkh, linux-kernel
In-Reply-To: <22c8762e2e6eb8bb7d8b945b8f0a17f54e5c718c.1378969499.git.michal.simek@xilinx.com>
From: Michal Simek <michal.simek@xilinx.com>
Date: Thu, 12 Sep 2013 09:05:11 +0200
> No function changes (s/\ \t/\t/g)
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Also applied to net-next
^ permalink raw reply
* Re: [PATCH v2 2/3] net: bnx2x: Staticize local symbols
From: David Miller @ 2013-09-20 18:41 UTC (permalink / raw)
To: sachin.kamat; +Cc: netdev, eilong, ariele
In-Reply-To: <1379475001-24505-2-git-send-email-sachin.kamat@linaro.org>
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Wed, 18 Sep 2013 09:00:00 +0530
> Local symbols used only in this file are made static.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Eilon Greenstein <eilong@broadcom.com>
> Cc: Ariel Elior <ariele@broadcom.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH Resend 3/3] net: cxgb4vf: Staticize local symbols
From: David Miller @ 2013-09-20 18:41 UTC (permalink / raw)
To: sachin.kamat; +Cc: netdev, leedom
In-Reply-To: <1379475001-24505-3-git-send-email-sachin.kamat@linaro.org>
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Wed, 18 Sep 2013 09:00:01 +0530
> Local symbols used only in this file are made static.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Casey Leedom <leedom@chelsio.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH v2 1/1] net: cdc-phonet: Staticize usbpn_probe
From: David Miller @ 2013-09-20 18:42 UTC (permalink / raw)
To: sachin.kamat; +Cc: netdev, remi
In-Reply-To: <1379573126-4879-1-git-send-email-sachin.kamat@linaro.org>
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Thu, 19 Sep 2013 12:15:26 +0530
> 'usbpn_probe' is referenced only in this file. Make it static.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Acked-by: Rémi Denis-Courmont <remi@remlab.net>
> Cc: Rémi Denis-Courmont <remi@remlab.net>
Applied to net-next
^ permalink raw reply
* Re: [PATCH 5/5] net: ethernet: eth.c: removed checkpatch warnings and errors
From: David Miller @ 2013-09-20 18:42 UTC (permalink / raw)
To: avi.kp.137; +Cc: akong, stefanha, jiri, netdev, linux-kernel
In-Reply-To: <523b2124.645d440a.1c55.0f75@mx.google.com>
From: avi.kp.137@gmail.com
Date: Thu, 19 Sep 2013 21:36:50 +0530
> From: Avinash Kumar <avi.kp.137@gmail.com>
>
> removed these checkpatch.pl warnings:
> net/ethernet/eth.c:61: WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
> net/ethernet/eth.c:136: WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
> net/ethernet/eth.c:181: ERROR: space prohibited before that close parenthesis ')'
>
> Signed-off-by: Avinash Kumar <avi.kp.137@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/2] net_sched: add u64 rate to psched_ratecfg_precompute()
From: David Miller @ 2013-09-20 18:42 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1379607003.3282.13.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 19 Sep 2013 09:10:03 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Add an extra u64 rate parameter to psched_ratecfg_precompute()
> so that some qdisc can opt-in for 64bit rates in the future,
> to overcome the ~34 Gbits limit.
>
> psched_ratecfg_getrate() reports a legacy structure to
> tc utility, so if actual rate is above the 32bit rate field,
> cap it to the 34Gbit limit.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 2/2] net_sched: htb: support of 64bit rates
From: David Miller @ 2013-09-20 18:42 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
In-Reply-To: <1379607020.3282.14.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 19 Sep 2013 09:10:20 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> HTB already can deal with 64bit rates, we only have to add two new
> attributes so that tc can use them to break the current 32bit ABI
> barrier.
>
> TCA_HTB_RATE64 : class rate (in bytes per second)
> TCA_HTB_CEIL64 : class ceil (in bytes per second)
>
> This allows us to setup HTB on 40Gbps links, as 32bit limit is
> actually ~34Gbps
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply
* Re: [PATCH] phy/micrel: Add suspend/resume support to Micrel PHYs
From: David Miller @ 2013-09-20 18:42 UTC (permalink / raw)
To: nicolas.ferre
Cc: netdev, b.brezillon, f.fainelli, linux-kernel, linux-arm-kernel,
patrice.vilchez, david.choi
In-Reply-To: <1379612448-20805-1-git-send-email-nicolas.ferre@atmel.com>
From: Nicolas Ferre <nicolas.ferre@atmel.com>
Date: Thu, 19 Sep 2013 19:40:48 +0200
> From: Patrice Vilchez <patrice.vilchez@atmel.com>
>
> All supported Micrel PHYs implement the standard "power down" bit 11 of BMCR,
> so this patch adds support using the generic genphy_{suspend,resume} functions.
>
> Signed-off-by: Patrice Vilchez <patrice.vilchez@atmel.com>
> [b.brezillon@overkiz.com: adapt to newer kernel and generalize to other phys]
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> [nicolas.ferre@atmel.com: commit message modification]
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: David J. Choi <david.choi@micrel.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH] declance: Remove `incompatible pointer type' warnings
From: David Miller @ 2013-09-20 18:43 UTC (permalink / raw)
To: macro; +Cc: netdev
In-Reply-To: <alpine.LFD.2.03.1309200008060.5967@linux-mips.org>
From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Fri, 20 Sep 2013 00:49:44 +0100 (BST)
> Revert damage caused by 43d620c82985b19008d87a437b4cf83f356264f7:
>
> .../declance.c: In function 'cp_to_buf':
> .../declance.c:347: warning: assignment from incompatible pointer type
> .../declance.c:348: warning: assignment from incompatible pointer type
> .../declance.c: In function 'cp_from_buf':
> .../declance.c:406: warning: assignment from incompatible pointer type
> .../declance.c:407: warning: assignment from incompatible pointer type
>
> Also add a `const' qualifier where applicable and adjust formatting.
>
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Applied to net-next
^ permalink raw reply
* Re: [PATCH 01/11] compat.h: Remove extern from function prototypes
From: David Miller @ 2013-09-20 18:49 UTC (permalink / raw)
To: joe; +Cc: netdev, linux-kernel
In-Reply-To: <597c1b62607f823af60dc4a99d59373dddfb7837.1379701322.git.joe@perches.com>
Series applied, thanks Joe.
^ permalink raw reply
* Re: [PATCH] qlge: call ql_core_dump() only if dump memory was allocated.
From: David Miller @ 2013-09-20 18:50 UTC (permalink / raw)
To: joe; +Cc: malahal, netdev
In-Reply-To: <1379700531.2301.2.camel@joe-AO722>
From: Joe Perches <joe@perches.com>
Date: Fri, 20 Sep 2013 11:08:51 -0700
> On Fri, 2013-09-20 at 11:59 -0500, Malahal Naineni wrote:
>> Also changed a log message to indicate that memory was not allocated
>> instead of memory not available!
> []
>> diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
> []
>> @@ -1274,11 +1274,13 @@ void ql_mpi_reset_work(struct work_struct *work)
>> return;
>> }
>>
>> - if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
>> - netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
>> - qdev->core_is_dumped = 1;
>> - queue_delayed_work(qdev->workqueue,
>> - &qdev->mpi_core_to_log, 5 * HZ);
>> + if (qdev->mpi_coredump) {
>> + if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
>> + netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
>> + qdev->core_is_dumped = 1;
>> + queue_delayed_work(qdev->workqueue,
>> + &qdev->mpi_core_to_log, 5 * HZ);
>> + }
>
> This can be done without adding another indentation level
>
> if (qdev->mpi_coredump &&
> !ql_core_dump(qdev, qdev->mpi_coredump)) {
Agreed.
^ permalink raw reply
* Re: [PATCH 01/11] compat.h: Remove extern from function prototypes
From: Joe Perches @ 2013-09-20 18:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel
In-Reply-To: <20130920.144949.2032827652741780854.davem@davemloft.net>
On Fri, 2013-09-20 at 14:49 -0400, David Miller wrote:
> Series applied, thanks Joe.
I've got 36 more of these.
How many do you want, how often?
^ permalink raw reply
* Re: [PATCH 01/11] compat.h: Remove extern from function prototypes
From: David Miller @ 2013-09-20 18:56 UTC (permalink / raw)
To: joe; +Cc: netdev, linux-kernel
In-Reply-To: <1379703215.2301.15.camel@joe-AO722>
From: Joe Perches <joe@perches.com>
Date: Fri, 20 Sep 2013 11:53:35 -0700
> On Fri, 2013-09-20 at 14:49 -0400, David Miller wrote:
>> Series applied, thanks Joe.
>
> I've got 36 more of these.
> How many do you want, how often?
Maybe another dozen tomorrow?
Thanks for being so considerate Joe.
^ permalink raw reply
* Re: [PATCH] qlge: call ql_core_dump() only if dump memory was allocated.
From: Malahal Naineni @ 2013-09-20 18:57 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev
In-Reply-To: <1379700531.2301.2.camel@joe-AO722>
Joe Perches [joe@perches.com] wrote:
> On Fri, 2013-09-20 at 11:59 -0500, Malahal Naineni wrote:
> > Also changed a log message to indicate that memory was not allocated
> > instead of memory not available!
> []
> > diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
> []
> > @@ -1274,11 +1274,13 @@ void ql_mpi_reset_work(struct work_struct *work)
> > return;
> > }
> >
> > - if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
> > - netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
> > - qdev->core_is_dumped = 1;
> > - queue_delayed_work(qdev->workqueue,
> > - &qdev->mpi_core_to_log, 5 * HZ);
> > + if (qdev->mpi_coredump) {
> > + if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
> > + netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
> > + qdev->core_is_dumped = 1;
> > + queue_delayed_work(qdev->workqueue,
> > + &qdev->mpi_core_to_log, 5 * HZ);
> > + }
>
> This can be done without adding another indentation level
>
> if (qdev->mpi_coredump &&
> !ql_core_dump(qdev, qdev->mpi_coredump)) {
>
>
Makes sense! Sending another patch as suggested:
>From b4e1561cb46242c33a77484160f1f1cc3d0e3ffc Mon Sep 17 00:00:00 2001
From: Malahal Naineni <malahal@us.ibm.com>
Date: Fri, 20 Sep 2013 10:18:19 -0500
Subject: [PATCH] qlge: call ql_core_dump() only if dump memory was allocated.
Also changed a log message to indicate that memory was not allocated
instead of memory not available!
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
---
drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | 4 ++--
drivers/net/ethernet/qlogic/qlge/qlge_mpi.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
index 10093f0..6bc5db7 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
@@ -740,8 +740,8 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump)
int i;
if (!mpi_coredump) {
- netif_err(qdev, drv, qdev->ndev, "No memory available\n");
- return -ENOMEM;
+ netif_err(qdev, drv, qdev->ndev, "No memory allocated\n");
+ return -EINVAL;
}
/* Try to get the spinlock, but dont worry if
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
index ff2bf8a..7ad1460 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
@@ -1274,7 +1274,7 @@ void ql_mpi_reset_work(struct work_struct *work)
return;
}
- if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
+ if (qdev->mpi_coredump && !ql_core_dump(qdev, qdev->mpi_coredump)) {
netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
qdev->core_is_dumped = 1;
queue_delayed_work(qdev->workqueue,
--
1.7.11.7
^ permalink raw reply related
* Re: [PATCH 1/1] mrp: add periodictimer to allow retries when packets get lost
From: David Miller @ 2013-09-20 18:59 UTC (permalink / raw)
To: noel; +Cc: netdev, joe, david.ward
In-Reply-To: <1379532280-11047-1-git-send-email-noel@burton-krahn.com>
From: Noel Burton-Krahn <noel@burton-krahn.com>
Date: Wed, 18 Sep 2013 12:24:40 -0700
> MRP doesn't implement the periodictimer in 802.1Q, so it never retries
> if packets get lost. I ran into this problem when MRP sent a MVRP
> JoinIn before the interface was fully up. The JoinIn was lost, MRP
> didn't retry, and MVRP registration failed.
>
> Tested against Juniper QFabric switches
>
> Signed-off-by: Noel Burton-Krahn <noel@burton-krahn.com>
David W., please review this patch.
Thanks.
^ permalink raw reply
* Re: [PATCH] qlge: call ql_core_dump() only if dump memory was allocated.
From: David Miller @ 2013-09-20 19:00 UTC (permalink / raw)
To: malahal; +Cc: joe, netdev
In-Reply-To: <20130920185735.GA30419@us.ibm.com>
From: Malahal Naineni <malahal@us.ibm.com>
Date: Fri, 20 Sep 2013 13:57:35 -0500
> Joe Perches [joe@perches.com] wrote:
>> On Fri, 2013-09-20 at 11:59 -0500, Malahal Naineni wrote:
>> > Also changed a log message to indicate that memory was not allocated
>> > instead of memory not available!
>> []
>> > diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c
>> []
>> > @@ -1274,11 +1274,13 @@ void ql_mpi_reset_work(struct work_struct *work)
>> > return;
>> > }
>> >
>> > - if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
>> > - netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
>> > - qdev->core_is_dumped = 1;
>> > - queue_delayed_work(qdev->workqueue,
>> > - &qdev->mpi_core_to_log, 5 * HZ);
>> > + if (qdev->mpi_coredump) {
>> > + if (!ql_core_dump(qdev, qdev->mpi_coredump)) {
>> > + netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n");
>> > + qdev->core_is_dumped = 1;
>> > + queue_delayed_work(qdev->workqueue,
>> > + &qdev->mpi_core_to_log, 5 * HZ);
>> > + }
>>
>> This can be done without adding another indentation level
>>
>> if (qdev->mpi_coredump &&
>> !ql_core_dump(qdev, qdev->mpi_coredump)) {
>>
>>
>
> Makes sense! Sending another patch as suggested:
Please don't send new versions of a patch as a reply to a thread,
instead always make a new, fresh, list posting.
^ permalink raw reply
* Re: [PATCH v4] net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)
From: David Miller @ 2013-09-20 19:10 UTC (permalink / raw)
To: arvid.brodin
Cc: netdev, shemminger, joe, jboticario, balferreira, elias.molina
In-Reply-To: <523A4F5E.9070503@xdin.com>
From: Arvid Brodin <arvid.brodin@xdin.com>
Date: Thu, 19 Sep 2013 03:11:58 +0200
> +/* If dev is a HSR master, return 1; otherwise, return 0.
> + */
> +bool is_hsr_master(struct net_device *dev)
Bool takes on either 'true' or 'false', not '1' or '0'.
> +#if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
> + /* We need to memmove the whole header to work around
> + * alignment problems caused by the 6-byte HSR tag.
> + */
> + memmove(skb_deliver->data - HSR_TAGLEN, skb_deliver->data,
> + skb_headlen(skb_deliver));
> + skb_deliver->data -= HSR_TAGLEN;
> + skb_deliver->tail -= HSR_TAGLEN;
> +#endif
You can't do this.
First of all, you have no idea if subtracting skb->data a given amount
will underflow the skb buffer start. You aren't even checking, all
of the standard skb_*() data adjustment interfaces do.
Secondly, everything after the header is now at the wrong offset from
the beginning of the packet.
You will have to memmove() the entire packet if you want to realign
where it starts.
^ permalink raw reply
* [net-next PATCH 0/4] cpsw: support for control module register
From: Mugunthan V N @ 2013-09-20 19:20 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: zonque-Re5JQEeQqe8AvxtiuMwx3w, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mugunthan V N
This patch series adds the support for configuring GMII_SEL register
of control module to select the phy mode type and also to configure
the clock source for RMII phy mode whether to use internal clock or
the external clock from the phy itself.
Till now CPSW works as this configuration is done in U-Boot and carried
over to the kernel. But during suspend/resume Control module tends to
lose its configured value for GMII_SEL register in AM33xx PG1.0, so
if CPSW is used in RMII or RGMII mode, on resume cpsw is not working
as GMII_SEL register lost its configuration values.
The initial version of the patch is done by Daniel Mack but as per
Tony's comment he wants it as a seperate driver as it is done in USB
control module. I have created a seperate driver for the same.
Changes from RFC version:
* Changed "_" to "-" in DT names as per Serger's comment
Daniel Mack (1):
net: ethernet: cpsw: switch to devres allocations
Mugunthan V N (3):
drivers: net: cpsw-phy-sel: Add new driver for phy mode selection for
cpsw
drivers: net: cpsw: use cpsw-phy-sel driver to configure phy mode
ARM: dts: am33xx: adopt to cpsw-phy-sel driver to configure phy mode
.../devicetree/bindings/net/cpsw-phy-sel.txt | 28 ++++
arch/arm/boot/dts/am33xx.dtsi | 6 +
drivers/net/ethernet/ti/Kconfig | 8 +
drivers/net/ethernet/ti/Makefile | 1 +
drivers/net/ethernet/ti/cpsw-phy-sel.c | 161 +++++++++++++++++++++
drivers/net/ethernet/ti/cpsw.c | 157 ++++++--------------
drivers/net/ethernet/ti/cpsw.h | 2 +
7 files changed, 253 insertions(+), 110 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
create mode 100644 drivers/net/ethernet/ti/cpsw-phy-sel.c
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [net-next PATCH 1/4] net: ethernet: cpsw: switch to devres allocations
From: Mugunthan V N @ 2013-09-20 19:20 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: zonque-Re5JQEeQqe8AvxtiuMwx3w, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mugunthan V N
In-Reply-To: <1379704841-32693-1-git-send-email-mugunthanvnm-l0cyMroinI0@public.gmane.org>
From: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This patch cleans up the allocation and error unwind paths, which
allows us to carry less information in struct cpsw_priv and reduce the
amount of jump labels in the probe functions.
Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>
---
drivers/net/ethernet/ti/cpsw.c | 153 ++++++++++++-----------------------------
1 file changed, 43 insertions(+), 110 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 79974e3..01c42e1 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -367,8 +367,6 @@ struct cpsw_priv {
spinlock_t lock;
struct platform_device *pdev;
struct net_device *ndev;
- struct resource *cpsw_res;
- struct resource *cpsw_wr_res;
struct napi_struct napi;
struct device *dev;
struct cpsw_platform_data data;
@@ -1712,62 +1710,55 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
if (of_property_read_u32(node, "active_slave", &prop)) {
pr_err("Missing active_slave property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->active_slave = prop;
if (of_property_read_u32(node, "cpts_clock_mult", &prop)) {
pr_err("Missing cpts_clock_mult property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->cpts_clock_mult = prop;
if (of_property_read_u32(node, "cpts_clock_shift", &prop)) {
pr_err("Missing cpts_clock_shift property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->cpts_clock_shift = prop;
- data->slave_data = kcalloc(data->slaves, sizeof(struct cpsw_slave_data),
- GFP_KERNEL);
+ data->slave_data = devm_kzalloc(&pdev->dev, data->slaves
+ * sizeof(struct cpsw_slave_data),
+ GFP_KERNEL);
if (!data->slave_data)
- return -EINVAL;
+ return -ENOMEM;
if (of_property_read_u32(node, "cpdma_channels", &prop)) {
pr_err("Missing cpdma_channels property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->channels = prop;
if (of_property_read_u32(node, "ale_entries", &prop)) {
pr_err("Missing ale_entries property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->ale_entries = prop;
if (of_property_read_u32(node, "bd_ram_size", &prop)) {
pr_err("Missing bd_ram_size property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->bd_ram_size = prop;
if (of_property_read_u32(node, "rx_descs", &prop)) {
pr_err("Missing rx_descs property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->rx_descs = prop;
if (of_property_read_u32(node, "mac_control", &prop)) {
pr_err("Missing mac_control property in the DT.\n");
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
data->mac_control = prop;
@@ -1794,8 +1785,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
parp = of_get_property(slave_node, "phy_id", &lenp);
if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
pr_err("Missing slave[%d] phy_id property\n", i);
- ret = -EINVAL;
- goto error_ret;
+ return -EINVAL;
}
mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
phyid = be32_to_cpup(parp+1);
@@ -1825,10 +1815,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
}
return 0;
-
-error_ret:
- kfree(data->slave_data);
- return ret;
}
static int cpsw_probe_dual_emac(struct platform_device *pdev,
@@ -1870,7 +1856,6 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
priv_sl2->coal_intvl = 0;
priv_sl2->bus_freq_mhz = priv->bus_freq_mhz;
- priv_sl2->cpsw_res = priv->cpsw_res;
priv_sl2->regs = priv->regs;
priv_sl2->host_port = priv->host_port;
priv_sl2->host_port_regs = priv->host_port_regs;
@@ -1914,8 +1899,8 @@ static int cpsw_probe(struct platform_device *pdev)
struct cpsw_priv *priv;
struct cpdma_params dma_params;
struct cpsw_ale_params ale_params;
- void __iomem *ss_regs, *wr_regs;
- struct resource *res;
+ void __iomem *ss_regs;
+ struct resource *res, *ss_res;
u32 slave_offset, sliver_offset, slave_size;
int ret = 0, i, k = 0;
@@ -1951,7 +1936,7 @@ static int cpsw_probe(struct platform_device *pdev)
if (cpsw_probe_dt(&priv->data, pdev)) {
pr_err("cpsw: platform data missing\n");
ret = -ENODEV;
- goto clean_ndev_ret;
+ goto clean_runtime_disable_ret;
}
data = &priv->data;
@@ -1965,11 +1950,12 @@ static int cpsw_probe(struct platform_device *pdev)
memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
- priv->slaves = kzalloc(sizeof(struct cpsw_slave) * data->slaves,
- GFP_KERNEL);
+ priv->slaves = devm_kzalloc(&pdev->dev,
+ sizeof(struct cpsw_slave) * data->slaves,
+ GFP_KERNEL);
if (!priv->slaves) {
- ret = -EBUSY;
- goto clean_ndev_ret;
+ ret = -ENOMEM;
+ goto clean_runtime_disable_ret;
}
for (i = 0; i < data->slaves; i++)
priv->slaves[i].slave_num = i;
@@ -1977,55 +1963,31 @@ static int cpsw_probe(struct platform_device *pdev)
priv->slaves[0].ndev = ndev;
priv->emac_port = 0;
- priv->clk = clk_get(&pdev->dev, "fck");
+ priv->clk = devm_clk_get(&pdev->dev, "fck");
if (IS_ERR(priv->clk)) {
- dev_err(&pdev->dev, "fck is not found\n");
+ dev_err(priv->dev, "fck is not found\n");
ret = -ENODEV;
- goto clean_slave_ret;
+ goto clean_runtime_disable_ret;
}
priv->coal_intvl = 0;
priv->bus_freq_mhz = clk_get_rate(priv->clk) / 1000000;
- priv->cpsw_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!priv->cpsw_res) {
- dev_err(priv->dev, "error getting i/o resource\n");
- ret = -ENOENT;
- goto clean_clk_ret;
- }
- if (!request_mem_region(priv->cpsw_res->start,
- resource_size(priv->cpsw_res), ndev->name)) {
- dev_err(priv->dev, "failed request i/o region\n");
- ret = -ENXIO;
- goto clean_clk_ret;
- }
- ss_regs = ioremap(priv->cpsw_res->start, resource_size(priv->cpsw_res));
- if (!ss_regs) {
- dev_err(priv->dev, "unable to map i/o region\n");
- goto clean_cpsw_iores_ret;
+ ss_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ ss_regs = devm_ioremap_resource(&pdev->dev, ss_res);
+ if (IS_ERR(ss_regs)) {
+ ret = PTR_ERR(ss_regs);
+ goto clean_runtime_disable_ret;
}
priv->regs = ss_regs;
priv->version = __raw_readl(&priv->regs->id_ver);
priv->host_port = HOST_PORT_NUM;
- priv->cpsw_wr_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!priv->cpsw_wr_res) {
- dev_err(priv->dev, "error getting i/o resource\n");
- ret = -ENOENT;
- goto clean_iomap_ret;
- }
- if (!request_mem_region(priv->cpsw_wr_res->start,
- resource_size(priv->cpsw_wr_res), ndev->name)) {
- dev_err(priv->dev, "failed request i/o region\n");
- ret = -ENXIO;
- goto clean_iomap_ret;
- }
- wr_regs = ioremap(priv->cpsw_wr_res->start,
- resource_size(priv->cpsw_wr_res));
- if (!wr_regs) {
- dev_err(priv->dev, "unable to map i/o region\n");
- goto clean_cpsw_wr_iores_ret;
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ priv->wr_regs = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(priv->wr_regs)) {
+ ret = PTR_ERR(priv->wr_regs);
+ goto clean_runtime_disable_ret;
}
- priv->wr_regs = wr_regs;
memset(&dma_params, 0, sizeof(dma_params));
memset(&ale_params, 0, sizeof(ale_params));
@@ -2056,12 +2018,12 @@ static int cpsw_probe(struct platform_device *pdev)
slave_size = CPSW2_SLAVE_SIZE;
sliver_offset = CPSW2_SLIVER_OFFSET;
dma_params.desc_mem_phys =
- (u32 __force) priv->cpsw_res->start + CPSW2_BD_OFFSET;
+ (u32 __force) ss_res->start + CPSW2_BD_OFFSET;
break;
default:
dev_err(priv->dev, "unknown version 0x%08x\n", priv->version);
ret = -ENODEV;
- goto clean_cpsw_wr_iores_ret;
+ goto clean_runtime_disable_ret;
}
for (i = 0; i < priv->data.slaves; i++) {
struct cpsw_slave *slave = &priv->slaves[i];
@@ -2089,7 +2051,7 @@ static int cpsw_probe(struct platform_device *pdev)
if (!priv->dma) {
dev_err(priv->dev, "error initializing dma\n");
ret = -ENOMEM;
- goto clean_wr_iomap_ret;
+ goto clean_runtime_disable_ret;
}
priv->txch = cpdma_chan_create(priv->dma, tx_chan_num(0),
@@ -2124,8 +2086,8 @@ static int cpsw_probe(struct platform_device *pdev)
while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) {
for (i = res->start; i <= res->end; i++) {
- if (request_irq(i, cpsw_interrupt, 0,
- dev_name(&pdev->dev), priv)) {
+ if (devm_request_irq(&pdev->dev, i, cpsw_interrupt, 0,
+ dev_name(priv->dev), priv)) {
dev_err(priv->dev, "error attaching irq\n");
goto clean_ale_ret;
}
@@ -2147,7 +2109,7 @@ static int cpsw_probe(struct platform_device *pdev)
if (ret) {
dev_err(priv->dev, "error registering net device\n");
ret = -ENODEV;
- goto clean_irq_ret;
+ goto clean_ale_ret;
}
if (cpts_register(&pdev->dev, priv->cpts,
@@ -2155,44 +2117,27 @@ static int cpsw_probe(struct platform_device *pdev)
dev_err(priv->dev, "error registering cpts device\n");
cpsw_notice(priv, probe, "initialized device (regs %x, irq %d)\n",
- priv->cpsw_res->start, ndev->irq);
+ ss_res->start, ndev->irq);
if (priv->data.dual_emac) {
ret = cpsw_probe_dual_emac(pdev, priv);
if (ret) {
cpsw_err(priv, probe, "error probe slave 2 emac interface\n");
- goto clean_irq_ret;
+ goto clean_ale_ret;
}
}
return 0;
-clean_irq_ret:
- for (i = 0; i < priv->num_irqs; i++)
- free_irq(priv->irqs_table[i], priv);
clean_ale_ret:
cpsw_ale_destroy(priv->ale);
clean_dma_ret:
cpdma_chan_destroy(priv->txch);
cpdma_chan_destroy(priv->rxch);
cpdma_ctlr_destroy(priv->dma);
-clean_wr_iomap_ret:
- iounmap(priv->wr_regs);
-clean_cpsw_wr_iores_ret:
- release_mem_region(priv->cpsw_wr_res->start,
- resource_size(priv->cpsw_wr_res));
-clean_iomap_ret:
- iounmap(priv->regs);
-clean_cpsw_iores_ret:
- release_mem_region(priv->cpsw_res->start,
- resource_size(priv->cpsw_res));
-clean_clk_ret:
- clk_put(priv->clk);
-clean_slave_ret:
+clean_runtime_disable_ret:
pm_runtime_disable(&pdev->dev);
- kfree(priv->slaves);
clean_ndev_ret:
- kfree(priv->data.slave_data);
free_netdev(priv->ndev);
return ret;
}
@@ -2201,30 +2146,18 @@ static int cpsw_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct cpsw_priv *priv = netdev_priv(ndev);
- int i;
if (priv->data.dual_emac)
unregister_netdev(cpsw_get_slave_ndev(priv, 1));
unregister_netdev(ndev);
cpts_unregister(priv->cpts);
- for (i = 0; i < priv->num_irqs; i++)
- free_irq(priv->irqs_table[i], priv);
cpsw_ale_destroy(priv->ale);
cpdma_chan_destroy(priv->txch);
cpdma_chan_destroy(priv->rxch);
cpdma_ctlr_destroy(priv->dma);
- iounmap(priv->regs);
- release_mem_region(priv->cpsw_res->start,
- resource_size(priv->cpsw_res));
- iounmap(priv->wr_regs);
- release_mem_region(priv->cpsw_wr_res->start,
- resource_size(priv->cpsw_wr_res));
pm_runtime_disable(&pdev->dev);
- clk_put(priv->clk);
- kfree(priv->slaves);
- kfree(priv->data.slave_data);
if (priv->data.dual_emac)
free_netdev(cpsw_get_slave_ndev(priv, 1));
free_netdev(ndev);
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [net-next PATCH 2/4] drivers: net: cpsw-phy-sel: Add new driver for phy mode selection for cpsw
From: Mugunthan V N @ 2013-09-20 19:20 UTC (permalink / raw)
To: netdev
Cc: zonque, davem, bcousson, tony, devicetree, linux-omap,
linux-arm-kernel, Mugunthan V N
In-Reply-To: <1379704841-32693-1-git-send-email-mugunthanvnm@ti.com>
The cpsw currently lacks code to properly set up the hardware interface
mode on AM33xx. Other platforms might be equally affected.
Usually, the bootloader will configure the control module register, so
probably that's why such support wasn't needed in the past. In suspend
mode though, this register is modified, and so it needs reprogramming
after resume.
This patch adds a new driver in which hardware interface can configure
correct register bits when the slave is opened.
The AM33xx also has a bit for each slave to configure the RMII reference
clock direction. Setting it is now supported by a per-slave DT property.
This code path introducted by this patch is currently exclusive for
am33xx and same can be extened to various platforms via the DT compatibility
property.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Daniel Mack <zonque@gmail.com>
---
.../devicetree/bindings/net/cpsw-phy-sel.txt | 28 ++++
drivers/net/ethernet/ti/Kconfig | 8 +
drivers/net/ethernet/ti/Makefile | 1 +
drivers/net/ethernet/ti/cpsw-phy-sel.c | 161 +++++++++++++++++++++
drivers/net/ethernet/ti/cpsw.h | 2 +
5 files changed, 200 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
create mode 100644 drivers/net/ethernet/ti/cpsw-phy-sel.c
diff --git a/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
new file mode 100644
index 0000000..7ff57a1
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
@@ -0,0 +1,28 @@
+TI CPSW Phy mode Selection Device Tree Bindings
+-----------------------------------------------
+
+Required properties:
+- compatible : Should be "ti,am3352-cpsw-phy-sel"
+- reg : physical base address and size of the cpsw
+ registers map
+- reg-names : names of the register map given in "reg" node
+
+Optional properties:
+-rmii-clock-ext : If present, the driver will configure the RMII
+ interface to external clock usage
+
+Examples:
+
+ phy_sel: cpsw-phy-sel@44e10650 {
+ compatible = "ti,am3352-cpsw-phy-sel";
+ reg= <0x44e10650 0x4>;
+ reg-names = "gmii-sel";
+ };
+
+(or)
+ phy_sel: cpsw-phy-sel@44e10650 {
+ compatible = "ti,am3352-cpsw-phy-sel";
+ reg= <0x44e10650 0x4>;
+ reg-names = "gmii-sel";
+ rmii-clock-ext;
+ };
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index de71b1e..53150c2 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -49,11 +49,19 @@ config TI_DAVINCI_CPDMA
To compile this driver as a module, choose M here: the module
will be called davinci_cpdma. This is recommended.
+config TI_CPSW_PHY_SEL
+ boolean "TI CPSW Switch Phy sel Support"
+ depends on TI_CPSW
+ ---help---
+ This driver supports configuring of the phy mode connected to
+ the CPSW.
+
config TI_CPSW
tristate "TI CPSW Switch Support"
depends on ARM && (ARCH_DAVINCI || SOC_AM33XX)
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
+ select TI_CPSW_PHY_SEL
---help---
This driver supports TI's CPSW Ethernet Switch.
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index c65148e..9cfaab8 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -7,5 +7,6 @@ obj-$(CONFIG_CPMAC) += cpmac.o
obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
+obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
new file mode 100644
index 0000000..e092ede
--- /dev/null
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c
@@ -0,0 +1,161 @@
+/* Texas Instruments Ethernet Switch Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/phy.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+#include "cpsw.h"
+
+/* AM33xx SoC specific definitions for the CONTROL port */
+#define AM33XX_GMII_SEL_MODE_MII 0
+#define AM33XX_GMII_SEL_MODE_RMII 1
+#define AM33XX_GMII_SEL_MODE_RGMII 2
+
+#define AM33XX_GMII_SEL_RMII2_IO_CLK_EN BIT(7)
+#define AM33XX_GMII_SEL_RMII1_IO_CLK_EN BIT(6)
+
+struct cpsw_phy_sel_priv {
+ struct device *dev;
+ u32 __iomem *gmii_sel;
+ bool rmii_clock_external;
+ void (*cpsw_phy_sel)(struct cpsw_phy_sel_priv *priv,
+ phy_interface_t phy_mode, int slave);
+};
+
+
+static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv,
+ phy_interface_t phy_mode, int slave)
+{
+ u32 reg;
+ u32 mask;
+ u32 mode = 0;
+
+ reg = readl(priv->gmii_sel);
+
+ switch (phy_mode) {
+ case PHY_INTERFACE_MODE_RMII:
+ mode = AM33XX_GMII_SEL_MODE_RMII;
+ break;
+
+ case PHY_INTERFACE_MODE_RGMII:
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
+ case PHY_INTERFACE_MODE_RGMII_TXID:
+ mode = AM33XX_GMII_SEL_MODE_RGMII;
+ break;
+
+ case PHY_INTERFACE_MODE_MII:
+ default:
+ mode = AM33XX_GMII_SEL_MODE_MII;
+ break;
+ };
+
+ mask = 0x3 << (slave * 2) | BIT(slave + 6);
+ mode <<= slave * 2;
+
+ if (priv->rmii_clock_external) {
+ if (slave == 0)
+ mode |= AM33XX_GMII_SEL_RMII1_IO_CLK_EN;
+ else
+ mode |= AM33XX_GMII_SEL_RMII2_IO_CLK_EN;
+ }
+
+ reg &= ~mask;
+ reg |= mode;
+
+ writel(reg, priv->gmii_sel);
+}
+
+static struct platform_driver cpsw_phy_sel_driver;
+static int match(struct device *dev, void *data)
+{
+ struct device_node *node = (struct device_node *)data;
+ return dev->of_node == node &&
+ dev->driver == &cpsw_phy_sel_driver.driver;
+}
+
+void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
+{
+ struct device_node *node;
+ struct cpsw_phy_sel_priv *priv;
+
+ node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
+ if (!node) {
+ dev_err(dev, "Phy mode driver DT not found\n");
+ return;
+ }
+
+ dev = bus_find_device(&platform_bus_type, NULL, node, match);
+ priv = dev_get_drvdata(dev);
+
+ priv->cpsw_phy_sel(priv, phy_mode, slave);
+}
+EXPORT_SYMBOL_GPL(cpsw_phy_sel);
+
+static const struct of_device_id cpsw_phy_sel_id_table[] = {
+ {
+ .compatible = "ti,am3352-cpsw-phy-sel",
+ .data = &cpsw_gmii_sel_am3352,
+ },
+ {}
+};
+MODULE_DEVICE_TABLE(of, cpsw_phy_sel_id_table);
+
+static int cpsw_phy_sel_probe(struct platform_device *pdev)
+{
+ struct resource *res;
+ const struct of_device_id *of_id;
+ struct cpsw_phy_sel_priv *priv;
+
+ of_id = of_match_node(cpsw_phy_sel_id_table, pdev->dev.of_node);
+ if (!of_id)
+ return -EINVAL;
+
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ dev_err(&pdev->dev, "unable to alloc memory for cpsw phy sel\n");
+ return -ENOMEM;
+ }
+
+ priv->cpsw_phy_sel = of_id->data;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gmii-sel");
+ priv->gmii_sel = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(priv->gmii_sel))
+ return PTR_ERR(priv->gmii_sel);
+
+ if (of_find_property(pdev->dev.of_node, "rmii-clock-ext", NULL))
+ priv->rmii_clock_external = true;
+
+ dev_set_drvdata(&pdev->dev, priv);
+
+ return 0;
+}
+
+static struct platform_driver cpsw_phy_sel_driver = {
+ .probe = cpsw_phy_sel_probe,
+ .driver = {
+ .name = "cpsw-phy-sel",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(cpsw_phy_sel_id_table),
+ },
+};
+
+module_platform_driver(cpsw_phy_sel_driver);
+MODULE_AUTHOR("Mugunthan V N <mugunthanvnm@ti.com>");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index eb3e101..574f49d 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -39,4 +39,6 @@ struct cpsw_platform_data {
bool dual_emac; /* Enable Dual EMAC mode */
};
+void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave);
+
#endif /* __CPSW_H__ */
--
1.8.4
^ permalink raw reply related
* [net-next PATCH 3/4] drivers: net: cpsw: use cpsw-phy-sel driver to configure phy mode
From: Mugunthan V N @ 2013-09-20 19:20 UTC (permalink / raw)
To: netdev
Cc: zonque, davem, bcousson, tony, devicetree, linux-omap,
linux-arm-kernel, Mugunthan V N
In-Reply-To: <1379704841-32693-1-git-send-email-mugunthanvnm@ti.com>
Phy mode can be configured via the cpsw-phy-sel driver, this patch enabled the
cpsw driver to utilise the api provided by the cpsw-phy-sel driver to configure
the phy mode.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Daniel Mack <zonque@gmail.com>
---
drivers/net/ethernet/ti/cpsw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 01c42e1..5efb37b 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1021,6 +1021,10 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
dev_info(priv->dev, "phy found : id is : 0x%x\n",
slave->phy->phy_id);
phy_start(slave->phy);
+
+ /* Configure GMII_SEL register */
+ cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface,
+ slave->slave_num);
}
}
--
1.8.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox