All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-02  9:11 =?gb18030?B?SmFjayBMZWU=?=
  0 siblings, 0 replies; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-02  9:11 UTC (permalink / raw)
  To: =?gb18030?B?d2c=?=, =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 9639 bytes --]

> Hello,
> 
> Am 02.09.2016 um 10:19 schrieb Jack Lee:
> >> Hello,
> >>
> >> Am 02.09.2016 um 09:23 schrieb Jack Lee:
> >>>> Hello,
> >>>>
> >>>> Am 02.09.2016 um 08:23 schrieb Jack Lee:
> >>>>> Hi, everyone£¡
> >>>>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> >>>>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> >>>>> The original driver works fine, but I need it to be realtime.
> >>>>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> >>>>> "#dmesg | grep -i can" output was
> >>>>> ...
> >>>>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> >>>>> RTCAN SJA1000 driver initialized
> >>>>>
> >>>>> "#lsmod | grep -i can" output was
> >>>>> xeno_can_adv_pci
> >>>>> xeno_can_sja1000    used by xeno_can_adv_pci
> >>>>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
> >>>>>
> >>>>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
> >>>>> The /proc/rtcan directory just has three files: devices, sockets and versio
> >>>>
> >>>> What is the PCI device id of the CAN device? You can use "lspci -vv" to
> >>>> list the ids.
> >>>>
> >>>>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
> >>>>
> >>>> Most likely the device id is missing in the driver PCI device list:
> >>>>
> >>>>
> >>>> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
> >>>>
> >>>> Wolfgang.
> >>>
> >>> Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
> >>
> >> No problem.
> >>
> >>> CAN board information is below.
> >>> #lspci -vv
> >>> 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> >>> 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> >>> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> >>> 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> >>> 	Latency: 0, Cache Line Size: 64 bytes
> >>> 	Interrupt: pin A routed to IRQ 10
> >>> 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> >>> 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> >>> 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> >>> 	Capabilities: <access denied>
> >>
> >> Could you please use "lspci -vvn" to get  numbers (instead of strings).
> >>
> >> Wolfgang.
> > 
> > Thanks! The information is below.
> > #lspci -vvn
> > 03:00.0 0c09: 13fe:c302
> > 	Subsystem: 13fe:c302
> > 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> > 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> > 	Latency: 0, Cache Line Size: 64 bytes
> > 	Interrupt: pin A routed to IRQ 10
> > 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> > 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> > 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> > 	Capabilities: [40] Power Management version 3
> > 		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
> > 		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
> > 	Capabilities: [48] MSI: Enable- Count=1/2 Maskable- 64bit+
> > 		Address: 0000000000000000  Data: 0000
> > 	Capabilities: [58] Express (v1) Legacy Endpoint, MSI 00
> > 		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
> > 			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
> > 		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
> > 			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
> > 			MaxPayload 128 bytes, MaxReadReq 512 bytes
> > 		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
> > 		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited, L1 unlimited
> > 			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
> > 		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
> > 			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
> > 		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
> > 
> > 
> > Is ¡°0c09: 13fe:c302¡± the device ID? Can you show me some instructions to make this device work? I am really new to this.
> 
> The PCI vendor id is 0x13fe and the device id is 0xc302.
> 
> > I opened the link you paste above, perhaps the following two places should be modified.
> > 
> > A new line "ADV_PCI_DEVICE(0xc302), " should be added?
> > ---------------------------------------------------------------
> > 	static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
> > 		ADV_PCI_DEVICE(0x1680),
> > 		ADV_PCI_DEVICE(0x3680),
> > 		ADV_PCI_DEVICE(0x2052),
> > 		ADV_PCI_DEVICE(0x1681),
> > 		ADV_PCI_DEVICE(0xc001),
> > 		ADV_PCI_DEVICE(0xc002),
> > 		ADV_PCI_DEVICE(0xc004),
> > 		ADV_PCI_DEVICE(0xc101),
> > 		ADV_PCI_DEVICE(0xc102),
> > 		ADV_PCI_DEVICE(0xc104),
> > 		/* required last entry */
> > 		{ }
> > 	};
> > 
> > How to deal with this one?
> > ---------------------------------------------------------------
> > 	switch (pdev->device) {
> > 	case 0xc001:
> > 	case 0xc002:
> > 	case 0xc004:
> > 	case 0xc101:
> > 	case 0xc102:
> > 	case 0xc104:
> > 		nb_ports = pdev->device & 0x7;
> > 		offset = 0x100;
> > 		bar = 0;
> > 		break;
> > 	case 0x1680:
> > 	case 0x2052:
> > 		nb_ports = 2;
> > 		bar = 2;
> > 		bar_flag = 1;
> > 		break;
> > 	case 0x1681:
> > 		nb_ports = 1;
> > 		bar = 2;
> > 		bar_flag = 1;
> > 		break;
> > 	default:
> > 		goto failure_regions;
> > 	}
> 
> Could you please give the untested patch below a try.
> 
> Good luck,
> 
> Wolfgang.
> 
> >From 00c9631f26675b90ea1ff2b4bb9f72fd81fcb91c Mon Sep 17 00:00:00 2001
> From: Wolfgang Grandegger <Wolfgang Grandegger>
> Date: Fri, 2 Sep 2016 10:46:26 +0200
> Subject: [PATCH] rtcan: add support for new Advantec CAN PCI devices
> 
> ---
>  ksrc/drivers/can/sja1000/rtcan_adv_pci.c | 46 +++++++++++++++++++++++++++++---
>  1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> index 1d36e7b..c3de052 100644
> --- a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> +++ b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> @@ -95,6 +95,12 @@ static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
>  	ADV_PCI_DEVICE(0xc101),
>  	ADV_PCI_DEVICE(0xc102),
>  	ADV_PCI_DEVICE(0xc104),
> +	ADV_PCI_DEVICE(0xc201),
> +	ADV_PCI_DEVICE(0xc202),
> +	ADV_PCI_DEVICE(0xc204),
> +	ADV_PCI_DEVICE(0xc301),
> +	ADV_PCI_DEVICE(0xc302),
> +	ADV_PCI_DEVICE(0xc304),
>  	/* required last entry */
>  	{ }
>  };
> @@ -115,6 +121,21 @@ static void rtcan_adv_pci_write_reg(struct rtcan_device *dev, int port, u8 data)
> 	iowrite8(data, board->base_addr + port);
>  }
>  
> +static u8 rtcan_adv_pci_read_reg_shift2(struct rtcan_device *dev, int port)
> +{
> +	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
> +
> +	return ioread8(board->base_addr + (port << 2));
> +}
> +
> +static void rtcan_adv_pci_write_reg_shift2(struct rtcan_device *dev, int port,
> +					   u8 data)
> +{
> +	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
> +
> +	iowrite8(data, board->base_addr + (port << 2));
> +}
> +
>  static void rtcan_adv_pci_del_chan(struct pci_dev *pdev,
>  				   struct rtcan_device *dev)
>  {
> @@ -137,6 +158,7 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
>  				  int channel,
>  				  unsigned int bar,
>  				  unsigned int offset,
> +				  unsigned int shift,
>  				  struct rtcan_device **master_dev)
>  {
>  	struct rtcan_device *dev;
> @@ -180,8 +202,13 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
>  
>  	dev->board_name = adv_pci_board_name;
>  
> -	chip->read_reg = rtcan_adv_pci_read_reg;
> -	chip->write_reg = rtcan_adv_pci_write_reg;
> +	if (shift == 2) {
> +		chip->read_reg = rtcan_adv_pci_read_reg_shift2;
> +		chip->write_reg = rtcan_adv_pci_write_reg_shift2;
> +	} else {
> +		chip->read_reg = rtcan_adv_pci_read_reg;
> +		chip->write_reg = rtcan_adv_pci_write_reg;
> +	}
>  
>  	/* Clock frequency in Hz */
>  	dev->can_sys_clock = ADV_PCI_CAN_CLOCK;
> @@ -244,6 +271,7 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  	unsigned int bar = 0;
>  	unsigned int bar_flag = 0;
>  	unsigned int offset = 0;
> +	unsigned int shift = 0;
>  	unsigned int ix;
>  
>  	struct rtcan_device *master_dev = NULL;
> @@ -270,7 +298,16 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  	case 0xc104:
>  		nb_ports = pdev->device & 0x7;
>  		offset = 0x100;
> -		bar = 0;
> +		break;
> +	case 0xc201:
> +	case 0xc202:
> +	case 0xc204:
> +	case 0xc301:
> +	case 0xc302:
> +	case 0xc304:
> +		nb_ports = pdev->device & 0x7;
> +		offset = 0x400;
> +		shift = 2;
>  		break;
>  	case 0x1680:
>  	case 0x2052:
> @@ -298,7 +335,8 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  		   pdev->device,
>  		   pdev->subsystem_device);
>  
> -	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, &master_dev);
> +	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, shift,
> +				     &master_dev);
>  	if (ret)
>  		goto failure_iounmap;
>  
> -- 
> 1.9.1

