Elyes Haouas has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69027 )
Change subject: soc/ti/am335x: Use 'enum cb_err' ......................................................................
soc/ti/am335x: Use 'enum cb_err'
Change-Id: Icf9d35b72aa233e4a40a50228883062062ad573f Signed-off-by: Elyes Haouas ehaouas@noos.fr --- M src/soc/ti/am335x/mmc.c M src/soc/ti/am335x/mmc.h 2 files changed, 24 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/69027/1
diff --git a/src/soc/ti/am335x/mmc.c b/src/soc/ti/am335x/mmc.c index 577434c..467b878 100644 --- a/src/soc/ti/am335x/mmc.c +++ b/src/soc/ti/am335x/mmc.c @@ -5,6 +5,8 @@ #include <commonlib/sd_mmc_ctrlr.h> #include <device/mmio.h> #include <timer.h> +#include <types.h> + #include "mmc.h"
#define AM335X_TIMEOUT_MSEC 1000 @@ -63,20 +65,20 @@ return -1; }
-static int am335x_mmc_init(struct am335x_mmc *mmc) +static enum cb_err am335x_mmc_init(struct am335x_mmc *mmc) { // Follows the initialisiation from the AM335X technical reference manual setbits32(&mmc->sysconfig, SYSCONFIG_SOFTRESET);
if (am335x_wait_for_reg(&mmc->sysstatus, SYSSTATUS_RESETDONE, AM335X_TIMEOUT_MSEC)) - return -1; + return CB_ERR;
setbits32(&mmc->capa, CAPA_VS30); setbits32(&mmc->hctl, HCTL_SDVS_VS30 | HCTL_DTW_1BIT); setbits32(&mmc->hctl, HCTL_SDBP);
if (am335x_wait_for_reg(&mmc->hctl, HCTL_SDBP, AM335X_TIMEOUT_MSEC)) - return -1; + return CB_ERR;
// Assumes the default input clock speed of 96MHz to set a minimum SD // speed of 400 KHz @@ -85,7 +87,7 @@ setbits32(&mmc->sysctl, SYSCTL_ICE | SYSCTL_CEN);
if (am335x_wait_for_reg(&mmc->sysctl, SYSCTL_ICS, AM335X_TIMEOUT_MSEC)) - return -1; + return CB_ERR;
write32(&mmc->ie, IE_ERRORS | IE_TC | IE_CC);
@@ -96,12 +98,12 @@ write32(&mmc->cmd, 0x00);
if (am335x_wait_for_reg(&mmc->stat, STAT_CC, AM335X_TIMEOUT_MSEC)) - return -1; + return CB_ERR;
write32(&mmc->stat, 0xffffffffu); clrbits32(&mmc->con, CON_INIT);
- return 0; + return CB_SUCCESS; }
static int am335x_send_cmd(struct sd_mmc_ctrlr *ctrlr, struct mmc_command *cmd, @@ -254,16 +256,14 @@ } }
-int am335x_mmc_init_storage(struct am335x_mmc_host *mmc_host) +enum cb_err err am335x_mmc_init_storage(struct am335x_mmc_host *mmc_host) { - int err = 0; - struct sd_mmc_ctrlr *mmc_ctrlr = &mmc_host->sd_mmc_ctrlr; memset(mmc_ctrlr, 0, sizeof(*mmc_ctrlr));
- err = am335x_mmc_init(mmc_host->reg); - if (err != 0) { + enum cb_err err = am335x_mmc_init(mmc_host->reg); + if (err != CB_SUCCESS) { printk(BIOS_ERR, "Initialising AM335X SD failed.\n"); return err; } @@ -278,5 +278,5 @@ mmc_ctrlr->f_min = 400000; mmc_ctrlr->bus_hz = 400000;
- return 0; + return CB_SUCCESS; } diff --git a/src/soc/ti/am335x/mmc.h b/src/soc/ti/am335x/mmc.h index 3293332..cea0217 100644 --- a/src/soc/ti/am335x/mmc.h +++ b/src/soc/ti/am335x/mmc.h @@ -4,6 +4,7 @@ #define AM335X_MMC_H
#include <commonlib/sd_mmc_ctrlr.h> +#include <types.h>
#define MMCHS0_BASE 0x48060000
@@ -44,6 +45,6 @@ uint32_t sd_clock_hz; };
-int am335x_mmc_init_storage(struct am335x_mmc_host *mmc_host); +enum cb_err err am335x_mmc_init_storage(struct am335x_mmc_host *mmc_host);
#endif