SJA1110 configuration and SPI command

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SJA1110 configuration and SPI command

1,037 次查看
yangjinzhuang
Contributor IV

Hello,

       I have a hardware GLDBOX, it's switch chip is SJA1110A, the S32G274A communicate with SJA1110A through SPI, the SJA1110A's SPI works at SPI_HOST mode in default.

      How to change SJA1110A's SPI mode to SPI_AP mode?

     On S32G274A, if I enable DSA driver to config SJA1110A, how to config port mode? What is the command of SPI to config port mode?

     Thank you very much.

0 项奖励
回复
3 回复数

940 次查看
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

I apologize for the late response.

Here is linux driver for the switch SJA1110: https://docs.kernel.org/networking/dsa/sja1105.html

An API of reading/writing reg over SPI is provided in the Linux driver - you can refer to it as well:
https://github.com/nxp-archive/autoivnsw_sja1110_linux/blob/master/sja1110_init.c#L85

Best regards,

Pavel

0 项奖励
回复

935 次查看
yangjinzhuang
Contributor IV

Hello,

       I see the SJA1110 register's write and read API, both noticed that " * sja1110->devtype needs to be SJA1110_SWITCH" ,  I don't know where is the devtype setted?

      I only find that in the device-tree has uc and switch spi_node.

 

     I understand that SJA1110 should set to SPI_AP to support S32G274A to read/write sja1110a's register, is it right? By default, SJA1110 worked at SPI_HOST mode.

     Thank you!

0 项奖励
回复

860 次查看
PavelL
NXP Employee
NXP Employee

Hello @yangjinzhuang ,

I apologize for the late response.

SJA1110_SWITCH is defined in autoivnsw_sja1110_linux/sja1110_init.h at master · nxp-archive/autoivnsw_sja1110_linux · GitHub as a simple enum:

enum spi_devtype {SJA1110_SWITCH, SJA1110_UC};

Best regards,

Pavel

0 项奖励
回复