Thank you very much. Are you the Wolfgang of the driver author? That's really amazing and you are really a nice person. Wish you a good weekend!
As I have mentioned, I am new to this, it will take me a while coming back. Thank you!

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

* Re: [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
  2016-09-03  0:54 =?gb18030?B?SmFjayBMZWU=?=
@ 2016-09-03  9:46 ` Wolfgang Grandegger
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Grandegger @ 2016-09-03  9:46 UTC (permalink / raw)
  To: Jack Lee, xenomai

Hello,

Am 03.09.2016 um 02:54 schrieb Jack Lee:
...snip...

> ------------I am back.--------------
> I modified the source code and compiled the xeno_can_adv_pci.ko with
> "make CONFIG_XENO_...=m -C $(krnsrc)
> M=$(krnsrc)/drivers/xenomai/can/sja1000 modules".
> After copied the module to the /lib/... directory and "modprobe
> xeno_can_adv_pci", /proc/rtcan/devices remain the same. But "dmesg |
> grep -i can" outputs these:
> ...
> [  239.374873] RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development
> Team
> [  239.396977] RTCAN SJA1000 driver initialized
> [  239.405819] xeno_can_adv_pci: module verification failed: signature
> and/or required key missing - tainting kernel
> [  239.408014] ADV-PCI-CAN 0000:03:00.0: RTCAN Registering card
> [  239.408121] ADV-PCI-CAN 0000:03:00.0: PCI->APIC IRQ transform: INT A
> -> IRQ 18
> [  239.408189] ADV-PCI-CAN 0000:03:00.0: RTCAN detected Advantech PCI
> card at slot #0
> [  239.408254] ADV-PCI-CAN: Initializing device 13fe:c302:c302
> [  239.408386] ADV-PCI-CAN: base_addr=ffffc900008fe400
> conf_addr=          (null) irq=18 ocr=0xfa cdr=0xc0
> [  239.408575] rtcan: registered rtcan0
> [  239.408631] Unregistering SJA1000 device rtcan0
> [  239.408736] RTCAN: unregistered rtcan0
> [  239.408890] ADV-PCI-CAN: probe of 0000:03:00.0 failed with error -5

Oops, I forgot to adjust the mapped PCI space. In "pci_map()" "ADV_PCI_BASE_SIZE << shift"
should be used. Below is v2 of the patch. Hope it works now.

Wolfgang.


>From f346a0e7b08a02cc4ef3b06eef88992a6140b957 Mon Sep 17 00:00:00 2001
From: Wolfgang Grandegger <Wolfgang Grandegger>
Date: Fri, 2 Sep 2016 10:46:26 +0200
Subject: [PATCH v2] rtcan: add support for new Advantec CAN PCI devices

---
 ksrc/drivers/can/sja1000/rtcan_adv_pci.c | 52 ++++++++++++++++++++++++++++----
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
index 1d36e7b..9d2ea7b 100644
--- a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
+++ b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
@@ -95,6 +95,12 @@ static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
 	ADV_PCI_DEVICE(0xc101),
 	ADV_PCI_DEVICE(0xc102),
 	ADV_PCI_DEVICE(0xc104),
+	ADV_PCI_DEVICE(0xc201),
+	ADV_PCI_DEVICE(0xc202),
+	ADV_PCI_DEVICE(0xc204),
+	ADV_PCI_DEVICE(0xc301),
+	ADV_PCI_DEVICE(0xc302),
+	ADV_PCI_DEVICE(0xc304),
 	/* required last entry */
 	{ }
 };
@@ -115,6 +121,21 @@ static void rtcan_adv_pci_write_reg(struct rtcan_device *dev, int port, u8 data)
 	iowrite8(data, board->base_addr + port);
 }
 
+static u8 rtcan_adv_pci_read_reg_shift2(struct rtcan_device *dev, int port)
+{
+	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
+
+	return ioread8(board->base_addr + (port << 2));
+}
+
+static void rtcan_adv_pci_write_reg_shift2(struct rtcan_device *dev, int port,
+					   u8 data)
+{
+	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
+
+	iowrite8(data, board->base_addr + (port << 2));
+}
+
 static void rtcan_adv_pci_del_chan(struct pci_dev *pdev,
 				   struct rtcan_device *dev)
 {
@@ -137,6 +158,7 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
 				  int channel,
 				  unsigned int bar,
 				  unsigned int offset,
+				  unsigned int shift,
 				  struct rtcan_device **master_dev)
 {
 	struct rtcan_device *dev;
@@ -161,13 +183,15 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
 		if (offset)
 			base_addr = master_board->base_addr+offset;
 		else
-			base_addr = pci_iomap(pdev, bar, ADV_PCI_BASE_SIZE);
+			base_addr = pci_iomap(pdev, bar,
+					      ADV_PCI_BASE_SIZE << shift);
 			if (!base_addr) {
 				ret = -EIO;
 				goto failure;
 			}
 	} else {
-		base_addr = pci_iomap(pdev, bar, ADV_PCI_BASE_SIZE) + offset;
+		base_addr = pci_iomap(pdev, bar,
+				      ADV_PCI_BASE_SIZE << shift) + offset;
 		if (!base_addr) {
 			ret = -EIO;
 			goto failure;
@@ -180,8 +204,13 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
 
 	dev->board_name = adv_pci_board_name;
 
-	chip->read_reg = rtcan_adv_pci_read_reg;
-	chip->write_reg = rtcan_adv_pci_write_reg;
+	if (shift == 2) {
+		chip->read_reg = rtcan_adv_pci_read_reg_shift2;
+		chip->write_reg = rtcan_adv_pci_write_reg_shift2;
+	} else {
+		chip->read_reg = rtcan_adv_pci_read_reg;
+		chip->write_reg = rtcan_adv_pci_write_reg;
+	}
 
 	/* Clock frequency in Hz */
 	dev->can_sys_clock = ADV_PCI_CAN_CLOCK;
@@ -244,6 +273,7 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 	unsigned int bar = 0;
 	unsigned int bar_flag = 0;
 	unsigned int offset = 0;
+	unsigned int shift = 0;
 	unsigned int ix;
 
 	struct rtcan_device *master_dev = NULL;
@@ -270,7 +300,16 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 	case 0xc104:
 		nb_ports = pdev->device & 0x7;
 		offset = 0x100;
-		bar = 0;
+		break;
+	case 0xc201:
+	case 0xc202:
+	case 0xc204:
+	case 0xc301:
+	case 0xc302:
+	case 0xc304:
+		nb_ports = pdev->device & 0x7;
+		offset = 0x400;
+		shift = 2;
 		break;
 	case 0x1680:
 	case 0x2052:
@@ -298,7 +337,8 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 		   pdev->device,
 		   pdev->subsystem_device);
 
-	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, &master_dev);
+	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, shift,
+				     &master_dev);
 	if (ret)
 		goto failure_iounmap;
 
-- 
1.9.1



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

* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-03  0:54 =?gb18030?B?SmFjayBMZWU=?=
  2016-09-03  9:46 ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-03  0:54 UTC (permalink / raw)
  To: =?gb18030?B?d2c=?=, =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 11121 bytes --]

> Hello,
> 
> Am 02.09.2016 um 10:19 schrieb Jack Lee:
> >> Hello,
> >>
> >> Am 02.09.2016 um 09:23 schrieb Jack Lee:
> >>>> Hello,
> >>>>
> >>>> Am 02.09.2016 um 08:23 schrieb Jack Lee:
> >>>>> Hi, everyone£¡
> >>>>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> >>>>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> >>>>> The original driver works fine, but I need it to be realtime.
> >>>>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> >>>>> "#dmesg | grep -i can" output was
> >>>>> ...
> >>>>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> >>>>> RTCAN SJA1000 driver initialized
> >>>>>
> >>>>> "#lsmod | grep -i can" output was
> >>>>> xeno_can_adv_pci
> >>>>> xeno_can_sja1000    used by xeno_can_adv_pci
> >>>>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
> >>>>>
> >>>>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
> >>>>> The /proc/rtcan directory just has three files: devices, sockets and versio
> >>>>
> >>>> What is the PCI device id of the CAN device? You can use "lspci -vv" to
> >>>> list the ids.
> >>>>
> >>>>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
> >>>>
> >>>> Most likely the device id is missing in the driver PCI device list:
> >>>>
> >>>>
> >>>> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
> >>>>
> >>>> Wolfgang.
> >>>
> >>> Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
> >>
> >> No problem.
> >>
> >>> CAN board information is below.
> >>> #lspci -vv
> >>> 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> >>> 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> >>> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> >>> 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> >>> 	Latency: 0, Cache Line Size: 64 bytes
> >>> 	Interrupt: pin A routed to IRQ 10
> >>> 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> >>> 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> >>> 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> >>> 	Capabilities: <access denied>
> >>
> >> Could you please use "lspci -vvn" to get  numbers (instead of strings).
> >>
> >> Wolfgang.
> > 
> > Thanks! The information is below.
> > #lspci -vvn
> > 03:00.0 0c09: 13fe:c302
> > 	Subsystem: 13fe:c302
> > 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> > 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> > 	Latency: 0, Cache Line Size: 64 bytes
> > 	Interrupt: pin A routed to IRQ 10
> > 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> > 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> > 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> > 	Capabilities: [40] Power Management version 3
> > 		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
> > 		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
> > 	Capabilities: [48] MSI: Enable- Count=1/2 Maskable- 64bit+
> > 		Address: 0000000000000000  Data: 0000
> > 	Capabilities: [58] Express (v1) Legacy Endpoint, MSI 00
> > 		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
> > 			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
> > 		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
> > 			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
> > 			MaxPayload 128 bytes, MaxReadReq 512 bytes
> > 		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
> > 		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited, L1 unlimited
> > 			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
> > 		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
> > 			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
> > 		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
> > 
> > 
> > Is ¡°0c09: 13fe:c302¡± the device ID? Can you show me some instructions to make this device work? I am really new to this.
> 
> The PCI vendor id is 0x13fe and the device id is 0xc302.
> 
> > I opened the link you paste above, perhaps the following two places should be modified.
> > 
> > A new line "ADV_PCI_DEVICE(0xc302), " should be added?
> > ---------------------------------------------------------------
> > 	static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
> > 		ADV_PCI_DEVICE(0x1680),
> > 		ADV_PCI_DEVICE(0x3680),
> > 		ADV_PCI_DEVICE(0x2052),
> > 		ADV_PCI_DEVICE(0x1681),
> > 		ADV_PCI_DEVICE(0xc001),
> > 		ADV_PCI_DEVICE(0xc002),
> > 		ADV_PCI_DEVICE(0xc004),
> > 		ADV_PCI_DEVICE(0xc101),
> > 		ADV_PCI_DEVICE(0xc102),
> > 		ADV_PCI_DEVICE(0xc104),
> > 		/* required last entry */
> > 		{ }
> > 	};
> > 
> > How to deal with this one?
> > ---------------------------------------------------------------
> > 	switch (pdev->device) {
> > 	case 0xc001:
> > 	case 0xc002:
> > 	case 0xc004:
> > 	case 0xc101:
> > 	case 0xc102:
> > 	case 0xc104:
> > 		nb_ports = pdev->device & 0x7;
> > 		offset = 0x100;
> > 		bar = 0;
> > 		break;
> > 	case 0x1680:
> > 	case 0x2052:
> > 		nb_ports = 2;
> > 		bar = 2;
> > 		bar_flag = 1;
> > 		break;
> > 	case 0x1681:
> > 		nb_ports = 1;
> > 		bar = 2;
> > 		bar_flag = 1;
> > 		break;
> > 	default:
> > 		goto failure_regions;
> > 	}
> 
> Could you please give the untested patch below a try.
> 
> Good luck,
> 
> Wolfgang.
> 
> >From 00c9631f26675b90ea1ff2b4bb9f72fd81fcb91c Mon Sep 17 00:00:00 2001
> From: Wolfgang Grandegger <Wolfgang Grandegger>
> Date: Fri, 2 Sep 2016 10:46:26 +0200
> Subject: [PATCH] rtcan: add support for new Advantec CAN PCI devices
> 
> ---
>  ksrc/drivers/can/sja1000/rtcan_adv_pci.c | 46 +++++++++++++++++++++++++++++---
>  1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> index 1d36e7b..c3de052 100644
> --- a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> +++ b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
> @@ -95,6 +95,12 @@ static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
>  	ADV_PCI_DEVICE(0xc101),
>  	ADV_PCI_DEVICE(0xc102),
>  	ADV_PCI_DEVICE(0xc104),
> +	ADV_PCI_DEVICE(0xc201),
> +	ADV_PCI_DEVICE(0xc202),
> +	ADV_PCI_DEVICE(0xc204),
> +	ADV_PCI_DEVICE(0xc301),
> +	ADV_PCI_DEVICE(0xc302),
> +	ADV_PCI_DEVICE(0xc304),
>  	/* required last entry */
>  	{ }
>  };
> @@ -115,6 +121,21 @@ static void rtcan_adv_pci_write_reg(struct rtcan_device *dev, int port, u8 data)
> 	iowrite8(data, board->base_addr + port);
>  }
>  
> +static u8 rtcan_adv_pci_read_reg_shift2(struct rtcan_device *dev, int port)
> +{
> +	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
> +
> +	return ioread8(board->base_addr + (port << 2));
> +}
> +
> +static void rtcan_adv_pci_write_reg_shift2(struct rtcan_device *dev, int port,
> +					   u8 data)
> +{
> +	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
> +
> +	iowrite8(data, board->base_addr + (port << 2));
> +}
> +
>  static void rtcan_adv_pci_del_chan(struct pci_dev *pdev,
>  				   struct rtcan_device *dev)
>  {
> @@ -137,6 +158,7 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
>  				  int channel,
>  				  unsigned int bar,
>  				  unsigned int offset,
> +				  unsigned int shift,
>  				  struct rtcan_device **master_dev)
>  {
>  	struct rtcan_device *dev;
> @@ -180,8 +202,13 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
>  
>  	dev->board_name = adv_pci_board_name;
>  
> -	chip->read_reg = rtcan_adv_pci_read_reg;
> -	chip->write_reg = rtcan_adv_pci_write_reg;
> +	if (shift == 2) {
> +		chip->read_reg = rtcan_adv_pci_read_reg_shift2;
> +		chip->write_reg = rtcan_adv_pci_write_reg_shift2;
> +	} else {
> +		chip->read_reg = rtcan_adv_pci_read_reg;
> +		chip->write_reg = rtcan_adv_pci_write_reg;
> +	}
>  
>  	/* Clock frequency in Hz */
>  	dev->can_sys_clock = ADV_PCI_CAN_CLOCK;
> @@ -244,6 +271,7 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  	unsigned int bar = 0;
>  	unsigned int bar_flag = 0;
>  	unsigned int offset = 0;
> +	unsigned int shift = 0;
>  	unsigned int ix;
>  
>  	struct rtcan_device *master_dev = NULL;
> @@ -270,7 +298,16 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  	case 0xc104:
>  		nb_ports = pdev->device & 0x7;
>  		offset = 0x100;
> -		bar = 0;
> +		break;
> +	case 0xc201:
> +	case 0xc202:
> +	case 0xc204:
> +	case 0xc301:
> +	case 0xc302:
> +	case 0xc304:
> +		nb_ports = pdev->device & 0x7;
> +		offset = 0x400;
> +		shift = 2;
>  		break;
>  	case 0x1680:
>  	case 0x2052:
> @@ -298,7 +335,8 @@ static int adv_pci_init_one(struct pci_dev *pdev,
>  		   pdev->device,
>  		   pdev->subsystem_device);
>  
> -	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, &master_dev);
> +	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, shift,
> +				     &master_dev);
>  	if (ret)
>  		goto failure_iounmap;
>  
> -- 
> 1.9.1

Thank you very much. Are you the Wolfgang of the driver author? That's really amazing and you are really a nice person. Wish you a good weekend!
As I have mentioned, I am new to this, it will take me a while coming back. Thank you!
------------I am back.--------------
I modified the source code and compiled the xeno_can_adv_pci.ko with "make CONFIG_XENO_...=m -C $(krnsrc) M=$(krnsrc)/drivers/xenomai/can/sja1000 modules".
After copied the module to the /lib/... directory and "modprobe xeno_can_adv_pci", /proc/rtcan/devices remain the same. But "dmesg | grep -i can" outputs these:
...
[  239.374873] RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team
[  239.396977] RTCAN SJA1000 driver initialized
[  239.405819] xeno_can_adv_pci: module verification failed: signature and/or required key missing - tainting kernel
[  239.408014] ADV-PCI-CAN 0000:03:00.0: RTCAN Registering card
[  239.408121] ADV-PCI-CAN 0000:03:00.0: PCI->APIC IRQ transform: INT A -> IRQ 18
[  239.408189] ADV-PCI-CAN 0000:03:00.0: RTCAN detected Advantech PCI card at slot #0
[  239.408254] ADV-PCI-CAN: Initializing device 13fe:c302:c302
[  239.408386] ADV-PCI-CAN: base_addr=ffffc900008fe400 conf_addr=          (null) irq=18 ocr=0xfa cdr=0xc0
[  239.408575] rtcan: registered rtcan0
[  239.408631] Unregistering SJA1000 device rtcan0
[  239.408736] RTCAN: unregistered rtcan0
[  239.408890] ADV-PCI-CAN: probe of 0000:03:00.0 failed with error -5

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

* Re: [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
  2016-09-02  8:19 =?gb18030?B?SmFjayBMZWU=?=
@ 2016-09-02  8:52 ` Wolfgang Grandegger
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Grandegger @ 2016-09-02  8:52 UTC (permalink / raw)
  To: xenomai

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 8896 bytes --]

