static void setup_commandline_tag (bd_t *bd, char *commandline) { char *p; ulong size = get_sdram_size(); if (!commandline) return; /* eat leading white space */ for (p = commandline; *p == ' '; p++); /* skip non-existent command lines so the kernel will still * use its default command line. */ if (*p == '\0') return; if (size == SZ_512M) { change_mem_size_in_cmdline(p, size); } params->hdr.tag = ATAG_CMDLINE; params->hdr.size = (sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2; strcpy (params->u.cmdline.cmdline, p); params = tag_next (params); }
static inline void ramconsole_init(void) { ulong sdram_size = get_sdram_size(); if (sdram_size == SZ_512M) { platform_device_register(&ram_console_device_512); } else { platform_device_register(&ram_console_device); } }
static void __init acclaim_ram_init(void) { ulong sdram_size = get_sdram_size(); if (sdram_vendor() == SAMSUNG_SDRAM) { if (sdram_size == SZ_512M) { omap_emif_setup_device_details (&emif_devices_512_samsung, &emif_devices_512_samsung); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details (&emif_devices_samsung, &emif_devices_samsung); } else { pr_err("sdram memory size does not exist, " "default to using 1024MB \n"); omap_emif_setup_device_details (&emif_devices_samsung, &emif_devices_samsung); } printk(KERN_INFO"Samsung DDR Memory \n"); } else if (sdram_vendor() == ELPIDA_SDRAM) { if (sdram_size == SZ_512M) { omap_emif_setup_device_details (&emif_devices_512_elpida, &emif_devices_512_elpida); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details (&emif_devices_elpida, &emif_devices_elpida); } else { pr_err("sdram memory size does not exist, " "default to using 1024MB \n"); omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } printk(KERN_INFO"Elpida DDR Memory \n"); } else if (sdram_vendor() == HYNIX_SDRAM) { /* Re-use ELPIDA timings as they are absolutely the same */ if (sdram_size == SZ_512M) { omap_emif_setup_device_details (&emif_devices_512_elpida, &emif_devices_512_elpida); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } else { pr_err("sdram memory size does not exist, " "default to using 1024MB \n"); omap_emif_setup_device_details (&emif_devices_elpida, &emif_devices_elpida); } printk(KERN_INFO"Hynix DDR Memory \n"); } else pr_err("Memory type does not exist\n"); }
void __init acclaim_peripherals_init(void) { int status; int package = OMAP_PACKAGE_CBS; ulong sdram_size = get_sdram_size(); ramconsole_init(); if (omap_rev() == OMAP4430_REV_ES1_0) package = OMAP_PACKAGE_CBL; omap4_mux_init(board_mux, package); acclaim_board_init(); if (sdram_vendor() == SAMSUNG_SDRAM) { if (sdram_size == SZ_512M) { omap_emif_setup_device_details(&emif_devices_512_samsung, &emif_devices_512_samsung); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details(&emif_devices_samsung, &emif_devices_samsung); } else { pr_err("sdram memory size does not exist, default to using 1024MB \n"); omap_emif_setup_device_details(&emif_devices_samsung, &emif_devices_samsung); } printk(KERN_INFO"Samsung DDR Memory \n"); } else if (sdram_vendor() == ELPIDA_SDRAM) { if (sdram_size == SZ_512M) { omap_emif_setup_device_details(&emif_devices_512_elpida, &emif_devices_512_elpida); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } else { pr_err("sdram memory size does not exist, default to using 1024MB \n"); omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } printk(KERN_INFO"Elpida DDR Memory \n"); } else if (sdram_vendor() == HYNIX_SDRAM) { /* Re-use ELPIDA timings as they are absolutely the same */ if (sdram_size == SZ_512M) { omap_emif_setup_device_details(&emif_devices_512_elpida, &emif_devices_512_elpida); } else if (sdram_size == SZ_1G) { omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } else { pr_err("sdram memory size does not exist, default to using 1024MB \n"); omap_emif_setup_device_details(&emif_devices_elpida, &emif_devices_elpida); } printk(KERN_INFO"Hynix DDR Memory \n"); } else pr_err("Memory type does not exist\n"); omap_init_emif_timings(); enable_rtc_gpio(); omap4_i2c_init(); platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); acclaim_init_charger(); wake_lock_init(&uart_lock, WAKE_LOCK_SUSPEND, "uart_wake_lock"); omap_serial_init(omap_serial_platform_data); omap4_twl6030_hsmmc_init(mmc); #ifdef CONFIG_TIWLAN_SDIO config_wlan_mux(); #else //omap4_4430sdp_wifi_init(); #endif kxtf9_dev_init(); #ifdef CONFIG_BATTERY_MAX17042 max17042_dev_init(); #endif usb_uhhtll_init(&usbhs_pdata); usb_musb_init(&musb_board_data); status = omap4_keypad_initialization(&sdp4430_keypad_data); if (status) pr_err("Keypad initialization failed: %d\n", status); spi_register_board_info(sdp4430_spi_board_info, ARRAY_SIZE(sdp4430_spi_board_info)); acclaim_panel_init(); enable_board_wakeup_source(); omap_voltage_register_pmic(&omap_pmic_core, "core"); omap_voltage_register_pmic(&omap_pmic_mpu, "mpu"); omap_voltage_register_pmic(&omap_pmic_iva, "iva"); omap_voltage_init_vc(&vc_config); }
int determine_boot_type(void) { DECLARE_GLOBAL_DATA_PTR; uint8_t charging; uint16_t batt_lvl; extern uint16_t check_charging(uint8_t* enabling); unsigned long bootcount = bootcount_load(); char s [5]; setenv("bootlimit", stringify(ACCLAIM_BOOTLIMIT)); setenv("altbootcmd", "mmcinit 1; booti mmc1 recovery"); batt_lvl = check_charging(&charging); lcd_console_init(); // give subtle indicator if uboot is booting from emmc or sd if(charging) lcd_bl_set_brightness(35); //batt very low, let it charge lcd_console_setpos(0, 1); //indent slightly lcd_console_setcolor(CONSOLE_COLOR_GRAY, CONSOLE_COLOR_BLACK); if (running_from_sd()) { lcd_puts("SD"); } else { lcd_puts("EMMC"); } sprintf(s, " %u", bootcount); lcd_puts(s); extern const char* board_rev_string(unsigned long btype); lcd_console_setpos(1, 1); lcd_printf("board rev: %s | %s", board_rev_string(gd->bd->bi_board_revision), (get_sdram_size() == SZ_512M?"512MB/8GB":"1GB/16GB")); lcd_console_setpos(2, 1); lcd_console_setcolor((batt_lvl < 30?(batt_lvl <= 10?CONSOLE_COLOR_RED:CONSOLE_COLOR_ORANGE):CONSOLE_COLOR_GREEN), CONSOLE_COLOR_BLACK); lcd_printf("batt level: %d\n charging %s", batt_lvl, (charging?"ENABLED":"DISABLED")); int action = get_boot_action(); while(1){ if(charging) lcd_bl_set_brightness(35); //batt very low, let it charge else lcd_bl_set_brightness(100); //batt very low, let it charge switch(action) { case BOOT_SD_NORMAL: setenv ("bootcmd", "setenv setbootargs setenv bootargs ${sdbootargs}; run setbootargs; mmcinit 0; fatload mmc 0:1 0x81000000 boot.img; booti 0x81000000"); setenv ("altbootcmd", "run bootcmd"); // for sd boot altbootcmd is the same as bootcmd display_feedback(BOOT_SD_NORMAL); return 0; case BOOT_SD_RECOVERY: setenv ("bootcmd", "setenv setbootargs setenv bootargs ${sdbootargs}; run setbootargs; mmcinit 0; fatload mmc 0:1 0x81000000 recovery.img; booti 0x81000000"); setenv ("altbootcmd", "run bootcmd"); // for sd boot altbootcmd is the same as bootcmd display_feedback(BOOT_SD_RECOVERY); return 0; case BOOT_SD_ALTBOOT: setenv ("bootcmd", "setenv setbootargs setenv bootargs ${sdbootargs}; run setbootargs; mmcinit 0; fatload mmc 0:1 0x81000000 altboot.img; booti 0x81000000"); setenv ("altbootcmd", "run bootcmd"); // for sd boot altbootcmd is the same as bootcmd display_feedback(BOOT_SD_ALTBOOT); return 0; //actually, boot from boot+512K -- thanks bauwks! case BOOT_EMMC_NORMAL: setenv("bootcmd", "mmcinit 1; booti mmc1 boot 0x80000"); display_feedback(BOOT_EMMC_NORMAL); return 0; //actually, boot from recovery+512K -- thanks bauwks! case BOOT_EMMC_RECOVERY: setenv("bootcmd", "mmcinit 1; booti mmc1 recovery 0x80000"); display_feedback(BOOT_EMMC_RECOVERY); return 0; case BOOT_EMMC_ALTBOOT: // no 512K offset, this is just a file. setenv ("bootcmd", "setenv setbootargs setenv bootargs ${emmcbootargs}; run setbootargs; mmcinit 1; fatload mmc 1:5 0x81000000 altboot.img; booti 0x81000000"); setenv ("altbootcmd", "run bootcmd"); // for emmc altboot altbootcmd is the same as bootcmd display_feedback(BOOT_EMMC_ALTBOOT); return 0; case BOOT_FASTBOOT: display_feedback(BOOT_FASTBOOT); run_command("fastboot", 0); break; case INVALID: default: printf("Aborting boot!\n"); return 1; } action = do_menu(); } }