SJA1000 with EBI

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

Cyberian
Posts: 22
Joined: Wed Sep 06, 2006 3:06 pm

SJA1000 with EBI

Thu Jul 04, 2019 3:21 pm

Hi,

I have troubles with connecting an SJA1000 CAN Controller to a SAMA5D27-D1G. Yes, I know the SAMA5 has an integrated CAN Controller but the controller is used as an replacement where the SJA1000 was connected as ISA device.
I'm pretty sure I have to configure EBI in some way to get this working. So far I can use devmem from console to read some of the registers of the SJA1000 but I have issues to configure the linux driver for it correctly.

Here is what I can do at the moment and the results on the console:

Code: Select all

modprobe sja1000-isa mem=0x10000300 irq=5

sja1000_isa sja1000_isa.0: sja1000_isa device registered (reg_base=0xc8a19300, irq=5)
Legacy sja1000_isa driver for max. 8 devices registered

Code: Select all

ip link set can0 type can bitrate 125000

sja1000_isa sja1000_isa.0 can0: setting BTR0=0x03 BTR1=0x1c

Code: Select all

ip link set up can0

RTNETLINK answers: Resource temporarily unavailable

I also tried to define an entry in DTS for the SJA1000 which automatically loads sja1000-platform module but no canX device available

Code: Select all

/ {
	ahb {
		apb {
			pinctrl@fc038000 {
				pinctrl_isabus: isabus {
					address_lines {
						pinmux = <PIN_PC11__A0_NBS0>,
							<PIN_PC12__A1>,
							<PIN_PC13__A2>,
							<PIN_PC14__A3>,
							<PIN_PC15__A4>,
							<PIN_PC16__A5>,
							<PIN_PC17__A6>,
							<PIN_PC18__A7>,
							<PIN_PC19__A8>,
							<PIN_PC20__A9>,
							<PIN_PC21__A10>,
							<PIN_PC22__A11>,
							<PIN_PC23__A12>,
							<PIN_PC24__A13>,
							<PIN_PC25__A14>,
							<PIN_PC26__A15>,
							<PIN_PC27__A16>,
							<PIN_PC28__A17>,
							<PIN_PC29__A18>,
							<PIN_PC30__A19>,
							<PIN_PC31__A20>,
							<PIN_PA10__A21_NANDALE>,
							<PIN_PA11__A22_NANDCLE>;
						drive-open-drain;
						bias-pull-up;
					};
					data_lines {
						pinmux = <PIN_PA0__D0>,
							<PIN_PA1__D1>,
							<PIN_PA2__D2>,
							<PIN_PA3__D3>,
							<PIN_PA4__D4>,
							<PIN_PA5__D5>,
							<PIN_PA6__D6>,
							<PIN_PA7__D7>,
							<PIN_PB3__D8>,
							<PIN_PB4__D9>,
							<PIN_PB5__D10>,
							<PIN_PB6__D11>,
							<PIN_PB7__D12>,
							<PIN_PB8__D13>,
							<PIN_PB9__D14>,
							<PIN_PB10__D15>;
						drive-open-drain;
						bias-pull-up;
					};
					special_lines {
						pinmux = <PIN_PA8__NWE_NANDWE>,
							<PIN_PA9__NCS3>,
							<PIN_PA12__NRD_NANDOE>,
							<PIN_PC3__NWAIT>,
							<PIN_PC4__NWR1_NBS1>,
							<PIN_PC5__NCS0>,
							<PIN_PC6__NCS1>,
							<PIN_PC7__NCS2>;
						drive-open-drain;
						bias-pull-up;
					};
					irq-lines {
						pinmux = <PIN_PC9__GPIO>;
						bias-disable;
					};
				};
			};
		};
		ebi: ebi@10000000 {
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_isabus>;
			clocks = <&h32ck>;

			status = "okay";
			
			canisa: can@0,0x300 {
				compatible = "nxp,sja1000";
				reg = <0 0x00000300 0x00000100>;
				interrupt-parent = <&pioA>;
				interrupts = <PIN_PC9 IRQ_TYPE_EDGE_RISING>;
				nxp,external-clock-frequency = <16000000>;
				nxp,tx-output-config = <0x16>;
				nxp,no-comparator-bypass;
				
				atmel,smc-read-mode = "nrd";
				atmel,smc-write-mode = "nwe";
				atmel,smc-exnw-mode = "frozen"; /* disabled, frozen oder ready */
				atmel,smc-bus-width = <16>;
				atmel,smc-ncs-rd-setup-ns = <0>;
				atmel,smc-ncs-wr-setup-ns = <0>;
				atmel,smc-nwe-setup-ns = <0>;
				atmel,smc-nrd-setup-ns = <0>;
				atmel,smc-ncs-rd-pulse-ns = <564>;
				atmel,smc-ncs-wr-pulse-ns = <564>;
				atmel,smc-nrd-pulse-ns = <528>;
				atmel,smc-nwe-pulse-ns = <528>;
				atmel,smc-nrd-cycle-ns = <648>;
				atmel,smc-nwe-cycle-ns = <648>;
				atmel,smc-tdf-ns = <0>;
			};
		};
	};
};

I hope anyone can point me in the right direction so I can finally use the CAN controller again.

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 11 guests