Hello,

Am 02.09.2016 um 10:19 schrieb Jack Lee:
>> Hello,
>>
>> Am 02.09.2016 um 09:23 schrieb Jack Lee:
>>>> Hello,
>>>>
>>>> Am 02.09.2016 um 08:23 schrieb Jack Lee:
>>>>> Hi, everyone£¡
>>>>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
>>>>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
>>>>> The original driver works fine, but I need it to be realtime.
>>>>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
>>>>> "#dmesg | grep -i can" output was
>>>>> ...
>>>>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
>>>>> RTCAN SJA1000 driver initialized
>>>>>
>>>>> "#lsmod | grep -i can" output was
>>>>> xeno_can_adv_pci
>>>>> xeno_can_sja1000    used by xeno_can_adv_pci
>>>>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
>>>>>
>>>>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
>>>>> The /proc/rtcan directory just has three files: devices, sockets and versio
>>>>
>>>> What is the PCI device id of the CAN device? You can use "lspci -vv" to
>>>> list the ids.
>>>>
>>>>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
>>>>
>>>> Most likely the device id is missing in the driver PCI device list:
>>>>
>>>>
>>>> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
>>>>
>>>> Wolfgang.
>>>
>>> Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
>>
>> No problem.
>>
>>> CAN board information is below.
>>> #lspci -vv
>>> 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
>>> 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
>>> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
>>> 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
>>> 	Latency: 0, Cache Line Size: 64 bytes
>>> 	Interrupt: pin A routed to IRQ 10
>>> 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
>>> 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
>>> 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
>>> 	Capabilities: <access denied>
>>
>> Could you please use "lspci -vvn" to get  numbers (instead of strings).
>>
>> Wolfgang.
> 
> Thanks! The information is below.
> #lspci -vvn
> 03:00.0 0c09: 13fe:c302
> 	Subsystem: 13fe:c302
> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> 	Latency: 0, Cache Line Size: 64 bytes
> 	Interrupt: pin A routed to IRQ 10
> 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> 	Capabilities: [40] Power Management version 3
> 		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
> 		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
> 	Capabilities: [48] MSI: Enable- Count=1/2 Maskable- 64bit+
> 		Address: 0000000000000000  Data: 0000
> 	Capabilities: [58] Express (v1) Legacy Endpoint, MSI 00
> 		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
> 			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
> 		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
> 			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
> 			MaxPayload 128 bytes, MaxReadReq 512 bytes
> 		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
> 		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited, L1 unlimited
> 			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
> 		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
> 			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
> 		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
> 
> 
> Is ¡°0c09: 13fe:c302¡± the device ID? Can you show me some instructions to make this device work? I am really new to this.

