Board Info File Location

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Board Info File Location

1,068 Views
danab
Contributor I

Hello,

I am working on adding a spi-uart bridge.  The part vendor has provided a driver and device tree bindings info.  The README also includes a structure to add to the board file.

The target hardware is the mx8 nano DDR4 EVK being built under Yocto.

I don't know where the board initialization file is.  Is this achieved differently for arm64 devices?


If SPI mode is used:
Define the spi0_board_info object on your board file similar to the following:

i.e.:
static struct spi_board_info spi0_board_info[] __initdata = {
{
...

 

Thanks!

Dana

Labels (1)
0 Kudos
Reply
2 Replies

1,041 Views
danab
Contributor I

Thank you, Bio_TICFSL .  I was discussing this also with a colleague this morning and were also coming to the conclusion that we probably don't need the board info if the device tree is supplying the necessary info.  I will go through the setup you have outlined above, probably a few times, and apply it to my setup.

Cheers,

Dana

0 Kudos
Reply

1,049 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

This steps are similar for MX8MN, This is what you need to do:

  1. Add SPI port(s) to the file fsl-imx8qm.dts
    • The file can be found in the folder /tmp/work-shared/imx8qmmek/kernel-source/arch/arm64/boot/dts/freescale
    • In the current beta-release there is already an entry for the lpspi0
    • The address of the LPSPI port can be found in the Reference Manual --> System Memory Map --> Audio DMA Memory Maps
    • There is also an LPSPI peripheral in the i.MX7ULP, so for now you can keep this entry in "compatible". Maybe later on, when the i.MX8 became more popular in the Linux world, there might be other strings.
    • The defines for the clocks can be found in the file imx8qm-clock.h

      lpspi0: lpspi@5a000000 {
              compatible = "fsl,imx7ulp-spi";
              reg = <0x0 0x5a000000 0x0 0x10000>;
              interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
              interrupt-parent = <&gic>;
              clocks = <&clk IMX8QM_SPI0_CLK>,
                   <&clk IMX8QM_SPI0_IPG_CLK>;
              clock-names = "per", "ipg";
              assigned-clocks = <&clk IMX8QM_SPI0_CLK>;
              assigned-clock-rates = <20000000>;
              power-domains = <&pd_dma_lpspi0>;
              status = "disabled";
          };

      lpspi1: lpspi@5a010000 {
              compatible = "fsl,imx7ulp-spi";
              reg = <0x0 0x5a010000 0x0 0x10000>;
              interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>;
              interrupt-parent = <&gic>;
              clocks = <&clk IMX8QM_SPI1_CLK>,
                   <&clk IMX8QM_SPI1_IPG_CLK>;
              clock-names = "per", "ipg";
              assigned-clocks = <&clk IMX8QM_SPI1_CLK>;
              assigned-clock-rates = <20000000>;
              power-domains = <&pd_dma_lpspi1>;
              status = "disabled";
          };

  2. You need to define the pins for the SPI ports you want to use.
    1. There is an example for the lpspi0 in the file fsl-imx8qm-lpddr4-arm2-lpspi.dts in the folder /tmp/work-shared/imx8qmmek/kernel-source/arch/arm64/boot/dts/freescale

      &iomuxc {
          imx8qm-arm2 {
              pinctrl_lpspi0: lpspi0grp {
                  fsl,pins = <
                      SC_P_SPI0_SCK_DMA_SPI0_SCK        0x0600004c
                      SC_P_SPI0_SDO_DMA_SPI0_SDO        0x0600004c
                      SC_P_SPI0_SDI_DMA_SPI0_SDI        0x0600004c
                  >;
              };

              pinctrl_lpspi0_cs: lpspi0cs {
                  fsl,pins = <
                      SC_P_SPI0_CS0_LSIO_GPIO3_IO05        0x21
                  >;
              };
          };
      };

      &lpspi0 {
          #address-cells = <1>;
          #size-cells = <0>;
          fsl,spi-num-chipselects = <1>;
          pinctrl-names = "default";
          pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_lpspi0_cs>;
          cs-gpios = <&gpio3 5 GPIO_ACTIVE_LOW>;
          status = "okay";
          flash: at45db041e@0 {
              #address-cells = <1>;
              #size-cells = <1>;
              compatible = "atmel,at45", "atmel,dataflash";
              spi-max-frequency = <500000>;
              reg = <0>;
              };
      };
  3. Configure the Kernel config for SPI support
    • Please check if the Kernel config file contains the following defines:
      CONFIG_SPI=y
      CONFIG_SPI_IMX=y
      CONFIG_SPI_FSL_LPSPI=y
    • If you want this as a default Kernel config setting, please edit the file defconfig in the folder /tmp/work-shared/imx8qmmek/kernel-source/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
  4. Test the SPI port
    • After creating an image you can test the SPI port on device level and on hardware level
    • To load the SPI driver on command line:  $ modprobe spidev
    • The standard SPI driver in the Linux Kernel (spi-imx.c) would allow you to use the port and finally you should see something on the port when you try to send data.

 

 

I need to admit that at the time of writing I didn't test it on the 8MN board, so if you can't make it working please come back to me and I will give it a try on my side.

 

Regards,

0 Kudos
Reply