diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-11 07:58:33 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-07-11 07:58:33 +0200 |
commit | e2da792a523bf4366943545217fee574219b263f (patch) | |
tree | 9a1dead130235b81d200d9b7f896fa1c0ff00e23 /drivers | |
parent | 1f3959944ec390309535aeb47488da9881d2772d (diff) | |
parent | 4f0abb8db08b4970e9d58d79947638f8e298fcf6 (diff) | |
download | barebox-e2da792a523bf4366943545217fee574219b263f.tar.gz barebox-e2da792a523bf4366943545217fee574219b263f.tar.xz |
Merge branch 'for-next/imx'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mci/imx-esdhc.c | 9 | ||||
-rw-r--r-- | drivers/mci/imx.c | 4 | ||||
-rw-r--r-- | drivers/mci/mci-core.c | 19 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_imx_bbm.c | 33 | ||||
-rw-r--r-- | drivers/spi/imx_spi.c | 17 |
5 files changed, 33 insertions, 49 deletions
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 66786ffec7..4c45e929ba 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -550,13 +550,6 @@ static int esdhc_reset(struct fsl_esdhc_host *host) return 0; } -static int fsl_esdhc_detect(struct device_d *dev) -{ - struct fsl_esdhc_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static int fsl_esdhc_probe(struct device_d *dev) { struct resource *iores; @@ -615,8 +608,6 @@ static int fsl_esdhc_probe(struct device_d *dev) host->mci.card_present = esdhc_card_present; host->mci.hw_dev = dev; - dev->detect = fsl_esdhc_detect, - rate = clk_get_rate(host->clk); host->mci.f_min = rate >> 12; if (host->mci.f_min < 200000) diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c index 2788fb9d9d..354daba05d 100644 --- a/drivers/mci/imx.c +++ b/drivers/mci/imx.c @@ -519,9 +519,9 @@ static int mxcmci_probe(struct device_d *dev) host->mci.f_min = rate >> 7; host->mci.f_max = rate >> 1; - mci_register(&host->mci); + mci_of_parse(&host->mci); - return 0; + return mci_register(&host->mci); } static __maybe_unused struct of_device_id mxcmci_compatible[] = { diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 42dde06c3c..4e176f7b3c 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1589,11 +1589,13 @@ static int mci_card_probe(struct mci *mci) return -ENODEV; } - ret = regulator_enable(host->supply); - if (ret) { - dev_err(&mci->dev, "failed to enable regulator: %s\n", + if (!IS_ERR(host->supply)) { + ret = regulator_enable(host->supply); + if (ret) { + dev_err(&mci->dev, "failed to enable regulator: %s\n", strerror(-ret)); - return ret; + return ret; + } } /* start with a host interface reset */ @@ -1684,7 +1686,8 @@ on_error: if (rc != 0) { host->clock = 0; /* disable the MCI clock */ mci_set_ios(mci); - regulator_disable(host->supply); + if (!IS_ERR(host->supply)) + regulator_disable(host->supply); } return rc; @@ -1771,10 +1774,8 @@ int mci_register(struct mci_host *host) mci->dev.detect = mci_detect; host->supply = regulator_get(host->hw_dev, "vmmc"); - if (IS_ERR(host->supply)) { - ret = PTR_ERR(host->supply); - goto err_free; - } + if (IS_ERR(host->supply)) + dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n"); ret = register_device(&mci->dev); if (ret) diff --git a/drivers/mtd/nand/nand_imx_bbm.c b/drivers/mtd/nand/nand_imx_bbm.c index 251dfe5d3f..23722a9064 100644 --- a/drivers/mtd/nand/nand_imx_bbm.c +++ b/drivers/mtd/nand/nand_imx_bbm.c @@ -52,12 +52,20 @@ * on the flash BBT. * */ -static int checkbad(struct mtd_info *mtd, loff_t ofs, void *__buf) +static int checkbad(struct mtd_info *mtd, loff_t ofs) { - int ret, retlen; - uint8_t *buf = __buf; - - ret = mtd->read(mtd, ofs, mtd->writesize, &retlen, buf); + int ret; + uint8_t buf[mtd->writesize + mtd->oobsize]; + struct mtd_oob_ops ops; + + ops.mode = MTD_OPS_RAW; + ops.ooboffs = 0; + ops.datbuf = buf; + ops.len = mtd->writesize; + ops.oobbuf = buf + mtd->writesize; + ops.ooblen = mtd->oobsize; + + ret = mtd_read_oob(mtd, ofs, &ops); if (ret < 0) return ret; @@ -72,7 +80,6 @@ static void *create_bbt(struct mtd_info *mtd) struct nand_chip *chip = mtd->priv; int len, i, numblocks, ret; loff_t from = 0; - void *buf; uint8_t *bbt; if ((chip->bbt_td && chip->bbt_td->pages[0] != -1) || @@ -88,18 +95,12 @@ static void *create_bbt(struct mtd_info *mtd) if (!bbt) return ERR_PTR(-ENOMEM); - buf = malloc(mtd->writesize); - if (!buf) { - ret = -ENOMEM; - goto out2; - } - numblocks = mtd->size >> (chip->bbt_erase_shift - 1); for (i = 0; i < numblocks;) { - ret = checkbad(mtd, from, buf); + ret = checkbad(mtd, from); if (ret < 0) - goto out1; + goto out; if (ret) { bbt[i >> 3] |= 0x03 << (i & 0x6); @@ -113,9 +114,7 @@ static void *create_bbt(struct mtd_info *mtd) return bbt; -out1: - free(buf); -out2: +out: free(bbt); return ERR_PTR(ret); diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c index 99ec228887..dc7a8c89f3 100644 --- a/drivers/spi/imx_spi.c +++ b/drivers/spi/imx_spi.c @@ -515,23 +515,16 @@ static __maybe_unused struct spi_imx_devtype_data spi_imx_devtype_data_2_3 = { static int imx_spi_dt_probe(struct imx_spi *imx) { struct device_node *node = imx->master.dev->device_node; - int ret, i; - u32 num_cs; + int i; if (!node) return -ENODEV; - ret = of_property_read_u32(node, "fsl,spi-num-chipselects", &num_cs); - if (ret) - return ret; - - imx->master.num_chipselect = num_cs; - imx->cs_array = xzalloc(sizeof(u32) * num_cs); + imx->master.num_chipselect = of_gpio_named_count(node, "cs-gpios"); + imx->cs_array = xzalloc(sizeof(u32) * imx->master.num_chipselect); - for (i = 0; i < num_cs; i++) { - int cs_gpio = of_get_named_gpio(node, "cs-gpios", i); - imx->cs_array[i] = cs_gpio; - } + for (i = 0; i < imx->master.num_chipselect; i++) + imx->cs_array[i] = of_get_named_gpio(node, "cs-gpios", i); return 0; } |