All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] upcoming pull-request to net-next
@ 2012-07-02 12:40 Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 1/6] can: cc770: fix sparse warning for cc770_interrupt Marc Kleine-Budde
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can

Hello,

I'm going to send a pull request with this patches to David. Any objections?
Any missing Acked-by, or Tested-by?

regards, Marc


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] can: cc770: fix sparse warning for cc770_interrupt
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 2/6] can: dev: fix sparse warning for can_restart Marc Kleine-Budde
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde

Make cc770_interrupt static to fix the following sparse warning:
drivers/net/can/cc770/cc770.c:699:13: warning: symbol
'cc770_interrupt' was not declared. Should it be static?

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/cc770/cc770.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c
index d42a6a7..a138db1 100644
--- a/drivers/net/can/cc770/cc770.c
+++ b/drivers/net/can/cc770/cc770.c
@@ -695,7 +695,7 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
 	netif_wake_queue(dev);
 }
 
-irqreturn_t cc770_interrupt(int irq, void *dev_id)
+static irqreturn_t cc770_interrupt(int irq, void *dev_id)
 {
 	struct net_device *dev = (struct net_device *)dev_id;
 	struct cc770_priv *priv = netdev_priv(dev);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] can: dev: fix sparse warning for can_restart
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 1/6] can: cc770: fix sparse warning for cc770_interrupt Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 3/6] can: fix sparse warning in af_can.c Marc Kleine-Budde
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde

Make can_restart static to fix the following sparse warning:
drivers/net/can/dev.c:371:6: warning: symbol 'can_restart' was not
declared. Should it be static?

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 239e4dd..963e2cc 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -401,7 +401,7 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
 /*
  * CAN device restart for bus-off recovery
  */
-void can_restart(unsigned long data)
+static void can_restart(unsigned long data)
 {
 	struct net_device *dev = (struct net_device *)data;
 	struct can_priv *priv = netdev_priv(dev);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] can: fix sparse warning in af_can.c
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 1/6] can: cc770: fix sparse warning for cc770_interrupt Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 2/6] can: dev: fix sparse warning for can_restart Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 4/6] net: flexcan: clock-frequency is optional for device tree probe Marc Kleine-Budde
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Oliver Hartkopp, Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

Put can_rx_alldev_list into the af_can header to fix the following
sparse warning: net/can/af_can.c:80:22: warning: symbol
'can_rx_alldev_list' was not declared. Should it be static?

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/af_can.h |    3 +++
 net/can/proc.c   |    3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/can/af_can.h b/net/can/af_can.h
index fd882db..1dccb4c 100644
--- a/net/can/af_can.h
+++ b/net/can/af_can.h
@@ -104,6 +104,9 @@ struct s_pstats {
 	unsigned long rcv_entries_max;
 };
 
+/* receive filters subscribed for 'all' CAN devices */
+extern struct dev_rcv_lists can_rx_alldev_list;
+
 /* function prototypes for the CAN networklayer procfs (proc.c) */
 extern void can_init_proc(void);
 extern void can_remove_proc(void);
diff --git a/net/can/proc.c b/net/can/proc.c
index ba873c3..3b6dd31 100644
--- a/net/can/proc.c
+++ b/net/can/proc.c
@@ -83,9 +83,6 @@ static const char rx_list_name[][8] = {
 	[RX_EFF] = "rx_eff",
 };
 
-/* receive filters subscribed for 'all' CAN devices */
-extern struct dev_rcv_lists can_rx_alldev_list;
-
 /*
  * af_can statistics stuff
  */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] net: flexcan: clock-frequency is optional for device tree probe
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2012-07-02 12:40 ` [PATCH 3/6] can: fix sparse warning in af_can.c Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 5/6] can: flexcan: use of_property_read_u32 to get DT entry value Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 6/6] can: flexcan: add hardware controller version support Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Shawn Guo, Marc Kleine-Budde

From: Shawn Guo <shawn.guo@linaro.org>

The property clock-frequency is optional for device tree probe.  When
it's absent, the flexcan driver will try to get the frequency from clk
system by calling clk_get_rate.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index f31b686..8ff324e 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -11,6 +11,9 @@ Required properties:
 
 - reg : Offset and length of the register set for this device
 - interrupts : Interrupt tuple for this device
+
+Optional properties:
+
 - clock-frequency : The oscillator frequency driving the flexcan device
 
 Example:
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] can: flexcan: use of_property_read_u32 to get DT entry value
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2012-07-02 12:40 ` [PATCH 4/6] net: flexcan: clock-frequency is optional for device tree probe Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  2012-07-02 12:40 ` [PATCH 6/6] can: flexcan: add hardware controller version support Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Hui Wang, Marc Kleine-Budde, Wolfgang Grandegger, Shawn Guo

From: Hui Wang <jason77.wang@gmail.com>

of_property_read_u32() can auto handle endian problems, use this
function can make code clean and simple.

No need to check return value here since the following got value
check will handle this.

Cc: linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 0f88cd3..b429b3f 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -938,14 +938,9 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	if (IS_ERR(pinctrl))
 		return PTR_ERR(pinctrl);
 
-	if (pdev->dev.of_node) {
-		const __be32 *clock_freq_p;
-
-		clock_freq_p = of_get_property(pdev->dev.of_node,
-						"clock-frequency", NULL);
-		if (clock_freq_p)
-			clock_freq = be32_to_cpup(clock_freq_p);
-	}
+	if (pdev->dev.of_node)
+		of_property_read_u32(pdev->dev.of_node,
+						"clock-frequency", &clock_freq);
 
 	if (!clock_freq) {
 		clk = clk_get(&pdev->dev, NULL);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] can: flexcan: add hardware controller version support
  2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2012-07-02 12:40 ` [PATCH 5/6] can: flexcan: use of_property_read_u32 to get DT entry value Marc Kleine-Budde
