Commit 259fa982 authored by Jeffy Chen's avatar Jeffy Chen Committed by chrome-bot
Browse files

fastboot: Pass storages to fb_fill_info() directly



Make fill_fb_info() take storage parameters directly.

BUG=b:63407238
TEST=build and boot

Change-Id: I906ad56f3cfee074693ff64c0b221194cf924c01
Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/652089

Reviewed-by: default avatarFurquan Shaikh <furquan@chromium.org>
Reviewed-by: default avatarJulius Werner <jwerner@chromium.org>
parent 36a44cff
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "drivers/gpio/sysinfo.h" #include "drivers/gpio/sysinfo.h"
#include "drivers/gpio/tegra.h" #include "drivers/gpio/tegra.h"
#include "drivers/dma/tegra_apb.h" #include "drivers/dma/tegra_apb.h"
#include "drivers/flash/block_flash.h"
#include "drivers/flash/spi.h" #include "drivers/flash/spi.h"
#include "drivers/power/sysinfo.h" #include "drivers/power/sysinfo.h"
#include "drivers/power/max77620.h" #include "drivers/power/max77620.h"
...@@ -68,7 +67,7 @@ enum { ...@@ -68,7 +67,7 @@ enum {
}; };
void __attribute__((weak)) void __attribute__((weak))
fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]) fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash)
{ {
/* Default weak implementation. */ /* Default weak implementation. */
} }
...@@ -120,8 +119,6 @@ static int board_setup(void) ...@@ -120,8 +119,6 @@ static int board_setup(void)
flash_set_ops(&flash->ops); flash_set_ops(&flash->ops);
FlashBlockDev *fbdev = block_flash_register_nor(&flash->ops);
/* Foster has no TPM */ /* Foster has no TPM */
no_tpm_ops.xmit = &no_tpm_xmit; no_tpm_ops.xmit = &no_tpm_xmit;
tpm_set_ops(&no_tpm_ops); tpm_set_ops(&no_tpm_ops);
...@@ -157,11 +154,7 @@ static int board_setup(void) ...@@ -157,11 +154,7 @@ static int board_setup(void)
&removable_block_dev_controllers); &removable_block_dev_controllers);
/* Fill in fastboot related information */ /* Fill in fastboot related information */
BlockDevCtrlr *bdev_arr[BDEV_COUNT] = { fill_fb_info(emmc, flash);
[FLASH_BDEV] = &fbdev->ctrlr,
[MMC_BDEV] = &emmc->mmc.ctrlr,
};
fill_fb_info(bdev_arr);
/* Careful: the EHCI base is at offset 0x100 from the SoC's IP base */ /* Careful: the EHCI base is at offset 0x100 from the SoC's IP base */
UsbHostController *usbd = new_usb_hc(EHCI, 0x7d000100); UsbHostController *usbd = new_usb_hc(EHCI, 0x7d000100);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "board/foster/fastboot.h" #include "board/foster/fastboot.h"
#include "config.h" #include "config.h"
#include "drivers/bus/usb/usb.h" #include "drivers/bus/usb/usb.h"
#include "drivers/flash/block_flash.h"
#include "vboot/firmware_id.h" #include "vboot/firmware_id.h"
struct bdev_info fb_bdev_list[BDEV_COUNT] = { struct bdev_info fb_bdev_list[BDEV_COUNT] = {
...@@ -96,12 +97,13 @@ void fastboot_chipset_init(struct usbdev_ctrl **udc, device_descriptor_t *dd) ...@@ -96,12 +97,13 @@ void fastboot_chipset_init(struct usbdev_ctrl **udc, device_descriptor_t *dd)
*udc = chipidea_init(dd); *udc = chipidea_init(dd);
} }
void fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]) void fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash)
{ {
int i; FlashBlockDev *fbdev = block_flash_register_nor(&flash->ops);
for (i = 0; i < BDEV_COUNT; i++) fb_fill_bdev_list(MMC_BDEV, &emmc->mmc.ctrlr);
fb_fill_bdev_list(i, bdev_ctrlr_arr[i]);
fb_fill_bdev_list(FLASH_BDEV, &fbdev->ctrlr);
fb_fill_part_list("firmware", 0, lib_sysinfo.spi_flash.size / fb_fill_part_list("firmware", 0, lib_sysinfo.spi_flash.size /
lib_sysinfo.spi_flash.sector_size); lib_sysinfo.spi_flash.sector_size);
} }
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#define __BOARD_RUSH_RYU_FASTBOOT_H__ #define __BOARD_RUSH_RYU_FASTBOOT_H__
#include "config.h" #include "config.h"
#include "drivers/storage/blockdev.h" #include "drivers/flash/spi.h"
#include "drivers/storage/tegra_mmc.h"
typedef enum { typedef enum {
MMC_BDEV, MMC_BDEV,
...@@ -33,6 +34,6 @@ typedef enum { ...@@ -33,6 +34,6 @@ typedef enum {
#include "fastboot/print.h" #include "fastboot/print.h"
#include "fastboot/udc.h" #include "fastboot/udc.h"
void fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]); void fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash);
#endif /* __BOARD_RUSH_RYU_FASTBOOT_H__ */ #endif /* __BOARD_RUSH_RYU_FASTBOOT_H__ */
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "drivers/gpio/sysinfo.h" #include "drivers/gpio/sysinfo.h"
#include "drivers/gpio/tegra210.h" #include "drivers/gpio/tegra210.h"
#include "drivers/dma/tegra_apb.h" #include "drivers/dma/tegra_apb.h"
#include "drivers/flash/block_flash.h"
#include "drivers/flash/spi.h" #include "drivers/flash/spi.h"
#include "drivers/power/sysinfo.h" #include "drivers/power/sysinfo.h"
#include "drivers/power/max77620.h" #include "drivers/power/max77620.h"
...@@ -77,7 +76,7 @@ enum { ...@@ -77,7 +76,7 @@ enum {
}; };
void __attribute__((weak)) void __attribute__((weak))
fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]) fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash)
{ {
/* Default weak implementation. */ /* Default weak implementation. */
} }
...@@ -161,8 +160,6 @@ static int board_setup(void) ...@@ -161,8 +160,6 @@ static int board_setup(void)
flash_set_ops(&flash->ops); flash_set_ops(&flash->ops);
FlashBlockDev *fbdev = block_flash_register_nor(&flash->ops);
TegraI2c *gen3_i2c = new_tegra_i2c((void *)0x7000c500, 3, TegraI2c *gen3_i2c = new_tegra_i2c((void *)0x7000c500, 3,
(void *)CLK_RST_U_RST_SET, (void *)CLK_RST_U_RST_SET,
(void *)CLK_RST_U_RST_CLR, (void *)CLK_RST_U_RST_CLR,
...@@ -196,11 +193,7 @@ static int board_setup(void) ...@@ -196,11 +193,7 @@ static int board_setup(void)
&fixed_block_dev_controllers); &fixed_block_dev_controllers);
/* Fill in fastboot related information */ /* Fill in fastboot related information */
BlockDevCtrlr *bdev_arr[BDEV_COUNT] = { fill_fb_info(emmc, flash);
[FLASH_BDEV] = &fbdev->ctrlr,
[MMC_BDEV] = &emmc->mmc.ctrlr,
};
fill_fb_info(bdev_arr);
/* Bdev ctrlr required for BCB. */ /* Bdev ctrlr required for BCB. */
bcb_bdev_ctrlr = &emmc->mmc.ctrlr; bcb_bdev_ctrlr = &emmc->mmc.ctrlr;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "config.h" #include "config.h"
#include "drivers/bus/usb/usb.h" #include "drivers/bus/usb/usb.h"
#include "drivers/ec/cros/ec.h" #include "drivers/ec/cros/ec.h"
#include "drivers/flash/block_flash.h"
#include "image/fmap.h" #include "image/fmap.h"
#include "vboot/firmware_id.h" #include "vboot/firmware_id.h"
#include "vboot/vbnv.h" #include "vboot/vbnv.h"
...@@ -152,17 +153,18 @@ void fastboot_chipset_init(struct usbdev_ctrl **udc, device_descriptor_t *dd) ...@@ -152,17 +153,18 @@ void fastboot_chipset_init(struct usbdev_ctrl **udc, device_descriptor_t *dd)
*udc = chipidea_init(dd); *udc = chipidea_init(dd);
} }
void fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]) void fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash)
{ {
FlashBlockDev *fbdev = block_flash_register_nor(&flash->ops);
FmapArea area;
const char *name;
size_t flash_sec_size = lib_sysinfo.spi_flash.sector_size;
int i; int i;
for (i = 0; i < BDEV_COUNT; i++) fb_fill_bdev_list(MMC_BDEV, &emmc->mmc.ctrlr);
fb_fill_bdev_list(i, bdev_ctrlr_arr[i]);
fb_fill_part_list("chromeos", 0, backend_get_bdev_size_blocks("mmc")); fb_fill_part_list("chromeos", 0, backend_get_bdev_size_blocks("mmc"));
FmapArea area; fb_fill_bdev_list(FLASH_BDEV, &fbdev->ctrlr);
const char *name;
size_t flash_sec_size = lib_sysinfo.spi_flash.sector_size;
for (i = 0; i < fb_part_count; i++) { for (i = 0; i < fb_part_count; i++) {
if (fb_part_list[i].bdev_info != BDEV_ENTRY(FLASH_BDEV)) if (fb_part_list[i].bdev_info != BDEV_ENTRY(FLASH_BDEV))
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#define __BOARD_SMAUG_FASTBOOT_H__ #define __BOARD_SMAUG_FASTBOOT_H__
#include "config.h" #include "config.h"
#include "drivers/storage/blockdev.h" #include "drivers/flash/spi.h"
#include "drivers/storage/tegra_mmc.h"
typedef enum { typedef enum {
MMC_BDEV, MMC_BDEV,
...@@ -33,6 +34,6 @@ typedef enum { ...@@ -33,6 +34,6 @@ typedef enum {
#include "fastboot/print.h" #include "fastboot/print.h"
#include "fastboot/udc.h" #include "fastboot/udc.h"
void fill_fb_info(BlockDevCtrlr *bdev_ctrlr_arr[BDEV_COUNT]); void fill_fb_info(TegraMmcHost *emmc, SpiFlash *flash);
#endif /* __BOARD_SMAUG_FASTBOOT_H__ */ #endif /* __BOARD_SMAUG_FASTBOOT_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment