mx6_sabresd_board_init()

static void __init mx6_sabresd_board_init(void)  
{  
        int i;  
        int ret;  
        struct clk *clko, *clko2;  
        struct clk *new_parent;  
        int rate;  
      
        //判断cpu类型和pad初始化;  
        if (cpu_is_mx6q())  
            mxc_iomux_v3_setup_multiple_pads(mx6q_sabresd_pads,  
                ARRAY_SIZE(mx6q_sabresd_pads));  
        else if (cpu_is_mx6dl()) {  
            //配置管脚:i2c/i2s/......  
            mxc_iomux_v3_setup_multiple_pads(mx6dl_sabresd_pads,  
                ARRAY_SIZE(mx6dl_sabresd_pads));  
        }  
      
    #ifdef CONFIG_FEC_1588  
        /* Set GPIO_16 input for IEEE-1588 ts_clk and RMII reference clock 
         * For MX6 GPR1 bit21 meaning: 
         * Bit21:       0 - GPIO_16 pad output 
         *              1 - GPIO_16 pad input 
         */  
         mxc_iomux_set_gpr_register(1, 21, 1, 1);  
    #endif  
      
        //(1)申请GPIO=>(2)设置GPIO=>(3)释放GPIO=>为了别人可以使用;类似互斥量;  
        gpio_request(SABRESD_PHY_RST, "phy_reset"); //申请一个引脚;"phy_reset"是描述;  
        gpio_direction_output(SABRESD_PHY_RST, 1);      //设置端口为输出;并设为高电平;  
        gpio_free(SABRESD_PHY_RST);                     //释放GPIO;  
          
        gp_reg_id = sabresd_dvfscore_data.reg_id;  
        soc_reg_id = sabresd_dvfscore_data.soc_id;  
        pu_reg_id = sabresd_dvfscore_data.pu_id;  
        mx6q_sabresd_init_uart();                       //串口初始化;  
      
        /* 
         * MX6DL/Solo only supports single IPU 
         * The following codes are used to change ipu id 
         * and display id information for MX6DL/Solo. Then 
         * register 1 IPU device and up to 2 displays for 
         * MX6DL/Solo 
         */  
        if (cpu_is_mx6dl()) {  
            ldb_data.ipu_id = 0;  
            ldb_data.disp_id = 0;  
        //  hdmi_core_data.ipu_id = 0;  
        //  hdmi_core_data.disp_id = 0;  
        //  mipi_dsi_pdata.ipu_id = 0;  
        //  mipi_dsi_pdata.disp_id = 1;  
        }  
        imx6q_add_mxc_hdmi_core(&hdmi_core_data);  
      
        imx6q_add_ipuv3(0, &ipu_data[0]);  
        if (cpu_is_mx6q()) {  
            imx6q_add_ipuv3(1, &ipu_data[1]);  
            for (i = 0; i < 4 && i < ARRAY_SIZE(sabresd_fb_data); i++)  
                imx6q_add_ipuv3fb(i, &sabresd_fb_data[i]);  
        } else  
            for (i = 0; i < 2 && i < ARRAY_SIZE(sabresd_fb_data); i++)  
                imx6q_add_ipuv3fb(i, &sabresd_fb_data[i]);  
      
        imx6q_add_vdoa();  
        //imx6q_add_mipi_dsi(&mipi_dsi_pdata);  
        //imx6q_add_lcdif(&lcdif_data);  
        imx6q_add_ldb(&ldb_data);       //LVDS作为主显示;  
        imx6q_add_v4l2_output(0);  
        imx6q_add_v4l2_capture(0, &capture_data[0]);    //Camera接口  
        imx6q_add_v4l2_capture(1, &capture_data[1]);    //Camera接口  
        imx6q_add_mipi_csi2(&mipi_csi2_pdata);  
        imx6q_add_imx_snvs_rtc();  
          
        //imx6q_add_flexcan(0, &mx6q_sabresd_flexcan0_pdata);  
          
        imx6q_add_imx_caam();  
      
        if (board_is_mx6_reva()) {  
            strcpy(mxc_i2c0_board_info[0].type, "wm8958");  
            mxc_i2c0_board_info[0].platform_data = &wm8958_config_data;  
        } else {  
            //strcpy(mxc_i2c0_board_info[0].type, "wm8962");  
            //mxc_i2c0_board_info[0].platform_data = &wm8962_config_data;  
        }  
        //imx6q_add_device_gpio_leds();  
      
        imx6q_add_imx_i2c(0, &mx6q_sabresd_i2c_data);   //添加i2c platform devices;  
        imx6q_add_imx_i2c(1, &mx6q_sabresd_i2c_data);   //添加i2c platform devices;  
        imx6q_add_imx_i2c(2, &mx6q_sabresd_i2c_data);   //添加i2c platform devices;  
        i2c_register_board_info(0, mxc_i2c0_board_info,  
                ARRAY_SIZE(mxc_i2c0_board_info));  
        i2c_register_board_info(1, mxc_i2c1_board_info,  
                ARRAY_SIZE(mxc_i2c1_board_info));  
        i2c_register_board_info(2, mxc_i2c2_board_info,  
                ARRAY_SIZE(mxc_i2c2_board_info));  
        /* SPI */  
        //imx6q_add_ecspi(0, &mx6q_sabresd_spi_data);  
        //spi_device_init();  
      
        imx6q_add_mxc_hdmi(&hdmi_data);  
      
        imx6q_add_anatop_thermal_imx(1, &mx6q_sabresd_anatop_thermal_data);  
        imx6_init_fec(fec_data);  
        imx6q_add_pm_imx(0, &mx6q_sabresd_pm_data);  
      
        /* Move sd4 to first because sd4 connect to emmc. 
           Mfgtools want emmc is mmcblk0 and other sd card is mmcblk1. 
        */  
        imx6q_add_sdhci_usdhc_imx(3, &mx6q_sabresd_sd4_data);  
        imx6q_add_sdhci_usdhc_imx(2, &mx6q_sabresd_sd3_data);  
        imx6q_add_sdhci_usdhc_imx(1, &mx6q_sabresd_sd2_data);  
        imx_add_viv_gpu(&imx6_gpu_data, &imx6q_gpu_pdata);  
        imx6q_sabresd_init_usb();  
      
        imx6q_add_vpu();  
        imx6q_init_audio();  
        platform_device_register(&sabresd_vmmc_reg_devices);  
        imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk");  
        imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk");  
        imx6q_add_asrc(&imx_asrc_data);  
      
        imx6q_add_mxc_pwm(0);       //增加pwm0  
        //imx6q_add_mxc_pwm(1);  
        //imx6q_add_mxc_pwm(2);  
        //imx6q_add_mxc_pwm(3);  
        //pwm0控制lvds背光;  
        imx6q_add_mxc_pwm_backlight(0, &mx6_sabresd_pwm_backlight_data);  
      
        imx6q_add_otp();  
        imx6q_add_viim();  
        imx6q_add_imx2_wdt(0, NULL);  
        imx6q_add_dma();  
      
        imx6q_add_dvfs_core(&sabresd_dvfscore_data);  
    #ifndef CONFIG_MX6_INTER_LDO_BYPASS  
        mx6_cpu_regulator_init();  
    #endif  
      
        imx6q_add_ion(0, &imx_ion_data,  
            sizeof(imx_ion_data) + sizeof(struct ion_platform_heap));  
        imx6q_add_device_buttons();  
      
        imx6q_add_hdmi_soc();  
        imx6q_add_hdmi_soc_dai();  
      
        if (cpu_is_mx6dl()) {  
            imx6dl_add_imx_pxp();  
            imx6dl_add_imx_pxp_client();  
            if (epdc_enabled) {  
                mxc_register_device(&max17135_sensor_device, NULL);  
                imx6dl_add_imx_epdc(&epdc_data);  
            }  
        }  
        /* 
        ret = gpio_request_array(mx6q_sabresd_flexcan_gpios, 
                ARRAY_SIZE(mx6q_sabresd_flexcan_gpios)); 
        if (ret) 
            pr_err("failed to request flexcan1-gpios: %d\n", ret); 
        else 
            imx6q_add_flexcan0(&mx6q_sabresd_flexcan0_pdata); 
        */  
      
        clko2 = clk_get(NULL, "clko2_clk");  
        if (IS_ERR(clko2))  
            pr_err("can't get CLKO2 clock.\n");  
      
        new_parent = clk_get(NULL, "osc_clk");  
        if (!IS_ERR(new_parent)) {  
            clk_set_parent(clko2, new_parent);  
            clk_put(new_parent);  
        }  
        rate = clk_round_rate(clko2, 24000000);  
        clk_set_rate(clko2, rate);  
        clk_enable(clko2);  
      
        /* Camera and audio use osc clock */  
        clko = clk_get(NULL, "clko_clk");  
        if (!IS_ERR(clko))  
            clk_set_parent(clko, clko2);  
      
        /* Enable Aux_5V */  
        gpio_request(SABRESD_AUX_5V_EN, "aux_5v_en");  
        gpio_direction_output(SABRESD_AUX_5V_EN, 1);  
        gpio_set_value(SABRESD_AUX_5V_EN, 1);  
      
    #ifndef CONFIG_IMX_PCIE  
        /* enable pcie 3v3 power without pcie driver */  
        pcie_3v3_power();  
        mdelay(10);  
        pcie_3v3_reset();  
    #endif  
      
        //gps_power_on(true);  
        /* Register charger chips */  
        platform_device_register(&sabresd_max8903_charger_1);  
        pm_power_off = mx6_snvs_poweroff;  
        imx6q_add_busfreq();  
      
        /* Add PCIe RC interface support */  
        imx6q_add_pcie(&mx6_sabresd_pcie_data);  
      
        imx6_add_armpmu();  
        imx6q_add_perfmon(0);  
        imx6q_add_perfmon(1);  
        imx6q_add_perfmon(2);  
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值