@ 2012-07-02 12:40 ` Marc Kleine-Budde
  5 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02 12:40 UTC (permalink / raw)
  To: linux-can; +Cc: Hui Wang, Marc Kleine-Budde, Wolfgang Grandegger, Shawn Guo

From: Hui Wang <jason77.wang@gmail.com>

At least in the i.MX series, the flexcan contrller divides into ver_3
and ver_10, current driver is for ver_3 controller.

i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
Its reset value is 0xffffffff, this means ID Filter Table must be
checked when receive a packet, but the driver is designed to accept
everything during the chip start, we need to clear this register to
follow this design.

Use the data entry of the struct of_device_id to point chip specific
info, we can set hardware version for each platform.

Cc: linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
[mkl: add id_table support]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/flexcan.c |   60 +++++++++++++++++++++++++++++++++++++++------
 1 file changed, 52 insertions(+), 8 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index b429b3f..81324a1 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -34,6 +34,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pinctrl/consumer.h>
 
@@ -165,10 +166,21 @@ struct flexcan_regs {
 	u32 imask1;		/* 0x28 */
 	u32 iflag2;		/* 0x2c */
 	u32 iflag1;		/* 0x30 */
-	u32 _reserved2[19];
+	u32 crl2;		/* 0x34 */
+	u32 esr2;		/* 0x38 */
+	u32 imeur;		/* 0x3c */
+	u32 lrfr;		/* 0x40 */
+	u32 crcr;		/* 0x44 */
+	u32 rxfgmask;		/* 0x48 */
+	u32 rxfir;		/* 0x4c */
+	u32 _reserved3[12];
 	struct flexcan_mb cantxfg[64];
 };
 
+struct flexcan_devtype_data {
+	u32 hw_ver;	/* hardware controller version */
+};
+
 struct flexcan_priv {
 	struct can_priv can;
 	struct net_device *dev;
@@ -180,6 +192,15 @@ struct flexcan_priv {
 
 	struct clk *clk;
 	struct flexcan_platform_data *pdata;
+	struct flexcan_devtype_data *devtype_data;
+};
+
+static struct flexcan_devtype_data fsl_p1010_devtype_data = {
+	.hw_ver = 3,
+};
+
+static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
+	.hw_ver = 10,
 };
 
 static struct can_bittiming_const flexcan_bittiming_const = {
@@ -750,6 +771,9 @@ static int flexcan_chip_start(struct net_device *dev)
 	flexcan_write(0x0, &regs->rx14mask);
 	flexcan_write(0x0, &regs->rx15mask);
 
+	if (priv->devtype_data->hw_ver >= 10)
+		flexcan_write(0x0, &regs->rxfgmask);
+
 	flexcan_transceiver_switch(priv, 1);
 
 	/* synchronize with the can bus */
@@ -922,8 +946,21 @@ static void __devexit unregister_flexcandev(struct net_device *dev)
 	unregister_candev(dev);
 }
 
+static const struct of_device_id flexcan_of_match[] = {
+	{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
+	{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
+	{ /* sentinel */ },
+};
+
+static const struct platform_device_id flexcan_id_table[] = {
+	{ .name = "flexcan", .driver_data = (kernel_ulong_t)&fsl_p1010_devtype_data, },
+	{ /* sentinel */ },
+};
+
 static int __devinit flexcan_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
+	struct flexcan_devtype_data *devtype_data;
 	struct net_device *dev;
 	struct flexcan_priv *priv;
 	struct resource *mem;
@@ -977,6 +1014,17 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 		goto failed_alloc;
 	}
 
+	of_id = of_match_device(flexcan_of_match, &pdev->dev);
+	if (of_id) {
+		devtype_data = of_id->data;
+	} else if (pdev->id_entry->driver_data) {
+		devtype_data = (struct flexcan_devtype_data *)
+			pdev->id_entry->driver_data;
+	} else {
+		err = -ENODEV;
+		goto failed_devtype;
+	}
+
 	dev->netdev_ops = &flexcan_netdev_ops;
 	dev->irq = irq;
 	dev->flags |= IFF_ECHO;
@@ -993,6 +1041,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	priv->dev = dev;
 	priv->clk = clk;
 	priv->pdata = pdev->dev.platform_data;
+	priv->devtype_data = devtype_data;
 
 	netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT);
 
@@ -1011,6 +1060,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	return 0;
 
  failed_register:
+ failed_devtype:
 	free_candev(dev);
  failed_alloc:
 	iounmap(base);
@@ -1044,13 +1094,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id flexcan_of_match[] = {
-	{
-		.compatible = "fsl,p1010-flexcan",
-	},
-	{},
-};
-
 #ifdef CONFIG_PM
 static int flexcan_suspend(struct platform_device *pdev, pm_message_t state)
 {
@@ -1097,6 +1140,7 @@ static struct platform_driver flexcan_driver = {
 	.remove = __devexit_p(flexcan_remove),
 	.suspend = flexcan_suspend,
 	.resume = flexcan_resume,
+	.id_table = flexcan_id_table,
 };
 
 module_platform_driver(flexcan_driver);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-02 12:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-02 12:40 [PATCH 0/6] upcoming pull-request to net-next Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 1/6] can: cc770: fix sparse warning for cc770_interrupt Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 2/6] can: dev: fix sparse warning for can_restart Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 3/6] can: fix sparse warning in af_can.c Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 4/6] net: flexcan: clock-frequency is optional for device tree probe Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 5/6] can: flexcan: use of_property_read_u32 to get DT entry value Marc Kleine-Budde
2012-07-02 12:40 ` [PATCH 6/6] can: flexcan: add hardware controller version support Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.