The PCI vendor id is 0x13fe and the device id is 0xc302.

> I opened the link you paste above, perhaps the following two places should be modified.
> 
> A new line "ADV_PCI_DEVICE(0xc302), " should be added?
> ---------------------------------------------------------------
> 	static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
> 		ADV_PCI_DEVICE(0x1680),
> 		ADV_PCI_DEVICE(0x3680),
> 		ADV_PCI_DEVICE(0x2052),
> 		ADV_PCI_DEVICE(0x1681),
> 		ADV_PCI_DEVICE(0xc001),
> 		ADV_PCI_DEVICE(0xc002),
> 		ADV_PCI_DEVICE(0xc004),
> 		ADV_PCI_DEVICE(0xc101),
> 		ADV_PCI_DEVICE(0xc102),
> 		ADV_PCI_DEVICE(0xc104),
> 		/* required last entry */
> 		{ }
> 	};
> 
> How to deal with this one?
> ---------------------------------------------------------------
> 	switch (pdev->device) {
> 	case 0xc001:
> 	case 0xc002:
> 	case 0xc004:
> 	case 0xc101:
> 	case 0xc102:
> 	case 0xc104:
> 		nb_ports = pdev->device & 0x7;
> 		offset = 0x100;
> 		bar = 0;
> 		break;
> 	case 0x1680:
> 	case 0x2052:
> 		nb_ports = 2;
> 		bar = 2;
> 		bar_flag = 1;
> 		break;
> 	case 0x1681:
> 		nb_ports = 1;
> 		bar = 2;
> 		bar_flag = 1;
> 		break;
> 	default:
> 		goto failure_regions;
> 	}

