.
.
.
common/stdio.c
int stdio_add_devices(void)
{
#ifdef CONFIG_DM_KEYBOARD
struct udevice *dev;
struct uclass *uc;
int ret;
/*
* For now we probe all the devices here. At some point this should be
* done only when the devices are required - e.g. we have a list of
* input devices to start up in the stdin environment variable. That
* work probably makes more sense when stdio itself is converted to
* driver model.
*
* TODO([email protected]): Convert changing uclass_first_device() etc.
* to return the device even on error. Then we could use that here.
*/
ret = uclass_get(UCLASS_KEYBOARD, &uc);
if (ret)
return ret;
/* Don't report errors to the caller - assume that they are non-fatal */
uclass_foreach_dev(dev, uc) {
ret = device_probe(dev);
if (ret)
printf("Failed to probe keyboard '%s'\n", dev->name);
}
#endif
#ifdef CONFIG_SYS_I2C
i2c_init_all();
#else
#if defined(CONFIG_HARD_I2C)
i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
#endif
#ifdef CONFIG_DM_VIDEO
/*
* If the console setting is not in environment variables then
* console_init_r() will not be calling iomux_doenv() (which calls
* search_device()). So we will not dynamically add devices by
* calling stdio_probe_device().
*
* So just probe all video devices now so that whichever one is
* required will be available.
*/
#ifndef CONFIG_SYS_CONSOLE_IS_IN_ENV
struct udevice *vdev;
# ifndef CONFIG_DM_KEYBOARD
int ret;
# endif
for (ret = uclass_first_device(UCLASS_VIDEO, &vdev);
vdev;
ret = uclass_next_device(&vdev))
;
if (ret)
printf("%s: Video device failed (ret=%d)\n", __func__, ret);
#endif /* !CONFIG_SYS_CONSOLE_IS_IN_ENV */
#else
# if defined(CONFIG_LCD)
drv_lcd_init ();
# endif
# if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
drv_video_init ();
# endif
#endif /* CONFIG_DM_VIDEO */
#if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
drv_keyboard_init ();
#endif
#ifdef CONFIG_LOGBUFFER
drv_logbuff_init ();
#endif
drv_system_init ();
serial_stdio_init ();
#ifdef CONFIG_USB_TTY
drv_usbtty_init ();
#endif
#ifdef CONFIG_NETCONSOLE
drv_nc_init ();
#endif
#ifdef CONFIG_JTAG_CONSOLE
drv_jtag_console_init ();
#endif
#ifdef CONFIG_CBMEM_CONSOLE
cbmemc_init();
#endif
return 0;
}