/*
 * Used to satisfy dependencies for devices that need to be
 * run early or in a particular order. Most likely your device doesn't fall
 * into this category, and thus the driver should not be added here. The
 * EPROBE_DEFER can satisfy most dependency problems.
 */
void __init msm8974_add_drivers(void)
{
    msm_smem_init();
    msm_init_modem_notifier_list();
    msm_smd_init();
    msm_rpm_driver_init();
    msm_pm_sleep_status_init();
    rpm_regulator_smd_driver_init();
    msm_spm_device_init();
    krait_power_init();
    if (of_board_is_rumi())
        msm_clock_init(&msm8974_rumi_clock_init_data);
    else
        msm_clock_init(&msm8974_clock_init_data);
    tsens_tm_init_driver();
    msm_thermal_device_init();

    ram_console_device_init();
    bootloader_logger_init();
}
static int __init bootloader_logger_late_init(void)
{
    size_t buffer_size;
    void *buffer;

    int ret = 0;
    struct proc_dir_entry *entry;

    hwlog_info( "bootloader_logger: got buffer at %zx, size %zx\n",
           DDR_SBL_ADDR, DDR_SBL_SIZE);
    buffer_size = DDR_SBL_SIZE;
    #ifdef CONFIG_ARM64
    buffer =  ioremap(DDR_SBL_ADDR, DDR_SBL_SIZE);
    #else
    buffer = phys_to_virt(DDR_SBL_ADDR);
    #endif
    if (buffer == NULL) {
        hwlog_err( "bootloader_logger: failed to map memory\n");
        ret = -ENOMEM;
        goto error;
    }
    hwlog_info( "bootloader_logger: buffer mapped at %p\n", buffer);

    logger_main.tag = "main";
    logger_main.buffer = buffer;
    logger_main.buffer_size = buffer_size / 2 - sizeof(struct bootloader_logger_buffer);

    logger_last.tag = "last";
    logger_last.buffer = buffer + buffer_size / 2;
    logger_last.buffer_size = buffer_size / 2 - sizeof(struct bootloader_logger_buffer);

    bootloader_logger_init(&logger_main, NULL/* allocate */);
    bootloader_logger_init(&logger_last, NULL/* allocate */);


    if (logger_main.old_log != NULL) {
           entry = proc_create("bootloader_log", S_IRUSR, NULL, &bootloader_logger_main_file_ops);
        if (!entry) {
            hwlog_err("bootloader_logger: failed to create bootloader_log proc entry\n");
            kfree(logger_main.old_log);
            logger_main.old_log = NULL;
            return 0;
              }
        if (himntn_gobal_resetlog){
            bootloader_logger_dump_old(&logger_main);
           }
       }

    if (logger_last.old_log != NULL) {
           entry = proc_create("bootloader_log_last", S_IRUSR, NULL, &bootloader_logger_last_file_ops);
        if (!entry) {
            hwlog_err("bootloader_logger: failed to create bootloader_log_last proc entry\n");
            kfree(logger_last.old_log);
            logger_last.old_log = NULL;
            return 0;
              }
        if (himntn_gobal_resetlog){
            bootloader_logger_dump_old(&logger_last);
           }
    }
error:
	#ifdef CONFIG_ARM64
	iounmap(buffer);
	#endif
       return ret;
}