Could you please give the untested patch below a try.

Good luck,

Wolfgang.

>From 00c9631f26675b90ea1ff2b4bb9f72fd81fcb91c Mon Sep 17 00:00:00 2001
From: Wolfgang Grandegger <Wolfgang Grandegger>
Date: Fri, 2 Sep 2016 10:46:26 +0200
Subject: [PATCH] rtcan: add support for new Advantec CAN PCI devices

---
 ksrc/drivers/can/sja1000/rtcan_adv_pci.c | 46 +++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
index 1d36e7b..c3de052 100644
--- a/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
+++ b/ksrc/drivers/can/sja1000/rtcan_adv_pci.c
@@ -95,6 +95,12 @@ static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
 	ADV_PCI_DEVICE(0xc101),
 	ADV_PCI_DEVICE(0xc102),
 	ADV_PCI_DEVICE(0xc104),
+	ADV_PCI_DEVICE(0xc201),
+	ADV_PCI_DEVICE(0xc202),
+	ADV_PCI_DEVICE(0xc204),
+	ADV_PCI_DEVICE(0xc301),
+	ADV_PCI_DEVICE(0xc302),
+	ADV_PCI_DEVICE(0xc304),
 	/* required last entry */
 	{ }
 };
@@ -115,6 +121,21 @@ static void rtcan_adv_pci_write_reg(struct rtcan_device *dev, int port, u8 data)
 	iowrite8(data, board->base_addr + port);
 }
 
