Thread (21 messages) 21 messages, 4 authors, 2021-06-18

Re: [PATCH v2 1/5] can: flexcan: add platform data for ColdFire

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-17 08:30:10
Also in: linux-m68k

On 6/17/21 9:23 AM, Angelo Dureghello wrote:
Hi Greg,

On 17/06/21 2:17 AM, Greg Ungerer wrote:
quoted
Hi Angelo,

On 17/6/21 9:16 am, Angelo Dureghello wrote:
quoted
Add platform data object for ColdFire architecture.

---
Changes for v2:
- move header file in more proper location
- remove irq defines
- change variable types to match driver types

Signed-off-by: Angelo Dureghello <redacted>
---
  include/linux/can/platform/mcf5441x.h | 28 +++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
  create mode 100644 include/linux/can/platform/mcf5441x.h
diff --git a/include/linux/can/platform/mcf5441x.h 
b/include/linux/can/platform/mcf5441x.h
new file mode 100644
index 000000000000..6866f0f60caf
--- /dev/null
+++ b/include/linux/can/platform/mcf5441x.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Flexcan options for ColdFire family
+ *
+ * Copyright (C) 2021  Angelo Dureghello <angelo@kernel-space.org>
+ *
+ * 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 in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _PLAT_FLEXCAN_MCF_H
+#define _PLAT_FLEXCAN_MCF_H
+
+struct mcf_flexcan_platform_data {
+    u8 clk_src;
+    u32 clock_frequency;
+    bool big_endian;
+};
+
+#define FLEXCAN_MCF5411X_MB_CNT_MCF    16
+
+#endif /* _PLAT_FLEXCAN_MCF_H */
Is this actually specific to the ColdFire M5411x SoC?
I thought a number of other ColdFire parts also have canbus support.
Are they not all the same underlying hardware block?

So should this be more generic, say flexcan.h or mcf_flexcan.h or 
something like that?

yes, the file can be reused for all mcf, they have similar
hardware blocks (flexcan) but with small differences, like i.e.
number of buffers, so the define guards are named generic (MCF),
with specific defines as needed,

Will rename it to mcf_flexcan.h.
The platform data is not mcf specific, it only holds the information which would
otherwise be part of the device tree (and is not accessible via other frameworks).

From my point of view, it makes sense to name it flexcan.h and place it under
include/linux/can/platform.

Marc

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help