Message ID | 1368613654-15229-8-git-send-email-tyanh@chromium.org |
---|---|
State | Accepted |
Delegated to: | Minkyu Kang |
Headers | show |
On Wed, May 15, 2013 at 3:27 AM, Hung-ying Tyan <tyanh@chromium.org> wrote: > This patch initiates cros-ec in board_init() to enable it for smdk5250. > > This patch depends on the patch in the MMC series that brings in exynos5-dt.c. > Refer to http://patchwork.ozlabs.org/patch/240084. > > Signed-off-by: Simon Glass <sjg@chromium.org> > Signed-off-by: Vincent Palatin <vpalatin@chromium.org> > Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
On 15 May 2013 15:57, Hung-ying Tyan <tyanh@chromium.org> wrote: > This patch initiates cros-ec in board_init() to enable it for smdk5250. > > This patch depends on the patch in the MMC series that brings in exynos5-dt.c. > Refer to http://patchwork.ozlabs.org/patch/240084. > > Signed-off-by: Simon Glass <sjg@chromium.org> > Signed-off-by: Vincent Palatin <vpalatin@chromium.org> > Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> > > --- > Changes in v5: > - Add exynos: tag. > - Add dependency description. > > Changes in v4: None > Changes in v3: None > Changes in v2: > - Moved code from smdk5250.c (non-FDT) to exynos5-dt.c (FDT). > - Moved code from smdk5250.h to exynos5250-dt.h. Sorry for very late reply. You are enabling this feature on smdk5250, but adding the configuration in exynos5250-dt.h, though exynos5250-dt.h is seems to common. Though this patch is merged but isnt it possible to submit a patch to add configuration macros to smdk5250.h rather than exynos5250-dt.h. Or shall i submit the patch for doing so. > - Added commit message. > - Dropped the period from commit subject. > > board/samsung/smdk5250/exynos5-dt.c | 45 +++++++++++++++++++++++++++++++++++++ > include/configs/exynos5250-dt.h | 10 ++++++++- > 2 files changed, 54 insertions(+), 1 deletion(-) > > diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c > index b01fe72..8be3192 100644 > --- a/board/samsung/smdk5250/exynos5-dt.c > +++ b/board/samsung/smdk5250/exynos5-dt.c > @@ -21,6 +21,7 @@ > */ > > #include <common.h> > +#include <cros_ec.h> > #include <fdtdec.h> > #include <asm/io.h> > #include <errno.h> > @@ -39,6 +40,13 @@ > > DECLARE_GLOBAL_DATA_PTR; > > +struct local_info { > + struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */ > + int cros_ec_err; /* Error for cros_ec, 0 if ok */ > +}; > + > +static struct local_info local; > + > #ifdef CONFIG_USB_EHCI_EXYNOS > int board_usb_vbus_init(void) > { > @@ -55,12 +63,30 @@ int board_usb_vbus_init(void) > } > #endif > > +struct cros_ec_dev *board_get_cros_ec_dev(void) > +{ > + return local.cros_ec_dev; > +} > + > +static int board_init_cros_ec_devices(const void *blob) > +{ > + local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev); > + if (local.cros_ec_err) > + return -1; /* Will report in board_late_init() */ > + > + return 0; > +} > + > int board_init(void) > { > gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); > #ifdef CONFIG_EXYNOS_SPI > spi_init(); > #endif > + > + if (board_init_cros_ec_devices(gd->fdt_blob)) > + return -1; > + > #ifdef CONFIG_USB_EHCI_EXYNOS > board_usb_vbus_init(); > #endif > @@ -337,3 +363,22 @@ int board_early_init_f(void) > return err; > } > #endif > + > +#ifdef CONFIG_BOARD_LATE_INIT > +int board_late_init(void) > +{ > + stdio_print_current_devices(); > + > + if (local.cros_ec_err) { > + /* Force console on */ > + gd->flags &= ~GD_FLG_SILENT; > + > + printf("cros-ec communications failure %d\n", > + local.cros_ec_err); > + puts("\nPlease reset with Power+Refresh\n\n"); > + panic("Cannot init cros-ec device"); > + return -1; > + } > + return 0; > +} > +#endif > diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h > index 97c8825..289db00 100644 > --- a/include/configs/exynos5250-dt.h > +++ b/include/configs/exynos5250-dt.h > @@ -82,11 +82,19 @@ > #define CONFIG_BAUDRATE 115200 > #define EXYNOS5_DEFAULT_UART_OFFSET 0x010000 > > +/* Enable keyboard */ > +#define CONFIG_CROS_EC /* CROS_EC protocol */ > +#define CONFIG_CROS_EC_SPI /* Support CROS_EC over SPI */ > +#define CONFIG_CROS_EC_I2C /* Support CROS_EC over I2C */ > +#define CONFIG_CROS_EC_KEYB /* CROS_EC keyboard input */ > +#define CONFIG_CMD_CROS_EC > +#define CONFIG_KEYBOARD > + > /* Console configuration */ > #define CONFIG_CONSOLE_MUX > #define CONFIG_SYS_CONSOLE_IS_IN_ENV > #define EXYNOS_DEVICE_SETTINGS \ > - "stdin=serial\0" \ > + "stdin=serial,cros-ec-keyb\0" \ > "stdout=serial,lcd\0" \ > "stderr=serial,lcd\0" > > -- > 1.8.2.1 > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot
[resent from correct address] Hi Chander, On Thu, Jul 25, 2013 at 12:30 AM, Chander Kashyap < chander.kashyap@linaro.org> wrote: > On 15 May 2013 15:57, Hung-ying Tyan <tyanh@chromium.org> wrote: > > This patch initiates cros-ec in board_init() to enable it for smdk5250. > > > > This patch depends on the patch in the MMC series that brings in > exynos5-dt.c. > > Refer to http://patchwork.ozlabs.org/patch/240084. > > > > Signed-off-by: Simon Glass <sjg@chromium.org> > > Signed-off-by: Vincent Palatin <vpalatin@chromium.org> > > Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> > > > > --- > > Changes in v5: > > - Add exynos: tag. > > - Add dependency description. > > > > Changes in v4: None > > Changes in v3: None > > Changes in v2: > > - Moved code from smdk5250.c (non-FDT) to exynos5-dt.c (FDT). > > - Moved code from smdk5250.h to exynos5250-dt.h. > > Sorry for very late reply. > You are enabling this feature on smdk5250, but adding the > configuration in exynos5250-dt.h, though exynos5250-dt.h is seems to > common. > Though this patch is merged but isnt it possible to submit a patch to > add configuration macros to smdk5250.h rather than exynos5250-dt.h. > Or shall i submit the patch for doing so. > We had this discuss on the list a month or two back. The idea with exynos5250-dt.h is that it supports all Exynos5250 boards, and only the device tree needs to be changes to select the particular features required for each board. It allows us to check, by building one board config, that all those boards build correctly. Then we can boot that image on smdk5250 or any other board, only changing the device tree. It is a good 'general' target for people starting a new port. But some will want to have their own board config to reduce the size of the image (removing features they know they don't need). We talked about creating something like exynos5250-dt-common to hold options that are common to all boards, so that those boards don't need to include exynos5250-dt.h. Things like cros_ec could be then be omitted from exynos5250-dt-common. Regards, Simon
diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c index b01fe72..8be3192 100644 --- a/board/samsung/smdk5250/exynos5-dt.c +++ b/board/samsung/smdk5250/exynos5-dt.c @@ -21,6 +21,7 @@ */ #include <common.h> +#include <cros_ec.h> #include <fdtdec.h> #include <asm/io.h> #include <errno.h> @@ -39,6 +40,13 @@ DECLARE_GLOBAL_DATA_PTR; +struct local_info { + struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */ + int cros_ec_err; /* Error for cros_ec, 0 if ok */ +}; + +static struct local_info local; + #ifdef CONFIG_USB_EHCI_EXYNOS int board_usb_vbus_init(void) { @@ -55,12 +63,30 @@ int board_usb_vbus_init(void) } #endif +struct cros_ec_dev *board_get_cros_ec_dev(void) +{ + return local.cros_ec_dev; +} + +static int board_init_cros_ec_devices(const void *blob) +{ + local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev); + if (local.cros_ec_err) + return -1; /* Will report in board_late_init() */ + + return 0; +} + int board_init(void) { gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); #ifdef CONFIG_EXYNOS_SPI spi_init(); #endif + + if (board_init_cros_ec_devices(gd->fdt_blob)) + return -1; + #ifdef CONFIG_USB_EHCI_EXYNOS board_usb_vbus_init(); #endif @@ -337,3 +363,22 @@ int board_early_init_f(void) return err; } #endif + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ + stdio_print_current_devices(); + + if (local.cros_ec_err) { + /* Force console on */ + gd->flags &= ~GD_FLG_SILENT; + + printf("cros-ec communications failure %d\n", + local.cros_ec_err); + puts("\nPlease reset with Power+Refresh\n\n"); + panic("Cannot init cros-ec device"); + return -1; + } + return 0; +} +#endif diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index 97c8825..289db00 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -82,11 +82,19 @@ #define CONFIG_BAUDRATE 115200 #define EXYNOS5_DEFAULT_UART_OFFSET 0x010000 +/* Enable keyboard */ +#define CONFIG_CROS_EC /* CROS_EC protocol */ +#define CONFIG_CROS_EC_SPI /* Support CROS_EC over SPI */ +#define CONFIG_CROS_EC_I2C /* Support CROS_EC over I2C */ +#define CONFIG_CROS_EC_KEYB /* CROS_EC keyboard input */ +#define CONFIG_CMD_CROS_EC +#define CONFIG_KEYBOARD + /* Console configuration */ #define CONFIG_CONSOLE_MUX #define CONFIG_SYS_CONSOLE_IS_IN_ENV #define EXYNOS_DEVICE_SETTINGS \ - "stdin=serial\0" \ + "stdin=serial,cros-ec-keyb\0" \ "stdout=serial,lcd\0" \ "stderr=serial,lcd\0"