+static u8 rtcan_adv_pci_read_reg_shift2(struct rtcan_device *dev, int port)
+{
+	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
+
+	return ioread8(board->base_addr + (port << 2));
+}
+
+static void rtcan_adv_pci_write_reg_shift2(struct rtcan_device *dev, int port,
+					   u8 data)
+{
+	struct rtcan_adv_pci *board = (struct rtcan_adv_pci *)dev->board_priv;
+
+	iowrite8(data, board->base_addr + (port << 2));
+}
+
 static void rtcan_adv_pci_del_chan(struct pci_dev *pdev,
 				   struct rtcan_device *dev)
 {
@@ -137,6 +158,7 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
 				  int channel,
 				  unsigned int bar,
 				  unsigned int offset,
+				  unsigned int shift,
 				  struct rtcan_device **master_dev)
 {
 	struct rtcan_device *dev;
@@ -180,8 +202,13 @@ static int rtcan_adv_pci_add_chan(struct pci_dev *pdev,
 
 	dev->board_name = adv_pci_board_name;
 
-	chip->read_reg = rtcan_adv_pci_read_reg;
-	chip->write_reg = rtcan_adv_pci_write_reg;
+	if (shift == 2) {
+		chip->read_reg = rtcan_adv_pci_read_reg_shift2;
+		chip->write_reg = rtcan_adv_pci_write_reg_shift2;
+	} else {
+		chip->read_reg = rtcan_adv_pci_read_reg;
+		chip->write_reg = rtcan_adv_pci_write_reg;
+	}
 
 	/* Clock frequency in Hz */
 	dev->can_sys_clock = ADV_PCI_CAN_CLOCK;
@@ -244,6 +271,7 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 	unsigned int bar = 0;
 	unsigned int bar_flag = 0;
 	unsigned int offset = 0;
+	unsigned int shift = 0;
 	unsigned int ix;
 
 	struct rtcan_device *master_dev = NULL;
@@ -270,7 +298,16 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 	case 0xc104:
 		nb_ports = pdev->device & 0x7;
 		offset = 0x100;
-		bar = 0;
+		break;
+	case 0xc201:
+	case 0xc202:
+	case 0xc204:
+	case 0xc301:
+	case 0xc302:
+	case 0xc304:
+		nb_ports = pdev->device & 0x7;
+		offset = 0x400;
+		shift = 2;
 		break;
 	case 0x1680:
 	case 0x2052:
@@ -298,7 +335,8 @@ static int adv_pci_init_one(struct pci_dev *pdev,
 		   pdev->device,
 		   pdev->subsystem_device);
 
-	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, &master_dev);
+	ret = rtcan_adv_pci_add_chan(pdev, channel, bar, offset, shift,
+				     &master_dev);
 	if (ret)
 		goto failure_iounmap;
 
-- 
1.9.1



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

* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-02  8:19 =?gb18030?B?SmFjayBMZWU=?=
  2016-09-02  8:52 ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-02  8:19 UTC (permalink / raw)
  To: =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 5246 bytes --]

