netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4][upstream] powerpc/p1010: Rearrange header file for FlexCAN
@ 2011-08-08 14:59 Bhaskar Upadhaya
  2011-08-08 15:08 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Bhaskar Upadhaya @ 2011-08-08 14:59 UTC (permalink / raw)
  To: netdev, mkl, holt, wg, davem, linuxppc-release, b22300,
	<socketcan-
  Cc: Bhaskar Upadhaya

- Rearrange header file so that it can be used by both of_ type
  and platform_ type architecture.
- Provide a common read and write interface for of_ type and platform_
  type architecture for accessing h/w registers.
Signed-off-by: Bhaskar Upadhaya <bhaskar.upadhaya@freescale.com>
---
 Based on http://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
 Branch master

 include/linux/can/platform/flexcan.h |   65 ++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
index 72b713a..8458a87 100644
--- a/include/linux/can/platform/flexcan.h
+++ b/include/linux/can/platform/flexcan.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
+ * Copyright 2011 Freescale Semiconductor, Inc.
  *
  * This file is released under the GPLv2
  *
@@ -8,6 +9,27 @@
 #ifndef __CAN_PLATFORM_FLEXCAN_H
 #define __CAN_PLATFORM_FLEXCAN_H
 
+#include <linux/clk.h>
+#include <linux/can/dev.h>
+#include <linux/io.h>
+
+#ifdef CONFIG_OF
+#include<linux/of_platform.h>
+#else
+#include <linux/platform_device.h>
+#include <mach/clock.h>
+#endif
+
+#define DRV_NAME "flexcan"
+
+#ifdef __BIG_ENDIAN
+#define flexcan_read(x)	in_be32(x)
+#define flexcan_write(x, y) out_be32(y, x)
+#else
+#define flexcan_read(x)	readl(x)
+#define flexcan_write(x, y) writel(x, y)
+#endif
+
 /**
  * struct flexcan_platform_data - flex CAN controller platform data
  * @transceiver_enable:         - called to power on/off the transceiver
@@ -17,4 +39,47 @@ struct flexcan_platform_data {
 	void (*transceiver_switch)(int enable);
 };
 
+struct flexcan_interface {
+	int (*clk_enable) (struct clk *clk);
+	void (*clk_disable) (struct clk *clk);
+	void (*clk_put) (struct clk *clk);
+	unsigned long (*clk_get_rate) (struct clk *clk);
+	struct clk *(*clk_get) (struct device *dev, const char *id);
+};
+
+struct flexcan_resource {
+	u32 irq;
+	u64 addr;
+	u64 size;
+	const char *drv_name;
+};
+
+#ifdef CONFIG_OF
+struct clk {
+	unsigned long		rate;
+	void			*data;
+};
+#endif
+
+struct flexcan_priv {
+	struct can_priv can;
+	struct net_device *dev;
+	struct napi_struct napi;
+
+	void __iomem *base;
+	u32 reg_esr;
+	u32 reg_ctrl_default;
+
+	struct clk *clk;
+	struct flexcan_interface *flexcan_ops;
+	struct flexcan_platform_data *pdata;
+};
+
+int flexcan_dev_init(struct device *pdev, struct flexcan_resource
+			flexcan_res, struct flexcan_interface *flexcan_ops);
+
+void __devexit unregister_flexcandev(struct net_device *dev);
+
+void flexcan_reg_dump(struct net_device *dev);
+
 #endif /* __CAN_PLATFORM_FLEXCAN_H */
-- 
1.5.6.5



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

* Re: [PATCH 1/4][upstream] powerpc/p1010: Rearrange header file for FlexCAN
  2011-08-08 14:59 [PATCH 1/4][upstream] powerpc/p1010: Rearrange header file for FlexCAN Bhaskar Upadhaya
@ 2011-08-08 15:08 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2011-08-08 15:08 UTC (permalink / raw)
  To: Bhaskar Upadhaya
  Cc: netdev, holt, wg, davem, linuxppc-release, b22300, socketcan-core

