From 645c48f50eab307a9879a82c4d066e74114ec78a Mon Sep 17 00:00:00 2001 From: Daniel Kochmański Date: Fri, 29 May 2015 16:55:41 +0200 Subject: sunxi: Create helper function veryfing valid boot signature on MMC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch extracts checking for valid SD card "eGON.BT0" signature from `board_mmc_init` into function `sunxi_mmc_has_egon_boot_signature`. Buffer for mmc sector is allocated and freed at runtime. `panic` is triggered on malloc failure. Signed-off-by: Daniel Kochmański CC: Roy Spliet Cc: Ian Campbell [hdegoede@redhat.com: Small bugfix to make it work for devs other then mmc0] Acked-by: Hans de Goede Signed-off-by: Hans de Goede --- board/sunxi/board.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'board') diff --git a/board/sunxi/board.c b/board/sunxi/board.c index ed60e74808..76e4b9bcc1 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -299,12 +299,8 @@ int board_mmc_init(bd_t *bis) * Both mmc0 and mmc2 are bootable, figure out where we're booting * from. Try mmc0 first, just like the brom does. */ - if (mmc_getcd(mmc0) && mmc_init(mmc0) == 0 && - mmc0->block_dev.block_read(0, 16, 1, buf) == 1) { - buf[12] = 0; - if (strcmp(&buf[4], "eGON.BT0") == 0) - return 0; - } + if (sunxi_mmc_has_egon_boot_signature(mmc0)) + return 0; /* no bootable card in mmc0, so we must be booting from mmc2, swap */ mmc0->block_dev.dev = 1; -- cgit From bf5b9b103c9ad9fa041b9913fb3a031c14566f5d Mon Sep 17 00:00:00 2001 From: Daniel Kochmański Date: Fri, 29 May 2015 17:21:00 +0200 Subject: sunxi: spl: Remove redundant check from `board_mmc_init` for signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the boot signature check from board_mmc_init() in spl mode, as it is already done in spl_boot_device() in this case, and update the comments to reflect this. Signed-off-by: Daniel Kochmański CC: Roy Spliet Cc: Ian Campbell [hdegoede@redhat.com: Disable the check only for SPL instead of always] Acked-by: Hans De Goede Signed-off-by: Hans de Goede --- board/sunxi/board.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'board') diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 76e4b9bcc1..7220af3454 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -294,17 +294,19 @@ int board_mmc_init(bd_t *bis) return -1; #endif -#if CONFIG_MMC_SUNXI_SLOT == 0 && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 +#if !defined(CONFIG_SPL_BUILD) && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 /* - * Both mmc0 and mmc2 are bootable, figure out where we're booting - * from. Try mmc0 first, just like the brom does. + * On systems with an emmc (mmc2), figure out if we are booting from + * the emmc and if we are make it "mmc dev 0" so that boot.scr, etc. + * are searched there first. Note we only do this for u-boot proper, + * not for the SPL, see spl_boot_device(). */ - if (sunxi_mmc_has_egon_boot_signature(mmc0)) - return 0; - - /* no bootable card in mmc0, so we must be booting from mmc2, swap */ - mmc0->block_dev.dev = 1; - mmc1->block_dev.dev = 0; + if (!sunxi_mmc_has_egon_boot_signature(mmc0) && + sunxi_mmc_has_egon_boot_signature(mmc1)) { + /* Booting from emmc / mmc2, swap */ + mmc0->block_dev.dev = 1; + mmc1->block_dev.dev = 0; + } #endif return 0; -- cgit From 48c06c98ecd99b2a4752461b6cc5c4a05d2f616a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 14 Jun 2015 17:29:53 +0200 Subject: sunxi: usb-phy: Add support for reading otg id pin value Add support for reading the id pin value of the otg connector to the usb phy code. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'board') diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 2a1cd3cf3b..441c880813 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -294,6 +294,13 @@ config USB0_VBUS_DET Set the Vbus detect pin for usb0 (otg). This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +config USB0_ID_DET + string "ID detect pin for usb0 (otg)" + default "" + ---help--- + Set the ID detect pin for usb0 (otg). This takes a string in the + format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. + config USB1_VBUS_PIN string "Vbus enable pin for usb1 (ehci0)" default "PH6" if MACH_SUN4I || MACH_SUN7I -- cgit From d42faf3198262710d17548950e1ab41413e8b7f9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 17 Jun 2015 15:49:26 +0200 Subject: sunxi: musb: Move musb config and platdata to the sunxi-musb glue Move the musb config and platdata to the sunxi-musb glue, which is where it really belongs. This is preparation patch for adding device-model support for the sunxi-musb-host code. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/board.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'board') diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 7220af3454..afed6a31ca 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) @@ -449,28 +448,6 @@ void sunxi_board_init(void) } #endif -#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) -extern const struct musb_platform_ops sunxi_musb_ops; - -static struct musb_hdrc_config musb_config = { - .multipoint = 1, - .dyn_fifo = 1, - .num_eps = 6, - .ram_bits = 11, -}; - -static struct musb_hdrc_platform_data musb_plat = { -#if defined(CONFIG_MUSB_HOST) - .mode = MUSB_HOST, -#else - .mode = MUSB_PERIPHERAL, -#endif - .config = &musb_config, - .power = 250, - .platform_ops = &sunxi_musb_ops, -}; -#endif - #ifdef CONFIG_USB_GADGET int g_dnl_board_usb_cable_connected(void) { @@ -533,9 +510,8 @@ int misc_init_r(void) if (ret) return ret; #endif -#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) - musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); -#endif + sunxi_musb_board_init(); + return 0; } #endif -- cgit