> Hello,
> 
> Am 02.09.2016 um 09:23 schrieb Jack Lee:
> >> Hello,
> >>
> >> Am 02.09.2016 um 08:23 schrieb Jack Lee:
> >>> Hi, everyone£¡
> >>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> >>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> >>> The original driver works fine, but I need it to be realtime.
> >>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> >>> "#dmesg | grep -i can" output was
> >>> ...
> >>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> >>> RTCAN SJA1000 driver initialized
> >>>
> >>> "#lsmod | grep -i can" output was
> >>> xeno_can_adv_pci
> >>> xeno_can_sja1000    used by xeno_can_adv_pci
> >>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
> >>>
> >>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
> >>> The /proc/rtcan directory just has three files: devices, sockets and versio
> >>
> >> What is the PCI device id of the CAN device? You can use "lspci -vv" to
> >> list the ids.
> >>
> >>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
> >>
> >> Most likely the device id is missing in the driver PCI device list:
> >>
> >>
> >> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
> >>
> >> Wolfgang.
> >
> > Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
> 
> No problem.
> 
> > CAN board information is below.
> > #lspci -vv
> > 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> > 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> > 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> > 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> > 	Latency: 0, Cache Line Size: 64 bytes
> > 	Interrupt: pin A routed to IRQ 10
> > 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> > 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> > 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> > 	Capabilities: <access denied>
> 
> Could you please use "lspci -vvn" to get  numbers (instead of strings).
> 
> Wolfgang.

Thanks! The information is below.
#lspci -vvn
03:00.0 0c09: 13fe:c302
	Subsystem: 13fe:c302
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 10
	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [48] MSI: Enable- Count=1/2 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [58] Express (v1) Legacy Endpoint, MSI 00
		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited, L1 unlimited
			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-


Is ¡°0c09: 13fe:c302¡± the device ID? Can you show me some instructions to make this device work? I am really new to this.
I opened the link you paste above, perhaps the following two places should be modified.

A new line "ADV_PCI_DEVICE(0xc302), " should be added?
---------------------------------------------------------------
	static DEFINE_PCI_DEVICE_TABLE(adv_pci_tbl) = {
		ADV_PCI_DEVICE(0x1680),
		ADV_PCI_DEVICE(0x3680),
		ADV_PCI_DEVICE(0x2052),
		ADV_PCI_DEVICE(0x1681),
		ADV_PCI_DEVICE(0xc001),
		ADV_PCI_DEVICE(0xc002),
		ADV_PCI_DEVICE(0xc004),
		ADV_PCI_DEVICE(0xc101),
		ADV_PCI_DEVICE(0xc102),
		ADV_PCI_DEVICE(0xc104),
		/* required last entry */
		{ }
	};

How to deal with this one?
---------------------------------------------------------------
	switch (pdev->device) {
	case 0xc001:
	case 0xc002:
	case 0xc004:
	case 0xc101:
	case 0xc102:
	case 0xc104:
		nb_ports = pdev->device & 0x7;
		offset = 0x100;
		bar = 0;
		break;
	case 0x1680:
	case 0x2052:
		nb_ports = 2;
		bar = 2;
		bar_flag = 1;
		break;
	case 0x1681:
		nb_ports = 1;
		bar = 2;
		bar_flag = 1;
		break;
	default:
		goto failure_regions;
	}

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

* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-02  7:43 =?gb18030?B?SmFjayBMZWU=?=
  0 siblings, 0 replies; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-02  7:43 UTC (permalink / raw)
  To: =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 4111 bytes --]

> Hello,
> 
> Am 02.09.2016 um 09:23 schrieb Jack Lee:
> >> Hello,
> >>
> >> Am 02.09.2016 um 08:23 schrieb Jack Lee:
> >>> Hi, everyone£¡
> >>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> >>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> >>> The original driver works fine, but I need it to be realtime.
> >>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> >>> "#dmesg | grep -i can" output was
> >>> ...
> >>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> >>> RTCAN SJA1000 driver initialized
> >>>
> >>> "#lsmod | grep -i can" output was
> >>> xeno_can_adv_pci
> >>> xeno_can_sja1000    used by xeno_can_adv_pci
> >>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
> >>>
> >>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
> >>> The /proc/rtcan directory just has three files: devices, sockets and versio
> >>
> >> What is the PCI device id of the CAN device? You can use "lspci -vv" to
> >> list the ids.
> >>
> >>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
> >>
> >> Most likely the device id is missing in the driver PCI device list:
> >>
> >>
> >> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
> >>
> >> Wolfgang.
> >
> > Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
> 
> No problem.
> 
> > CAN board information is below.
> > #lspci -vv
> > 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> > 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> > 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> > 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> > 	Latency: 0, Cache Line Size: 64 bytes
> > 	Interrupt: pin A routed to IRQ 10
> > 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> > 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> > 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> > 	Capabilities: <access denied>
> 
> Could you please use "lspci -vvn" to get  numbers (instead of strings).
> 
> Wolfgang.

Thanks! The information is below.
#lspci -vvn
03:00.0 0c09: 13fe:c302
	Subsystem: 13fe:c302
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 10
	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [48] MSI: Enable- Count=1/2 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [58] Express (v1) Legacy Endpoint, MSI 00
		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s, Exit Latency L0s unlimited, L1 unlimited
			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-

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