[-- Attachment #1: Type: text/plain, Size: 3381 bytes --]

On 08/08/2011 04:59 PM, Bhaskar Upadhaya wrote:
> - Rearrange header file so that it can be used by both of_ type
>   and platform_ type architecture.
> - Provide a common read and write interface for of_ type and platform_
>   type architecture for accessing h/w registers.
> Signed-off-by: Bhaskar Upadhaya <bhaskar.upadhaya@freescale.com>

NACK - please have a look at Robin's patches. They are in a much better
shape.

cheers, Marc
> ---
>  Based on http://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
>  Branch master
> 
>  include/linux/can/platform/flexcan.h |   65 ++++++++++++++++++++++++++++++++++
>  1 files changed, 65 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
> index 72b713a..8458a87 100644
> --- a/include/linux/can/platform/flexcan.h
> +++ b/include/linux/can/platform/flexcan.h
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
> + * Copyright 2011 Freescale Semiconductor, Inc.
>   *
>   * This file is released under the GPLv2
>   *
> @@ -8,6 +9,27 @@
>  #ifndef __CAN_PLATFORM_FLEXCAN_H
>  #define __CAN_PLATFORM_FLEXCAN_H
>  
> +#include <linux/clk.h>
> +#include <linux/can/dev.h>
> +#include <linux/io.h>
> +
> +#ifdef CONFIG_OF
> +#include<linux/of_platform.h>
> +#else
> +#include <linux/platform_device.h>
> +#include <mach/clock.h>
> +#endif
> +
> +#define DRV_NAME "flexcan"
> +
> +#ifdef __BIG_ENDIAN
> +#define flexcan_read(x)	in_be32(x)
> +#define flexcan_write(x, y) out_be32(y, x)
> +#else
> +#define flexcan_read(x)	readl(x)
> +#define flexcan_write(x, y) writel(x, y)
> +#endif
> +
>  /**
>   * struct flexcan_platform_data - flex CAN controller platform data
>   * @transceiver_enable:         - called to power on/off the transceiver
> @@ -17,4 +39,47 @@ struct flexcan_platform_data {
>  	void (*transceiver_switch)(int enable);
>  };
>  
> +struct flexcan_interface {
> +	int (*clk_enable) (struct clk *clk);
> +	void (*clk_disable) (struct clk *clk);
> +	void (*clk_put) (struct clk *clk);
> +	unsigned long (*clk_get_rate) (struct clk *clk);
> +	struct clk *(*clk_get) (struct device *dev, const char *id);
> +};
> +
> +struct flexcan_resource {
> +	u32 irq;
> +	u64 addr;
> +	u64 size;
> +	const char *drv_name;
> +};
> +
> +#ifdef CONFIG_OF
> +struct clk {
> +	unsigned long		rate;
> +	void			*data;
> +};
> +#endif
> +
> +struct flexcan_priv {
> +	struct can_priv can;
> +	struct net_device *dev;
> +	struct napi_struct napi;
> +
> +	void __iomem *base;
> +	u32 reg_esr;
> +	u32 reg_ctrl_default;
> +
> +	struct clk *clk;
> +	struct flexcan_interface *flexcan_ops;
> +	struct flexcan_platform_data *pdata;
> +};
> +
> +int flexcan_dev_init(struct device *pdev, struct flexcan_resource
> +			flexcan_res, struct flexcan_interface *flexcan_ops);
> +
> +void __devexit unregister_flexcandev(struct net_device *dev);
> +
> +void flexcan_reg_dump(struct net_device *dev);
> +
>  #endif /* __CAN_PLATFORM_FLEXCAN_H */


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

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

end of thread, other threads:[~2011-08-08 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 14:59 [PATCH 1/4][upstream] powerpc/p1010: Rearrange header file for FlexCAN Bhaskar Upadhaya
2011-08-08 15:08 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).