Skip to content

Commit 6cec9b0

Browse files
andreas-gaislermarckleinebudde
authored andcommitted
can: grcan: Add device driver for GRCAN and GRHCAN cores
This driver supports GRCAN and CRHCAN CAN controllers available in the GRLIB VHDL IP core library. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Acked-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent c70edb9 commit 6cec9b0

File tree

6 files changed

+1847
-0
lines changed

6 files changed

+1847
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
What: /sys/class/net/<iface>/grcan/enable0
3+
Date: October 2012
4+
KernelVersion: 3.8
5+
Contact: Andreas Larsson <andreas@gaisler.com>
6+
Description:
7+
Hardware configuration of physical interface 0. This file reads
8+
and writes the "Enable 0" bit of the configuration register.
9+
Possible values: 0 or 1. See the GRCAN chapter of the GRLIB IP
10+
core library documentation for details. The default value is 0
11+
or set by the module parameter grcan.enable0 and can be read at
12+
/sys/module/grcan/parameters/enable0.
13+
14+
What: /sys/class/net/<iface>/grcan/enable1
15+
Date: October 2012
16+
KernelVersion: 3.8
17+
Contact: Andreas Larsson <andreas@gaisler.com>
18+
Description:
19+
Hardware configuration of physical interface 1. This file reads
20+
and writes the "Enable 1" bit of the configuration register.
21+
Possible values: 0 or 1. See the GRCAN chapter of the GRLIB IP
22+
core library documentation for details. The default value is 0
23+
or set by the module parameter grcan.enable1 and can be read at
24+
/sys/module/grcan/parameters/enable1.
25+
26+
What: /sys/class/net/<iface>/grcan/select
27+
Date: October 2012
28+
KernelVersion: 3.8
29+
Contact: Andreas Larsson <andreas@gaisler.com>
30+
Description:
31+
Configuration of which physical interface to be used. Possible
32+
values: 0 or 1. See the GRCAN chapter of the GRLIB IP core
33+
library documentation for details. The default value is 0 or is
34+
set by the module parameter grcan.select and can be read at
35+
/sys/module/grcan/parameters/select.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Aeroflex Gaisler GRCAN and GRHCAN CAN controllers.
2+
3+
The GRCAN and CRHCAN CAN controllers are available in the GRLIB VHDL IP core
4+
library.
5+
6+
Note: These properties are built from the AMBA plug&play in a Leon SPARC system
7+
(the ordinary environment for GRCAN and GRHCAN). There are no dts files for
8+
sparc.
9+
10+
Required properties:
11+
12+
- name : Should be "GAISLER_GRCAN", "01_03d", "GAISLER_GRHCAN" or "01_034"
13+
14+
- reg : Address and length of the register set for the device
15+
16+
- freq : Frequency of the external oscillator clock in Hz (the frequency of
17+
the amba bus in the ordinary case)
18+
19+
- interrupts : Interrupt number for this device
20+
21+
Optional properties:
22+
23+
- systemid : If not present or if the value of the least significant 16 bits
24+
of this 32-bit property is smaller than GRCAN_TXBUG_SAFE_GRLIB_VERSION
25+
a bug workaround is activated.
26+
27+
For further information look in the documentation for the GLIB IP core library:
28+
http://www.gaisler.com/products/grlib/grip.pdf

Documentation/kernel-parameters.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,24 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
905905
gpt [EFI] Forces disk with valid GPT signature but
906906
invalid Protective MBR to be treated as GPT.
907907

908+
grcan.enable0= [HW] Configuration of physical interface 0. Determines
909+
the "Enable 0" bit of the configuration register.
910+
Format: 0 | 1
911+
Default: 0
912+
grcan.enable1= [HW] Configuration of physical interface 1. Determines
913+
the "Enable 0" bit of the configuration register.
914+
Format: 0 | 1
915+
Default: 0
916+
grcan.select= [HW] Select which physical interface to use.
917+
Format: 0 | 1
918+
Default: 0
919+
grcan.txsize= [HW] Sets the size of the tx buffer.
920+
Format: <unsigned int> such that (txsize & ~0x1fffc0) == 0.
921+
Default: 1024
922+
grcan.rxsize= [HW] Sets the size of the rx buffer.
923+
Format: <unsigned int> such that (rxsize & ~0x1fffc0) == 0.
924+
Default: 1024
925+
908926
hashdist= [KNL,NUMA] Large hashes allocated during boot
909927
are distributed across NUMA nodes. Defaults on
910928
for 64-bit NUMA, off otherwise.

drivers/net/can/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ config PCH_CAN
110110
is an IOH for x86 embedded processor (Intel Atom E6xx series).
111111
This driver can access CAN bus.
112112

113+
config CAN_GRCAN
114+
tristate "Aeroflex Gaisler GRCAN and GRHCAN CAN devices"
115+
depends on CAN_DEV && OF
116+
---help---
117+
Say Y here if you want to use Aeroflex Gaisler GRCAN or GRHCAN.
118+
Note that the driver supports little endian, even though little
119+
endian syntheses of the cores would need some modifications on
120+
the hardware level to work.
121+
113122
source "drivers/net/can/mscan/Kconfig"
114123

115124
source "drivers/net/can/sja1000/Kconfig"

drivers/net/can/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ obj-$(CONFIG_CAN_BFIN) += bfin_can.o
2222
obj-$(CONFIG_CAN_JANZ_ICAN3)+= janz-ican3.o
2323
obj-$(CONFIG_CAN_FLEXCAN)+= flexcan.o
2424
obj-$(CONFIG_PCH_CAN)+= pch_can.o
25+
obj-$(CONFIG_CAN_GRCAN)+= grcan.o
2526

2627
ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG

0 commit comments

Comments
 (0)