* Re: [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
  2016-09-02  7:23 =?gb18030?B?SmFjayBMZWU=?=
@ 2016-09-02  7:33 ` Wolfgang Grandegger
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Grandegger @ 2016-09-02  7:33 UTC (permalink / raw)
  To: xenomai

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030"; format="flowed", Size: 2393 bytes --]

Hello,

Am 02.09.2016 um 09:23 schrieb Jack Lee:
>> Hello,
>>
>> Am 02.09.2016 um 08:23 schrieb Jack Lee:
>>> Hi, everyone£¡
>>>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
>>> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
>>> The original driver works fine, but I need it to be realtime.
>>>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
>>> "#dmesg | grep -i can" output was
>>> ...
>>> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
>>> RTCAN SJA1000 driver initialized
>>>
>>> "#lsmod | grep -i can" output was
>>> xeno_can_adv_pci
>>> xeno_can_sja1000    used by xeno_can_adv_pci
>>> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
>>>
>>> What strange is that /proc/rtcan/devices has no devices like rtcan0.
>>> The /proc/rtcan directory just has three files: devices, sockets and versio
>>
>> What is the PCI device id of the CAN device? You can use "lspci -vv" to
>> list the ids.
>>
>>> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
>>
>> Most likely the device id is missing in the driver PCI device list:
>>
>>
>> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
>>
>> Wolfgang.
>
> Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.

No problem.

> CAN board information is below.
> #lspci -vv
> 03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> 	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> 	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> 	Latency: 0, Cache Line Size: 64 bytes
> 	Interrupt: pin A routed to IRQ 10
> 	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
> 	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
> 	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
> 	Capabilities: <access denied>

Could you please use "lspci -vvn" to get  numbers (instead of strings).

Wolfgang.


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

* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-02  7:23 =?gb18030?B?SmFjayBMZWU=?=
  2016-09-02  7:33 ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-02  7:23 UTC (permalink / raw)
  To: =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 2212 bytes --]

> Hello,
> 
> Am 02.09.2016 um 08:23 schrieb Jack Lee:
> > Hi, everyone£¡
> >   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> > http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> > The original driver works fine, but I need it to be realtime.
> >   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> > "#dmesg | grep -i can" output was
> > ...
> > RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> > RTCAN SJA1000 driver initialized
> >
> > "#lsmod | grep -i can" output was
> > xeno_can_adv_pci
> > xeno_can_sja1000    used by xeno_can_adv_pci
> > xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
> >
> > What strange is that /proc/rtcan/devices has no devices like rtcan0.
> > The /proc/rtcan directory just has three files: devices, sockets and versio
> 
> What is the PCI device id of the CAN device? You can use "lspci -vv" to 
> list the ids.
> 
> > Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?
> 
> Most likely the device id is missing in the driver PCI device list:
> 
>  
> http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87
> 
> Wolfgang.

Thank you, Wolfgang! My mailbox delays that I cannot add you in the contact, so I send to the xenomai list. Sorry for that.
CAN board information is below.
#lspci -vv
03:00.0 CANBUS: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
	Subsystem: Advantech Co. Ltd MIOe-3680 2-Port CAN-Bus MIOe Module with Isolation Protection
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 10
	Region 0: Memory at d0c02000 (32-bit, non-prefetchable) [size=2K]
	Region 1: Memory at d0c01000 (32-bit, non-prefetchable) [size=128]
	Region 2: Memory at d0c00000 (32-bit, non-prefetchable) [size=128]
	Capabilities: <access denied>

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

* Re: [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
  2016-09-02  6:23 =?gb18030?B?SmFjayBMZWU=?=
@ 2016-09-02  6:42 ` Wolfgang Grandegger
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Grandegger @ 2016-09-02  6:42 UTC (permalink / raw)
  To: xenomai

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030"; format="flowed", Size: 1279 bytes --]

Hello,

Am 02.09.2016 um 08:23 schrieb Jack Lee:
> Hi, everyone£¡
>   I am using the advantech PCM-26D2CA CAN board, its details can be found here at
> http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
> The original driver works fine, but I need it to be realtime.
>   rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed,
> "#dmesg | grep -i can" output was
> ...
> RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
> RTCAN SJA1000 driver initialized
>
> "#lsmod | grep -i can" output was
> xeno_can_adv_pci
> xeno_can_sja1000    used by xeno_can_adv_pci
> xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci
>
> What strange is that /proc/rtcan/devices has no devices like rtcan0.
> The /proc/rtcan directory just has three files: devices, sockets and versio

What is the PCI device id of the CAN device? You can use "lspci -vv" to 
list the ids.

> Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?

Most likely the device id is missing in the driver PCI device list:

 
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/drivers/can/sja1000/rtcan_adv_pci.c#n87

Wolfgang.


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

* [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board
@ 2016-09-02  6:23 =?gb18030?B?SmFjayBMZWU=?=
  2016-09-02  6:42 ` Wolfgang Grandegger
  0 siblings, 1 reply; 10+ messages in thread
From: =?gb18030?B?SmFjayBMZWU=?= @ 2016-09-02  6:23 UTC (permalink / raw)
  To: =?gb18030?B?eGVub21haQ==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 951 bytes --]

Hi, everyone£¡
  I am using the advantech PCM-26D2CA CAN board, its details can be found here at 
http://www.advantech.com/products/14263729-aaa3-4552-b990-99d16cdfee24/pcm-26d2ca/mod_9a1e9dbf-e22d-4770-a896-cecf40607084.
The original driver works fine, but I need it to be realtime.
  rt-can driver was compiled as modules previously. When booted and "#modprobe xeno_can_adv_pci" was executed, 
"#dmesg | grep -i can" output was 
...
RT-Socket-CAN 0.90-2 - (c) 2006 RT-Socket-CAN Development Team
RTCAN SJA1000 driver initialized

"#lsmod | grep -i can" output was
xeno_can_adv_pci
xeno_can_sja1000    used by xeno_can_adv_pci
xeno_can                  used by xeno_can_sja1000, xeno_can_adv_pci

What strange is that /proc/rtcan/devices has no devices like rtcan0.
The /proc/rtcan directory just has three files: devices, sockets and version.

Does this CAN board supported by rt-socket-can? How can I implement real-timer driver for it?

Thank you!

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

end of thread, other threads:[~2016-09-03  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  9:11 [Xenomai] rt-socket-can "no device" problem with advantech PCM-26D2CA CAN board =?gb18030?B?SmFjayBMZWU=?=
  -- strict thread matches above, loose matches on Subject: below --
2016-09-03  0:54 =?gb18030?B?SmFjayBMZWU=?=
2016-09-03  9:46 ` Wolfgang Grandegger
2016-09-02  8:19 =?gb18030?B?SmFjayBMZWU=?=
2016-09-02  8:52 ` Wolfgang Grandegger
2016-09-02  7:43 =?gb18030?B?SmFjayBMZWU=?=
2016-09-02  7:23 =?gb18030?B?SmFjayBMZWU=?=
2016-09-02  7:33 ` Wolfgang Grandegger
2016-09-02  6:23 =?gb18030?B?SmFjayBMZWU=?=
2016-09-02  6:42 ` Wolfgang Grandegger

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.