设备树配置i.MX6

时间:2016-03-03 10:55:51

标签: arm embedded linux-device-driver u-boot

Hy all,

我基于飞思卡尔的i.MX6开发了自己的主板,我想配置设备树。 我正在使用此软件:Processor Expert for i.MX来生成所有引脚的配置。 该软件正在生成.c和.h文件:

GPIO.c
I2C.c
...
iomux_config.c
iomux_config.h
...

我的问题是:我在linux内核或我的u-boot文件中如何以及在哪里实现这些文件?或者我是否必须生成dts文件?

感谢您的帮助!

编辑:

以下是一些生成的文件:

iomux_config.c:

#include "iomux_config.h"

/*
** ===================================================================
**     Method      :  pin_init_iomux_config (component PinSettings)
*/
/*!
**     @brief
**         This method sets registers according routing settings. Call
**         this method in user code to route desired pins into
**         peripherals. The method is useful for reinitialization HW
**         after some routing changes.
*/
/* ===================================================================*/
void iomux_config(void)
{
        configure_audmux_pins(0u);
        configure_ecspi_pins(1u);
        configure_enet_pins(0u);
        configure_gpio_pins(0u);
        configure_gpio_pins(1u);
        configure_gpio_pins(3u);
        configure_gpio_pins(5u);
        configure_gpio_pins(6u);
        configure_i2c_pins(0u);
        configure_i2c_pins(1u);
        configure_i2c_pins(2u);
        configure_i2c_pins(3u);
        configure_ipu1_pins(0u);
        configure_pwm_pins(0u);
        configure_pwm_pins(1u);
        configure_pwm_pins(2u);
        configure_pwm_pins(3u);
        configure_src_pins(0u);
        configure_uart_pins(1u);
        configure_uart_pins(2u);
        configure_uart_pins(3u);
        configure_usb_pins(0u);
        configure_usdhc_pins(2u);
        configure_usdhc_pins(3u);
}
/* END pin_init. */

i2c.c:

#include "iomux_config.h"

void configure_i2c_pins(uint32_t instance)
{
  switch(instance) {    
    case HW_I2C1:                       /* I2C1 */
      HW_IOMUXC_I2C1_SCL_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA09_SET(IOMUXC_BASE, 0x04UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA09_CLR(IOMUXC_BASE, 0x03UL); 
      HW_IOMUXC_I2C1_SDA_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA08_SET(IOMUXC_BASE, 0x04UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA08_CLR(IOMUXC_BASE, 0x03UL); 
      break;
    case HW_I2C2:                       /* I2C2 */
      HW_IOMUXC_I2C2_SCL_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_EB2_B_SET(IOMUXC_BASE, 0x06UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_EB2_B_CLR(IOMUXC_BASE, 0x09UL); 
      HW_IOMUXC_I2C2_SDA_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA16_SET(IOMUXC_BASE, 0x06UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA16_CLR(IOMUXC_BASE, 0x09UL); 
      break;
    case HW_I2C3:                       /* I2C3 */
      HW_IOMUXC_I2C3_SCL_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA17_SET(IOMUXC_BASE, 0x06UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA17_CLR(IOMUXC_BASE, 0x09UL); 
      HW_IOMUXC_I2C3_SDA_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x00UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA18_SET(IOMUXC_BASE, 0x06UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA18_CLR(IOMUXC_BASE, 0x09UL); 
      break;
    case HW_I2C4:                       /* I2C4 */
      HW_IOMUXC_I2C4_SCL_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x01UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_GPIO07_SET(IOMUXC_BASE, 0x08UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_GPIO07_CLR(IOMUXC_BASE, 0x07UL); 
      HW_IOMUXC_I2C4_SDA_IN_SELECT_INPUT_WR(IOMUXC_BASE, 0x01UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_GPIO08_SET(IOMUXC_BASE, 0x08UL); 
      HW_IOMUXC_SW_MUX_CTL_PAD_GPIO08_CLR(IOMUXC_BASE, 0x07UL); 
      break;
    default:
      break;
  }
}

其他人完全相同。

0 个答案:

没有答案