summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/disk_ata_drive.c11
-rw-r--r--drivers/ata/disk_bios_drive.c2
-rw-r--r--drivers/ata/intf_platform_ide.c2
-rw-r--r--drivers/ata/pata-imx.c2
-rw-r--r--drivers/ata/sata-imx.c2
-rw-r--r--drivers/bus/omap-gpmc.c3
-rw-r--r--drivers/eeprom/at24.c2
-rw-r--r--drivers/mci/imx-esdhc.c14
-rw-r--r--drivers/mci/mci-core.c6
-rw-r--r--drivers/mci/mxs.c10
-rw-r--r--drivers/mfd/stmpe-i2c.c4
-rw-r--r--drivers/misc/Kconfig1
-rw-r--r--drivers/misc/sram.c3
-rw-r--r--drivers/mtd/core.c12
-rw-r--r--drivers/mtd/devices/docg3.c4
-rw-r--r--drivers/mtd/mtdoob.c2
-rw-r--r--drivers/mtd/mtdraw.c2
-rw-r--r--drivers/mtd/nand/nand-bb.c2
-rw-r--r--drivers/mtd/nand/nand_imx_bbm.c2
-rw-r--r--drivers/mtd/nand/nand_omap_gpmc.c96
-rw-r--r--drivers/mtd/ubi/barebox.c4
-rw-r--r--drivers/mtd/ubi/ubi-barebox.h3
-rw-r--r--drivers/mtd/ubi/ubi.h1
-rw-r--r--drivers/net/altera_tse.c2
-rw-r--r--drivers/net/davinci_emac.c2
-rw-r--r--drivers/net/designware.c2
-rw-r--r--drivers/net/dm9k.c2
-rw-r--r--drivers/net/ep93xx.c2
-rw-r--r--drivers/net/fec_imx.c2
-rw-r--r--drivers/net/fec_imx.h2
-rw-r--r--drivers/net/fec_mpc5200.c2
-rw-r--r--drivers/net/ksz8864rmn.c2
-rw-r--r--drivers/net/phy/phy.c49
-rw-r--r--drivers/net/smc91111.c2
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/smc911x.h2
-rw-r--r--drivers/of/Makefile4
-rw-r--r--drivers/of/barebox.c2
-rw-r--r--drivers/of/base.c41
-rw-r--r--drivers/of/fdt.c106
-rw-r--r--drivers/of/of_path.c2
-rw-r--r--drivers/of/partition.c2
-rw-r--r--drivers/pci/pci-mvebu.c4
-rw-r--r--drivers/pinctrl/pinctrl-mxs.c4
-rw-r--r--drivers/pinctrl/pinctrl.c2
-rw-r--r--drivers/pwm/pwm-imx.c5
-rw-r--r--drivers/pwm/pwm-mxs.c2
-rw-r--r--drivers/pwm/pxa_pwm.c2
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/serial/serial_auart.c9
-rw-r--r--drivers/serial/serial_ns16550.c2
-rw-r--r--drivers/spi/gpio_spi.c2
-rw-r--r--drivers/spi/imx_spi.c2
-rw-r--r--drivers/usb/gadget/composite.c2
-rw-r--r--drivers/usb/gadget/f_fastboot.c8
-rw-r--r--drivers/usb/storage/usb.c2
-rw-r--r--drivers/video/edid.c9
-rw-r--r--drivers/video/fb.c2
-rw-r--r--drivers/video/imx-ipu-v3/imx-ldb.c8
-rw-r--r--drivers/video/imx-ipu-v3/ipu-di.c3
-rw-r--r--drivers/video/imx-ipu-v3/ipufb.c2
-rw-r--r--drivers/w1/slaves/w1_ds2431.c2
-rw-r--r--drivers/w1/slaves/w1_ds2433.c2
63 files changed, 316 insertions, 180 deletions
diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index d30d0ad997..1aa1bb1456 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -243,7 +243,7 @@ static int ata_port_init(struct ata_port *port)
rc = cdev_find_free_index("ata");
if (rc == -1)
pr_err("Cannot find a free index for the disk node\n");
- port->blk.cdev.name = asprintf("ata%d", rc);
+ port->blk.cdev.name = basprintf("ata%d", rc);
}
port->blk.num_blocks = ata_id_n_sectors(port->id);
@@ -303,6 +303,14 @@ static int ata_detect(struct device_d *dev)
return ata_port_detect(port);
}
+static void ata_info(struct device_d *dev)
+{
+ struct ata_port *port = container_of(dev, struct ata_port, class_dev);
+
+ if (port->initialized)
+ ata_dump_id(port->id);
+}
+
/**
* Register an ATA drive behind an IDE like interface
* @param dev The interface device
@@ -322,6 +330,7 @@ int ata_port_register(struct ata_port *port)
}
port->class_dev.parent = port->dev;
+ port->class_dev.info = ata_info;
port->class_dev.detect = ata_detect;
ret = register_device(&port->class_dev);
diff --git a/drivers/ata/disk_bios_drive.c b/drivers/ata/disk_bios_drive.c
index 8e768dc7f2..363af3c6dd 100644
--- a/drivers/ata/disk_bios_drive.c
+++ b/drivers/ata/disk_bios_drive.c
@@ -258,7 +258,7 @@ static int biosdisk_probe(struct device_d *dev)
rc = cdev_find_free_index("disk");
if (rc < 0)
pr_err("Cannot find a free number for the disk node\n");
- m->blk.cdev.name = asprintf("disk%d", rc);
+ m->blk.cdev.name = basprintf("disk%d", rc);
m->blk.blockbits = SECTOR_SHIFT;
rc = blockdevice_register(&m->blk);
diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c
index 6e74bfb089..c3af0833ba 100644
--- a/drivers/ata/intf_platform_ide.c
+++ b/drivers/ata/intf_platform_ide.c
@@ -27,7 +27,7 @@
#include <malloc.h>
#include <errno.h>
#include <ata_drive.h>
-#include <platform_ide.h>
+#include <platform_data/ide.h>
#include <linux/err.h>
#include <of.h>
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index 842957331e..c8098a537f 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -28,7 +28,7 @@
#include <malloc.h>
#include <errno.h>
#include <ata_drive.h>
-#include <platform_ide.h>
+#include <platform_data/ide.h>
#include <io.h>
#include <of.h>
#include <linux/err.h>
diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c
index 6a601956db..7b8036bbf3 100644
--- a/drivers/ata/sata-imx.c
+++ b/drivers/ata/sata-imx.c
@@ -112,7 +112,7 @@ static int imx_sata_probe(struct device_d *dev)
imx_ahci->ahci.dev = dev;
dev->priv = &imx_ahci->ahci;
- dev->info = ahci_info,
+ dev->info = ahci_info;
ret = ahci_add_host(&imx_ahci->ahci);
if (ret)
diff --git a/drivers/bus/omap-gpmc.c b/drivers/bus/omap-gpmc.c
index 8ae909a1b6..be9ef92851 100644
--- a/drivers/bus/omap-gpmc.c
+++ b/drivers/bus/omap-gpmc.c
@@ -446,9 +446,6 @@ static struct dt_eccmode modes[] = {
.name = "hw-romcode",
.mode = OMAP_ECC_HAMMING_CODE_HW_ROMCODE,
}, {
- .name = "bch4",
- .mode = OMAP_ECC_BCH4_CODE_HW,
- }, {
.name = "bch8",
.mode = OMAP_ECC_BCH8_CODE_HW_ROMCODE,
},
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 3c0a7a9d47..a323d25dd4 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -429,7 +429,7 @@ static int at24_probe(struct device_d *dev)
at24->chip = chip;
at24->num_addresses = num_addresses;
- at24->cdev.name = asprintf("eeprom%d", dev->id);
+ at24->cdev.name = basprintf("eeprom%d", dev->id);
at24->cdev.priv = at24;
at24->cdev.dev = dev;
at24->cdev.ops = &at24->fops;
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 282887ba78..2e189fecad 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -41,6 +41,8 @@
#define IMX_SDHCI_WML 0x44
#define IMX_SDHCI_MIXCTRL 0x48
+#define IMX_SDHCI_DLL_CTRL 0x60
+#define IMX_SDHCI_MIX_CTRL_FBCLK_SEL (BIT(25))
struct fsl_esdhc_host {
struct mci_host mci;
@@ -516,11 +518,23 @@ static int esdhc_reset(struct fsl_esdhc_host *host)
{
void __iomem *regs = host->regs;
uint64_t start;
+ int val;
/* reset the controller */
esdhc_write32(regs + SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET,
SYSCTL_RSTA);
+ /* extra register reset for i.MX6 Solo/DualLite */
+ if (cpu_is_mx6()) {
+ /* reset bit FBCLK_SEL */
+ val = esdhc_read32(regs + IMX_SDHCI_MIXCTRL);
+ val &= ~IMX_SDHCI_MIX_CTRL_FBCLK_SEL;
+ esdhc_write32(regs + IMX_SDHCI_MIXCTRL, val);
+
+ /* reset delay line settings in IMX_SDHCI_DLL_CTRL */
+ esdhc_write32(regs + IMX_SDHCI_DLL_CTRL, 0x0);
+ }
+
start = get_time_ns();
/* hardware clears the bit when it is done */
while (1) {
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 24f57f9da9..59f66757d9 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -506,8 +506,8 @@ static int mmc_change_freq(struct mci *mci)
char *name, *partname;
part_size = mci->ext_csd[EXT_CSD_BOOT_MULT] << 17;
- partname = asprintf("boot%d", idx);
- name = asprintf("%s.%s", mci->cdevname, partname);
+ partname = basprintf("boot%d", idx);
+ name = basprintf("%s.%s", mci->cdevname, partname);
mci_part_add(mci, part_size,
EXT_CSD_PART_CONFIG_ACC_BOOT0 + idx,
name, partname, idx, true,
@@ -1626,7 +1626,7 @@ static int mci_card_probe(struct mci *mci)
mci->cdevname = strdup(host->devname);
} else {
disknum = cdev_find_free_index("disk");
- mci->cdevname = asprintf("disk%d", disknum);
+ mci->cdevname = basprintf("disk%d", disknum);
}
rc = mci_startup(mci);
diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c
index 2355651022..446da8ad53 100644
--- a/drivers/mci/mxs.c
+++ b/drivers/mci/mxs.c
@@ -571,7 +571,15 @@ static int mxs_mci_probe(struct device_d *hw_dev)
host->f_min = pd->f_min;
host->f_max = pd->f_max;
} else {
- host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
+ /* fixed to 3.3 V */
+ host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+
+ if (hw_dev->device_node) {
+ const char *alias = of_alias_get(hw_dev->device_node);
+ if (alias)
+ host->devname = xstrdup(alias);
+ }
+
mci_of_parse(host);
}
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index c1e7d9ece4..fb91ffa008 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -141,8 +141,8 @@ static int stmpe_probe(struct device_d *dev)
}
stmpe_dev = xzalloc(sizeof(struct stmpe));
- stmpe_dev->cdev.name = asprintf(DRIVERNAME "%d",
- cdev_find_free_index(DRIVERNAME));
+ stmpe_dev->cdev.name = basprintf(DRIVERNAME"%d",
+ cdev_find_free_index(DRIVERNAME));
stmpe_dev->client = to_i2c_client(dev);
stmpe_dev->cdev.size = 191; /* 191 known registers */
stmpe_dev->cdev.dev = dev;
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 7a5b14697e..6640a70792 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -17,6 +17,7 @@ config SRAM
config STATE_DRV
tristate "state driver"
+ depends on OFDEVICE
depends on STATE
endmenu
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 58b574157a..4fb6f801d2 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -47,8 +47,7 @@ static int sram_probe(struct device_d *dev)
sram = xzalloc(sizeof(*sram));
- sram->cdev.name = asprintf("sram%d",
- cdev_find_free_index("sram"));
+ sram->cdev.name = basprintf("sram%d", cdev_find_free_index("sram"));
res = dev_get_resource(dev, IORESOURCE_MEM, 0);
if (IS_ERR(res))
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index dcf94bfc0d..6d04b88553 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -470,10 +470,10 @@ static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char
static char *print_size(uint64_t s)
{
if (!(s & ((1 << 20) - 1)))
- return asprintf("%lldM", s >> 20);
+ return basprintf("%lldM", s >> 20);
if (!(s & ((1 << 10) - 1)))
- return asprintf("%lldk", s >> 10);
- return asprintf("0x%lld", s);
+ return basprintf("%lldk", s >> 10);
+ return basprintf("0x%lld", s);
}
static int print_part(char *buf, int bufsize, struct mtd_info *mtd, uint64_t last_ofs,
@@ -577,7 +577,8 @@ static int of_mtd_fixup(struct device_node *root, void *ctx)
list_for_each_entry(partmtd, &mtd->partitions, partitions_entry) {
int na, ns, len = 0;
- char *name = asprintf("partition@%0llx", partmtd->master_offset);
+ char *name = basprintf("partition@%0llx",
+ partmtd->master_offset);
void *p;
u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */
@@ -675,7 +676,8 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id)
if (device_id == DEVICE_ID_SINGLE)
mtd->cdev.name = xstrdup(devname);
else
- mtd->cdev.name = asprintf("%s%d", devname, mtd->class_dev.id);
+ mtd->cdev.name = basprintf("%s%d", devname,
+ mtd->class_dev.id);
INIT_LIST_HEAD(&mtd->partitions);
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 6a9bc74847..a40ba25632 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1058,8 +1058,8 @@ static void __init doc_set_driver_info(int chip_id, struct mtd_info *mtd)
switch (chip_id) {
case DOC_CHIPID_G3:
- mtd->name = asprintf("DiskOnChip G3 floor %d",
- docg3->device_id);
+ mtd->name = basprintf("DiskOnChip G3 floor %d",
+ docg3->device_id);
docg3->max_block = 2047;
break;
}
diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c
index 4dcf2f5915..86076f028d 100644
--- a/drivers/mtd/mtdoob.c
+++ b/drivers/mtd/mtdoob.c
@@ -79,7 +79,7 @@ static int add_mtdoob_device(struct mtd_info *mtd, const char *devname, void **p
mtdoob = xzalloc(sizeof(*mtdoob));
mtdoob->cdev.ops = &mtd_ops_oob;
mtdoob->cdev.size = mtd_div_by_wb(mtd->size, mtd) * mtd->oobsize;
- mtdoob->cdev.name = asprintf("%s.oob", mtd->cdev.name);
+ mtdoob->cdev.name = basprintf("%s.oob", mtd->cdev.name);
mtdoob->cdev.priv = mtdoob;
mtdoob->cdev.dev = &mtd->class_dev;
mtdoob->mtd = mtd;
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 4d6ac72bd9..b06eb18f3f 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -308,7 +308,7 @@ static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **p
mtdraw->cdev.ops = (struct file_operations *)&mtd_raw_fops;
mtdraw->cdev.size = mtd_div_by_wb(mtd->size, mtd) *
(mtd->writesize + mtd->oobsize);
- mtdraw->cdev.name = asprintf("%s.raw", mtd->cdev.name);
+ mtdraw->cdev.name = basprintf("%s.raw", mtd->cdev.name);
mtdraw->cdev.priv = mtdraw;
mtdraw->cdev.dev = &mtd->class_dev;
mtdraw->cdev.mtd = mtd;
diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index e6d42772b3..015f8dc524 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -288,7 +288,7 @@ struct cdev *mtd_add_bb(struct mtd_info *mtd, const char *name)
if (name)
bb->cdev.name = xstrdup(name);
else
- bb->cdev.name = asprintf("%s.bb", mtd->cdev.name);
+ bb->cdev.name = basprintf("%s.bb", mtd->cdev.name);
nand_bb_calc_size(bb);
bb->cdev.ops = &nand_bb_ops;
diff --git a/drivers/mtd/nand/nand_imx_bbm.c b/drivers/mtd/nand/nand_imx_bbm.c
index 5caa0a26c3..251dfe5d3f 100644
--- a/drivers/mtd/nand/nand_imx_bbm.c
+++ b/drivers/mtd/nand/nand_imx_bbm.c
@@ -188,7 +188,7 @@ static int do_imx_nand_bbm(int argc, char *argv[])
int c;
printf("create flash bbt (y/n)?");
- c = getc();
+ c = getchar();
if (c == 'y')
yes = 1;
printf("\n");
diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index a920522939..a4e645201f 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -86,7 +86,9 @@
#define GPMC_ECC_SIZE_CONFIG_ECCSIZE1(x) ((x) << 22)
#define BCH8_MAX_ERROR 8 /* upto 8 bit correctable */
-#define BCH4_MAX_ERROR 4 /* upto 4 bit correctable */
+
+static const uint8_t bch8_vector[] = {0xf3, 0xdb, 0x14, 0x16, 0x8b, 0xd2,
+ 0xbe, 0xcc, 0xac, 0x6b, 0xff, 0x99, 0x7b};
int omap_gpmc_decode_bch(int select_4_8, unsigned char *ecc, unsigned int *err_loc);
@@ -239,9 +241,6 @@ static int __omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
int ecc_size = 8;
switch (oinfo->ecc_mode) {
- case OMAP_ECC_BCH4_CODE_HW:
- ecc_size = 4;
- /* fall through */
case OMAP_ECC_BCH8_CODE_HW:
case OMAP_ECC_BCH8_CODE_HW_ROMCODE:
for (i = 0; i < 4; i++) {
@@ -298,26 +297,26 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat,
{
struct nand_chip *nand = (struct nand_chip *)(mtd->priv);
struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand->priv);
- int i, j, eccflag, count, totalcount, actual_eccsize;
+ int i, j, eccflag, totalcount, actual_eccsize;
+ const uint8_t *erased_ecc_vec;
unsigned int err_loc[8];
- int select_4_8;
+ int bitflip_count;
+ int bch_max_err;
int eccsteps = oinfo->nand.ecc.steps;
int eccsize = oinfo->nand.ecc.bytes;
switch (oinfo->ecc_mode) {
- case OMAP_ECC_BCH4_CODE_HW:
- actual_eccsize = eccsize;
- select_4_8 = 0;
- break;
case OMAP_ECC_BCH8_CODE_HW:
eccsize /= eccsteps;
actual_eccsize = eccsize;
- select_4_8 = 1;
+ erased_ecc_vec = bch8_vector;
+ bch_max_err = BCH8_MAX_ERROR;
break;
case OMAP_ECC_BCH8_CODE_HW_ROMCODE:
actual_eccsize = eccsize - 1;
- select_4_8 = 1;
+ erased_ecc_vec = bch8_vector;
+ bch_max_err = BCH8_MAX_ERROR;
break;
default:
dev_err(oinfo->pdev, "invalid driver configuration\n");
@@ -327,37 +326,49 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat,
totalcount = 0;
for (i = 0; i < eccsteps; i++) {
- /* check if any ecc error */
+ bool is_error_reported = false;
+ bitflip_count = 0;
eccflag = 0;
+
+ /* check for any ecc error */
for (j = 0; (j < actual_eccsize) && (eccflag == 0); j++) {
- if (calc_ecc[j] != 0)
+ if (calc_ecc[j] != 0) {
eccflag = 1;
+ break;
+ }
}
if (eccflag == 1) {
- eccflag = 0;
- for (j = 0; (j < actual_eccsize) &&
- (eccflag == 0); j++)
- if (read_ecc[j] != 0xFF)
- eccflag = 1;
+ if (memcmp(calc_ecc, erased_ecc_vec, actual_eccsize) == 0) {
+ /*
+ * calc_ecc[] matches pattern for ECC
+ * (all 0xff) so this is definitely
+ * an erased-page
+ */
+ } else {
+ bitflip_count = nand_check_erased_ecc_chunk(
+ dat, oinfo->nand.ecc.size, read_ecc,
+ eccsize, NULL, 0, bch_max_err);
+ if (bitflip_count < 0)
+ is_error_reported = true;
+ }
}
- count = 0;
- if (eccflag == 1) {
- count = omap_gpmc_decode_bch(select_4_8, calc_ecc, err_loc);
- if (count < 0)
- return count;
- else
- totalcount += count;
- }
+ if (is_error_reported) {
+ bitflip_count = omap_gpmc_decode_bch(1,
+ calc_ecc, err_loc);
+ if (bitflip_count < 0)
+ return bitflip_count;
- for (j = 0; j < count; j++) {
- if (err_loc[j] < 4096)
- dat[err_loc[j] >> 3] ^=
+ for (j = 0; j < bitflip_count; j++) {
+ if (err_loc[j] < 4096)
+ dat[err_loc[j] >> 3] ^=
1 << (err_loc[j] & 7);
- /* else, not interested to correct ecc */
+ /* else, not interested to correct ecc */
+ }
}
+ totalcount += bitflip_count;
calc_ecc = calc_ecc + actual_eccsize;
read_ecc = read_ecc + eccsize;
dat += 512;
@@ -435,7 +446,6 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
switch (oinfo->ecc_mode) {
case OMAP_ECC_HAMMING_CODE_HW_ROMCODE:
return omap_correct_hamming(mtd, dat, read_ecc, calc_ecc);
- case OMAP_ECC_BCH4_CODE_HW:
case OMAP_ECC_BCH8_CODE_HW:
case OMAP_ECC_BCH8_CODE_HW_ROMCODE:
/*
@@ -463,17 +473,6 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
int cs = 0;
switch (oinfo->ecc_mode) {
- case OMAP_ECC_BCH4_CODE_HW:
- if (mode == NAND_ECC_READ) {
- eccsize1 = 0xD; eccsize0 = 0x48;
- bch_mod = 0;
- bch_wrapmode = 0x09;
- } else {
- eccsize1 = 0x20; eccsize0 = 0x00;
- bch_mod = 0;
- bch_wrapmode = 0x06;
- }
- break;
case OMAP_ECC_BCH8_CODE_HW:
case OMAP_ECC_BCH8_CODE_HW_ROMCODE:
if (mode == NAND_ECC_READ) {
@@ -764,17 +763,6 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
omap_oobinfo.oobfree->length = minfo->oobsize -
offset - omap_oobinfo.eccbytes;
break;
- case OMAP_ECC_BCH4_CODE_HW:
- oinfo->nand.ecc.bytes = 7;
- oinfo->nand.ecc.size = 512;
- oinfo->nand.ecc.strength = BCH4_MAX_ERROR;
- omap_oobinfo.oobfree->offset = offset;
- omap_oobinfo.oobfree->length = minfo->oobsize -
- offset - omap_oobinfo.eccbytes;
- offset = minfo->oobsize - oinfo->nand.ecc.bytes;
- for (i = 0; i < oinfo->nand.ecc.bytes; i++)
- omap_oobinfo.eccpos[i] = i + offset;
- break;
case OMAP_ECC_BCH8_CODE_HW:
oinfo->nand.ecc.bytes = 13 * 4;
oinfo->nand.ecc.size = 512 * 4;
diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c
index c26a2455b2..ad38e69ea5 100644
--- a/drivers/mtd/ubi/barebox.c
+++ b/drivers/mtd/ubi/barebox.c
@@ -176,7 +176,7 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
priv->ubi = ubi;
cdev->ops = &ubi_volume_fops;
- cdev->name = asprintf("%s.%s", ubi->cdev.name, vol->name);
+ cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name);
cdev->priv = priv;
cdev->size = vol->used_bytes;
cdev->dev = &vol->dev;
@@ -239,7 +239,7 @@ int ubi_cdev_add(struct ubi_device *ubi)
int ret;
cdev->ops = &ubi_fops;
- cdev->name = asprintf("%s.ubi", ubi->mtd->cdev.name);
+ cdev->name = basprintf("%s.ubi", ubi->mtd->cdev.name);
cdev->priv = ubi;
cdev->size = 0;
diff --git a/drivers/mtd/ubi/ubi-barebox.h b/drivers/mtd/ubi/ubi-barebox.h
index ab970aa19d..557ad88316 100644
--- a/drivers/mtd/ubi/ubi-barebox.h
+++ b/drivers/mtd/ubi/ubi-barebox.h
@@ -16,6 +16,7 @@
#include <common.h>
#include <malloc.h>
+#include <crc.h>
#include <asm-generic/div64.h>
#include <errno.h>
#include <linux/err.h>
@@ -26,7 +27,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/ubi.h>
-#define crc32(seed, data, length) crc32_no_comp(seed, (unsigned char const *)data, length)
+#define crc32(seed, data, length) crc32_no_comp(seed, (unsigned char * const)data, length)
/* configurable */
#define CONFIG_MTD_UBI_WL_THRESHOLD 4096
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index a8ed0d7710..471d784234 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -20,6 +20,7 @@
#include <common.h>
#include <malloc.h>
+#include <crc.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/rbtree.h>
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 1e67c7a8e7..316b971742 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -533,7 +533,7 @@ static int tse_probe(struct device_d *dev)
}
#endif
- memset(rx_desc, 0, (sizeof *rx_desc) * (PKTBUFSRX + 1));
+ memset(rx_desc, 0, (sizeof *rx_desc) * (PKTBUFSRX + 1));
memset(tx_desc, 0, (sizeof *tx_desc) * 2);
iores = dev_request_mem_resource(dev, 0);
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 3dc4b16b67..75a917a76d 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -49,7 +49,7 @@
#include <asm/system.h>
#include <linux/phy.h>
#include <mach/emac_defs.h>
-#include <net/davinci_emac.h>
+#include <platform_data/eth-davinci-emac.h>
#include "davinci_emac.h"
struct davinci_emac_priv {
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 3b21244478..1d662a71d9 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -27,7 +27,7 @@
#include <io.h>
#include <net.h>
#include <of_net.h>
-#include <net/designware.h>
+#include <platform_data/eth-designware.h>
#include <linux/phy.h>
#include <linux/err.h>
#include "designware.h"
diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index ad402e3efc..acc0abbc48 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -29,7 +29,7 @@
#include <net.h>
#include <io.h>
#include <xfuncs.h>
-#include <dm9000.h>
+#include <platform_data/eth-dm9000.h>
#include <errno.h>
#include <linux/phy.h>
diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c
index 0acb9b692f..fd725a56ee 100644
--- a/drivers/net/ep93xx.c
+++ b/drivers/net/ep93xx.c
@@ -38,7 +38,7 @@
#include <linux/types.h>
#include <mach/ep93xx-regs.h>
#include <linux/phy.h>
-#include <net/ep93xx_eth.h>
+#include <platform_data/eth-ep93xx.h>
#include "ep93xx.h"
#define EP93XX_MAX_PKT_SIZE 1536
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 83fdec66d7..8bc7c2993a 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -20,7 +20,7 @@
#include <net.h>
#include <init.h>
#include <driver.h>
-#include <fec.h>
+#include <platform_data/eth-fec.h>
#include <io.h>
#include <clock.h>
#include <xfuncs.h>
diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h
index 0921b52bae..1947e60f69 100644
--- a/drivers/net/fec_imx.h
+++ b/drivers/net/fec_imx.h
@@ -193,7 +193,7 @@ static inline int fec_is_imx6(struct fec_priv *priv)
#define FEC_RBD_SH 0x0008 /**< Receive BD status: Short frame */
#define FEC_RBD_CR 0x0004 /**< Receive BD status: CRC error */
#define FEC_RBD_OV 0x0002 /**< Receive BD status: Receive FIFO overrun */
-#define FEC_RBD_TR 0x0001 /**< Receive BD status: Frame is truncated */
+#define FEC_RBD_TR 0x0001 /**< Receive BD status: Frame is truncated */
#define FEC_RBD_ERR (FEC_RBD_LG | FEC_RBD_NO | FEC_RBD_CR | \
FEC_RBD_OV | FEC_RBD_TR)
diff --git a/drivers/net/fec_mpc5200.c b/drivers/net/fec_mpc5200.c
index bb57c34502..b99c23f7d4 100644
--- a/drivers/net/fec_mpc5200.c
+++ b/drivers/net/fec_mpc5200.c
@@ -10,7 +10,7 @@
#include <mach/mpc5xxx.h>
#include <malloc.h>
#include <net.h>
-#include <fec.h>
+#include <platform_data/eth-fec.h>
#include <init.h>
#include <driver.h>
#include <mach/sdma.h>
diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c
index 3ca85fb3f3..860af448ea 100644
--- a/drivers/net/ksz8864rmn.c
+++ b/drivers/net/ksz8864rmn.c
@@ -149,7 +149,7 @@ static int micrel_switch_probe(struct device_d *dev)
return -ENODEV;
}
- priv->cdev.name = asprintf("switch%d", dev->id);
+ priv->cdev.name = basprintf("switch%d", dev->id);
priv->cdev.size = 256;
priv->cdev.ops = &micrel_switch_ops;
priv->cdev.priv = priv;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index be2c68bf68..73176fbc04 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -52,9 +52,11 @@ int phy_update_status(struct phy_device *phydev)
int ret;
int oldspeed = phydev->speed, oldduplex = phydev->duplex;
- ret = drv->read_status(phydev);
- if (ret)
- return ret;
+ if (drv) {
+ ret = drv->read_status(phydev);
+ if (ret)
+ return ret;
+ }
if (phydev->speed == oldspeed && phydev->duplex == oldduplex)
return 0;
@@ -173,10 +175,15 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id)
phydev->bus = bus;
phydev->dev.bus = &mdio_bus_type;
- sprintf(phydev->dev.name, "mdio%d-phy%02x",
+ if (bus) {
+ sprintf(phydev->dev.name, "mdio%d-phy%02x",
phydev->bus->dev.id,
phydev->addr);
- phydev->dev.id = DEVICE_ID_SINGLE;
+ phydev->dev.id = DEVICE_ID_SINGLE;
+ } else {
+ sprintf(phydev->dev.name, "fixed-phy");
+ phydev->dev.id = DEVICE_ID_DYNAMIC;
+ }
return phydev;
}
@@ -245,7 +252,9 @@ static void phy_config_aneg(struct phy_device *phydev)
struct phy_driver *drv;
drv = to_phy_driver(phydev->dev.driver);
- drv->config_aneg(phydev);
+
+ if (drv)
+ drv->config_aneg(phydev);
}
int phy_register_device(struct phy_device *phydev)
@@ -255,13 +264,15 @@ int phy_register_device(struct phy_device *phydev)
if (phydev->registered)
return -EBUSY;
- phydev->dev.parent = &phydev->bus->dev;
+ if (!phydev->dev.parent)
+ phydev->dev.parent = &phydev->bus->dev;
ret = register_device(&phydev->dev);
if (ret)
return ret;
- phydev->bus->phy_map[phydev->addr] = phydev;
+ if (phydev->bus)
+ phydev->bus->phy_map[phydev->addr] = phydev;
phydev->registered = 1;
@@ -289,6 +300,22 @@ void phy_unregister_device(struct phy_device *phydev)
phydev->registered = 0;
}
+struct phy_device *of_phy_register_fixed_link(struct device_node *np, struct eth_device *edev)
+{
+ struct phy_device *phydev;
+
+ phydev = phy_device_create(NULL, 0, 0);
+
+ phydev->dev.parent = &edev->dev;
+ phydev->registered = 1;
+ phydev->speed = 1000;
+ phydev->duplex = 1;
+ phydev->pause = phydev->asym_pause = 0;
+ phydev->link = 1;
+
+ return phydev;
+}
+
static struct phy_device *of_mdio_find_phy(struct eth_device *edev)
{
struct device_d *dev;
@@ -305,6 +332,12 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev)
phy_node = of_parse_phandle(edev->parent->device_node, "phy", 0);
if (!phy_node)
phy_node = of_parse_phandle(edev->parent->device_node, "phy-device", 0);
+ if (!phy_node) {
+ phy_node = of_get_child_by_name(edev->parent->device_node, "fixed-link");
+ if (phy_node)
+ return of_phy_register_fixed_link(phy_node, edev);
+ }
+
if (!phy_node)
return NULL;
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index b7055910eb..e08e3dd1b5 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -67,7 +67,7 @@
#include <io.h>
#include <linux/phy.h>
#include <linux/err.h>
-#include <net/smc91111.h>
+#include <platform_data/eth-smc91111.h>
/*---------------------------------------------------------------
.
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 9b1a38ae21..fe9d1df502 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -28,7 +28,7 @@
#include <errno.h>
#include <clock.h>
#include <io.h>
-#include <smc911x.h>
+#include <platform_data/eth-smc911x.h>
#include <linux/phy.h>
#include "smc911x.h"
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index 8540a84344..3bf2af9c35 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -186,7 +186,7 @@
#define RX_DP_CTRL_RX_FFWD 0x80000000 /* R/W */
#define RX_DP_CTRL_FFWD_BUSY 0x80000000 /* RO */
-#define RX_FIFO_INF 0x7C
+#define RX_FIFO_INF 0x7C
#define RX_FIFO_INF_RXSUSED 0x00FF0000 /* RO */
#define RX_FIFO_INF_RXDUSED 0x0000FFFF /* RO */
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index f31bb293fb..ec43870061 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -1,8 +1,8 @@
-obj-y += address.o base.o fdt.o platform.o device.o
+obj-y += address.o base.o fdt.o platform.o of_path.o device.o
obj-$(CONFIG_OFTREE_MEM_GENERIC) += mem_generic.o
obj-$(CONFIG_OF_GPIO) += of_gpio.o
obj-$(CONFIG_OF_PCI) += of_pci.o
obj-y += partition.o
obj-y += of_net.o
obj-$(CONFIG_MTD) += of_mtd.o
-obj-$(CONFIG_OF_BAREBOX_DRIVERS) += barebox.o of_path.o
+obj-$(CONFIG_OF_BAREBOX_DRIVERS) += barebox.o
diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c
index 125feef2cc..64f483326d 100644
--- a/drivers/of/barebox.c
+++ b/drivers/of/barebox.c
@@ -61,7 +61,7 @@ static int environment_check_mount(struct device_d *dev, char **devpath)
/* Set env to be in a file on the now mounted device */
dev_dbg(dev, "Loading default env from %s on device %s\n",
filepath, *devpath);
- *devpath = asprintf("%s/%s", ENV_MNT_DIR, filepath);
+ *devpath = basprintf("%s/%s", ENV_MNT_DIR, filepath);
return 0;
}
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d12bfe328a..cbe7b7cec4 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -30,6 +30,8 @@
#include <linux/amba/bus.h>
#include <linux/err.h>
+static struct device_node *root_node;
+
/*
* Iterate over all nodes of a tree. As a devicetree does not
* have a dedicated list head, the start node (usually the root
@@ -39,6 +41,9 @@ static inline struct device_node *of_next_node(struct device_node *node)
{
struct device_node *next;
+ if (!node)
+ return root_node;
+
next = list_first_entry(&node->list, struct device_node, list);
return next->parent ? next : NULL;
@@ -68,8 +73,6 @@ struct alias_prop {
static LIST_HEAD(aliases_lookup);
-static struct device_node *root_node;
-
static struct device_node *of_aliases;
#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
@@ -277,12 +280,6 @@ struct device_node *of_find_node_by_phandle_from(phandle phandle,
{
struct device_node *node;
- if (!root)
- root = root_node;
-
- if (!root)
- return NULL;
-
of_tree_for_each_node_from(node, root)
if (node->phandle == phandle)
return node;
@@ -309,15 +306,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
phandle of_get_tree_max_phandle(struct device_node *root)
{
struct device_node *n;
- phandle max;
-
- if (!root)
- root = root_node;
-
- if (!root)
- return 0;
-
- max = root->phandle;
+ phandle max = 0;
of_tree_for_each_node_from(n, root) {
if (n->phandle > max)
@@ -430,9 +419,6 @@ struct device_node *of_find_node_by_name(struct device_node *from,
{
struct device_node *np;
- if (!from)
- from = root_node;
-
of_tree_for_each_node_from(np, from)
if (np->name && !of_node_cmp(np->name, name))
return np;
@@ -458,9 +444,6 @@ struct device_node *of_find_node_by_type(struct device_node *from,
const char *device_type;
int ret;
- if (!from)
- from = root_node;
-
of_tree_for_each_node_from(np, from) {
ret = of_property_read_string(np, "device_type", &device_type);
if (!ret && !of_node_cmp(device_type, type))
@@ -489,9 +472,6 @@ struct device_node *of_find_compatible_node(struct device_node *from,
{
struct device_node *np;
- if (!from)
- from = root_node;
-
of_tree_for_each_node_from(np, from)
if (of_device_is_compatible(np, compatible))
return np;
@@ -516,9 +496,6 @@ struct device_node *of_find_node_with_property(struct device_node *from,
{
struct device_node *np;
- if (!from)
- from = root_node;
-
of_tree_for_each_node_from(np, from) {
struct property *pp = of_find_property(np, prop_name, NULL);
if (pp)
@@ -572,9 +549,6 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
if (match)
*match = NULL;
- if (!from)
- from = root_node;
-
of_tree_for_each_node_from(np, from) {
const struct of_device_id *m = of_match_node(matches, np);
if (m) {
@@ -1702,7 +1676,8 @@ struct device_node *of_new_node(struct device_node *parent, const char *name)
if (parent) {
node->name = xstrdup(name);
- node->full_name = asprintf("%s/%s", node->parent->full_name, name);
+ node->full_name = basprintf("%s/%s",
+ node->parent->full_name, name);
list_add(&node->list, &parent->list);
} else {
node->name = xstrdup("");
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 88f0523260..b2253aa7a2 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -46,6 +46,70 @@ static inline char *dt_string(struct fdt_header *f, char *strstart, uint32_t ofs
return strstart + ofs;
}
+static int of_reservemap_num_entries(const struct fdt_header *fdt)
+{
+ const struct fdt_reserve_entry *r;
+ int n = 0;
+
+ r = (void *)fdt + be32_to_cpu(fdt->off_mem_rsvmap);
+
+ while (r->size) {
+ n++;
+ r++;
+ if (n == OF_MAX_RESERVE_MAP)
+ return -EINVAL;
+ }
+
+ return n;
+}
+
+/**
+ * of_unflatten_reservemap - store /memreserve/ entries in unflattened tree
+ * @root - The unflattened tree
+ * @fdt - the flattened device tree blob
+ *
+ * This stores the memreserve entries from the dtb in a newly created
+ * /memserve node in the unflattened device tree. The device tree
+ * flatten code moves the entries back to the /memreserve/ area in the
+ * flattened tree.
+ *
+ * Return: 0 for success or negative error code
+ */
+static int of_unflatten_reservemap(struct device_node *root,
+ const struct fdt_header *fdt)
+{
+ int n;
+ struct property *p;
+ struct device_node *memreserve;
+ __be32 cells;
+
+ n = of_reservemap_num_entries(fdt);
+ if (n <= 0)
+ return n;
+
+ memreserve = of_new_node(root, "memreserve");
+ if (!memreserve)
+ return -ENOMEM;
+
+ cells = cpu_to_be32(2);
+
+ p = of_new_property(memreserve, "#address-cells", &cells, sizeof(__be32));
+ if (!p)
+ return -ENOMEM;
+
+ p = of_new_property(memreserve, "#size-cells", &cells, sizeof(__be32));
+ if (!p)
+ return -ENOMEM;
+
+ p = of_new_property(memreserve, "reg",
+ (void *)fdt + be32_to_cpu(fdt->off_mem_rsvmap),
+ n * sizeof(struct fdt_reserve_entry));
+ if (!p)
+ return -ENOMEM;
+
+ return 0;
+}
+
/**
* of_unflatten_dtb - unflatten a dtb binary blob
* @infdt - the fdt blob to unflatten
@@ -103,6 +167,10 @@ struct device_node *of_unflatten_dtb(const void *infdt)
if (!root)
return ERR_PTR(-ENOMEM);
+ ret = of_unflatten_reservemap(root, fdt);
+ if (ret)
+ goto err;
+
while (1) {
tag = be32_to_cpu(*(uint32_t *)(infdt + dt_struct));
@@ -289,7 +357,7 @@ static inline int dt_add_string(struct fdt *fdt, const char *str)
return ret;
}
-static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node)
+static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node, int is_root)
{
struct property *p;
struct device_node *n;
@@ -322,7 +390,10 @@ static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node)
}
list_for_each_entry(n, &node->children, parent_list) {
- ret = __of_flatten_dtb(fdt, n);
+ if (is_root && !strcmp(n->name, "memreserve"))
+ continue;
+
+ ret = __of_flatten_dtb(fdt, n, 0);
if (ret)
return ret;
}
@@ -347,8 +418,10 @@ void *of_flatten_dtb(struct device_node *node)
int ret;
struct fdt_header header = {};
struct fdt fdt = {};
- uint32_t ofs;
+ uint32_t ofs, off_mem_rsvmap;
struct fdt_node_header *nh;
+ struct device_node *memreserve;
+ int len;
header.magic = cpu_to_fdt32(FDT_MAGIC);
header.version = cpu_to_fdt32(0x11);
@@ -364,14 +437,24 @@ void *of_flatten_dtb(struct device_node *node)
ofs = sizeof(struct fdt_header);
- header.off_mem_rsvmap = cpu_to_fdt32(ofs);
+ off_mem_rsvmap = ofs;
+ header.off_mem_rsvmap = cpu_to_fdt32(off_mem_rsvmap);
ofs += sizeof(struct fdt_reserve_entry) * OF_MAX_RESERVE_MAP;
fdt.dt_nextofs = ofs;
- ret = __of_flatten_dtb(&fdt, node);
+ ret = __of_flatten_dtb(&fdt, node, 1);
if (ret)
goto out_free;
+
+ memreserve = of_find_node_by_name(node, "memreserve");
+ if (memreserve) {
+ const void *entries = of_get_property(memreserve, "reg", &len);
+
+ if (entries)
+ memcpy(fdt.dt + off_mem_rsvmap, entries, len);
+ }
+
nh = fdt.dt + fdt.dt_nextofs;
nh->tag = cpu_to_fdt32(FDT_END);
fdt.dt_nextofs = dt_next_ofs(fdt.dt_nextofs, sizeof(struct fdt_node_header));
@@ -453,7 +536,18 @@ void fdt_add_reserve_map(void *__fdt)
struct of_reserve_map *res = &of_reserve_map;
struct fdt_reserve_entry *fdt_res =
__fdt + be32_to_cpu(fdt->off_mem_rsvmap);
- int i;
+ int i, n;
+
+ n = of_reservemap_num_entries(fdt);
+ if (n < 0)
+ return;
+
+ if (n + res->num_entries + 2 > OF_MAX_FREE_RESERVE_MAP) {
+ pr_err("Too many entries in reserve map\n");
+ return;
+ }
+
+ fdt_res += n;
for (i = 0; i < res->num_entries; i++) {
of_write_number(&fdt_res->address, res->start[i], 2);
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index ed620f1755..8e1931f939 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -75,7 +75,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
mtd_can_have_bb(cdev->mtd))
add_bb = true;
- *outpath = asprintf("/dev/%s%s", cdev->name, add_bb ? ".bb" : "");
+ *outpath = basprintf("/dev/%s%s", cdev->name, add_bb ? ".bb" : "");
return 0;
}
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 6017897b02..b6621f7dad 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -58,7 +58,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
if (of_get_property(node, "read-only", &len))
flags = DEVFS_PARTITION_READONLY;
- filename = asprintf("%s.%s", cdev->name, partname);
+ filename = basprintf("%s.%s", cdev->name, partname);
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
if (IS_ERR(new))
diff --git a/drivers/pci/pci-mvebu.c b/drivers/pci/pci-mvebu.c
index da2459bafe..907bda0f96 100644
--- a/drivers/pci/pci-mvebu.c
+++ b/drivers/pci/pci-mvebu.c
@@ -306,7 +306,7 @@ static struct mvebu_pcie *mvebu_pcie_port_probe(struct device_d *dev,
reset_gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags);
if (gpio_is_valid(reset_gpio)) {
int reset_active_low = flags & OF_GPIO_ACTIVE_LOW;
- char *reset_name = asprintf("pcie%d.%d-reset", port, lane);
+ char *reset_name = basprintf("pcie%d.%d-reset", port, lane);
u32 reset_udelay = 20000;
of_property_read_u32(np, "reset-delay-us", &reset_udelay);
@@ -326,7 +326,7 @@ static struct mvebu_pcie *mvebu_pcie_port_probe(struct device_d *dev,
pcie->port = port;
pcie->lane = lane;
pcie->lane_mask = lane_mask;
- pcie->name = asprintf("pcie%d.%d", port, lane);
+ pcie->name = basprintf("pcie%d.%d", port, lane);
pcie->devfn = devfn;
pcie->base = of_iomap(np, 0);
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index ec0aaec67f..fa1176fe1b 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -89,8 +89,8 @@ static int mxs_pinctrl_set_state(struct pinctrl_device *pdev, struct device_node
writel(0x3 << shift, reg + STMP_OFFSET_REG_CLR);
writel(muxsel << shift, reg + STMP_OFFSET_REG_SET);
- dev_dbg(iomux->pinctrl.dev, "pin %d, mux %d, ma: %d, vol: %d, pull: %d\n",
- pinid, muxsel, ma, vol, pull);
+ dev_dbg(iomux->pinctrl.dev, "(val: 0x%x) pin %d, mux %d, ma: %d, vol: %d, pull: %d\n",
+ val, pinid, muxsel, ma, vol, pull);
/* drive */
reg = iomux->base + 0x300;
diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c
index 10ce186a12..e7b08a2bfe 100644
--- a/drivers/pinctrl/pinctrl.c
+++ b/drivers/pinctrl/pinctrl.c
@@ -68,7 +68,7 @@ int of_pinctrl_select_state(struct device_node *np, const char *name)
/* For each defined state ID */
for (state = 0; ; state++) {
/* Retrieve the pinctrl-* property */
- propname = asprintf("pinctrl-%d", state);
+ propname = basprintf("pinctrl-%d", state);
prop = of_find_property(np, propname, NULL);
free(propname);
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 0845c234fe..b620e502f2 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -236,9 +236,10 @@ static int imx_pwm_probe(struct device_d *dev)
if (dev->device_node) {
imx->chip.devname = of_alias_get(dev->device_node);
if (!imx->chip.devname)
- imx->chip.devname = asprintf("pwm_%p", imx->mmio_base);
+ imx->chip.devname = basprintf("pwm_%p",
+ imx->mmio_base);
} else {
- imx->chip.devname = asprintf("pwm%d", dev->id);
+ imx->chip.devname = basprintf("pwm%d", dev->id);
}
imx->config = data->config;
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 011d9002ba..e72f1dbcb0 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -143,7 +143,7 @@ static int mxs_pwm_probe(struct device_d *dev)
struct mxs_pwm_chip *mxspwm = &mxs->pwm[i];
mxspwm->chip.ops = &mxs_pwm_ops;
- mxspwm->chip.devname = asprintf("pwm%d", i);
+ mxspwm->chip.devname = basprintf("pwm%d", i);
mxspwm->chip.id = i;
mxspwm->mxs = mxs;
diff --git a/drivers/pwm/pxa_pwm.c b/drivers/pwm/pxa_pwm.c
index e399d03efd..c7130c225e 100644
--- a/drivers/pwm/pxa_pwm.c
+++ b/drivers/pwm/pxa_pwm.c
@@ -134,7 +134,7 @@ static int pxa_pwm_probe(struct device_d *dev)
struct pxa_pwm_chip *chip;
chip = xzalloc(sizeof(*chip));
- chip->chip.devname = asprintf("pwm%d", dev->id);
+ chip->chip.devname = basprintf("pwm%d", dev->id);
chip->chip.ops = &pxa_pwm_ops;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 73f5c6eb4b..39df980dcb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -153,7 +153,7 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
struct regulator_internal *ri;
struct device_node *node;
- propname = asprintf("%s-supply", supply);
+ propname = basprintf("%s-supply", supply);
/*
* If the device does have a device node return the dummy regulator.
diff --git a/drivers/serial/serial_auart.c b/drivers/serial/serial_auart.c
index 9bef576cd7..c3b9a1995f 100644
--- a/drivers/serial/serial_auart.c
+++ b/drivers/serial/serial_auart.c
@@ -230,9 +230,18 @@ static void auart_serial_remove(struct device_d *dev)
free(priv);
}
+static const __maybe_unused struct of_device_id auart_serial_dt_ids[] = {
+ {
+ .compatible = "fsl,imx23-auart",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d auart_serial_driver = {
.name = "auart_serial",
.probe = auart_serial_probe,
.remove = auart_serial_remove,
+ .of_compatible = DRV_OF_COMPAT(auart_serial_dt_ids),
};
console_platform_driver(auart_serial_driver);
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 4ad52ea79c..c6548e3b85 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -41,7 +41,7 @@
#include <linux/clk.h>
#include "serial_ns16550.h"
-#include <ns16550.h>
+#include <platform_data/serial-ns16550.h>
struct ns16550_priv {
struct console_device cdev;
diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c
index 4ea545a282..e37db756f8 100644
--- a/drivers/spi/gpio_spi.c
+++ b/drivers/spi/gpio_spi.c
@@ -209,7 +209,7 @@ static int gpio_spi_probe(struct device_d *dev)
if (!gpio_is_valid(pdata->cs[n]))
continue;
- cs_name = asprintf("spi-cs%d", n);
+ cs_name = basprintf("spi-cs%d", n);
ret = gpio_request_one(pdata->cs[n], GPIOF_DIR_OUT, cs_name);
if (ret)
return ret;
diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 5bd1845fbb..99ec228887 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Sascha Hauer, Pengutronix
+ * Copyright (C) 2008 Sascha Hauer, Pengutronix
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index ba3b9da206..9e38ac4942 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1763,7 +1763,7 @@ EXPORT_SYMBOL_GPL(usb_composite_setup_continue);
static char *composite_default_mfr(struct usb_gadget *gadget)
{
- return asprintf("barebox %s", gadget->name);
+ return basprintf("barebox %s", gadget->name);
}
void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index aaf784913b..859aaff279 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -17,6 +17,7 @@
#define pr_fmt(fmt) "fastboot: " fmt
#include <common.h>
+#include <command.h>
#include <errno.h>
#include <malloc.h>
#include <fcntl.h>
@@ -194,7 +195,7 @@ static void fb_setvar(struct fb_variable *var, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- var->value = vasprintf(fmt, ap);
+ var->value = bvasprintf(fmt, ap);
va_end(ap);
}
@@ -204,7 +205,7 @@ static struct fb_variable *fb_addvar(struct f_fastboot *f_fb, const char *fmt, .
va_list ap;
va_start(ap, fmt);
- var->name = vasprintf(fmt, ap);
+ var->name = bvasprintf(fmt, ap);
va_end(ap);
list_add_tail(&var->list, &f_fb->variables);
@@ -701,7 +702,8 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
if (ret)
goto copy;
- cmd = asprintf("ubiformat -y -f %s %s", FASTBOOT_TMPFILE, filename);
+ cmd = basprintf("ubiformat -y -f %s %s", FASTBOOT_TMPFILE,
+ filename);
fastboot_tx_print(f_fb, "INFOThis is an UBI image...");
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 9d1ffa3070..8218bb2a71 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -397,7 +397,7 @@ static int usb_stor_add_blkdev(struct us_data *us, struct device_d *dev,
pr_err("Cannot find a free number for the disk node\n");
pr_info("Using index %d for the new disk\n", result);
- pblk_dev->blk.cdev.name = asprintf("disk%d", result);
+ pblk_dev->blk.cdev.name = basprintf("disk%d", result);
pblk_dev->blk.blockbits = SECTOR_SHIFT;
result = blockdevice_register(&pblk_dev->blk);
diff --git a/drivers/video/edid.c b/drivers/video/edid.c
index 828c3610ac..e5c32a0c1b 100644
--- a/drivers/video/edid.c
+++ b/drivers/video/edid.c
@@ -469,7 +469,8 @@ static void calc_mode_timings(int xres, int yres, int refresh,
mode->yres = yres;
mode->refresh = refresh;
fb_get_mode(0, refresh, mode);
- mode->name = asprintf("%dx%d@%d-calc", mode->xres, mode->yres, mode->refresh);
+ mode->name = basprintf("%dx%d@%d-calc", mode->xres, mode->yres,
+ mode->refresh);
pr_debug(" %s\n", mode->name);
}
@@ -602,7 +603,8 @@ const struct fb_videomode vesa_modes[] = {
static void add_vesa_mode(struct fb_videomode *mode, int num)
{
*mode = vesa_modes[num];
- mode->name = asprintf("%dx%d@%d-vesa", mode->xres, mode->yres, mode->refresh);
+ mode->name = basprintf("%dx%d@%d-vesa", mode->xres, mode->yres,
+ mode->refresh);
pr_debug(" %s\n", mode->name);
}
@@ -748,7 +750,8 @@ static void get_detailed_timing(unsigned char *block,
pr_debug("%sHSync %sVSync\n", (HSYNC_POSITIVE) ? "+" : "-",
(VSYNC_POSITIVE) ? "+" : "-");
- mode->name = asprintf("%dx%d@%d", mode->xres, mode->yres, mode->refresh);
+ mode->name = basprintf("%dx%d@%d", mode->xres, mode->yres,
+ mode->refresh);
}
/**
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 09bba001fb..4d2d3aa650 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -262,7 +262,7 @@ int register_framebuffer(struct fb_info *info)
info->line_length = info->xres * (info->bits_per_pixel >> 3);
info->cdev.ops = &fb_ops;
- info->cdev.name = asprintf("fb%d", id);
+ info->cdev.name = basprintf("fb%d", id);
info->cdev.size = info->line_length * info->yres;
info->cdev.dev = dev;
info->cdev.priv = info;
diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index 2340b9b1d6..17ae894bf7 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -161,7 +161,7 @@ static int imx6q_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
ipuno = ((di >> 1) & 1) + 1;
dino = di & 0x1;
- clkname = asprintf("ipu%d_di%d_sel", ipuno, dino);
+ clkname = basprintf("ipu%d_di%d_sel", ipuno, dino);
diclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(diclk)) {
@@ -169,7 +169,7 @@ static int imx6q_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
return PTR_ERR(diclk);
}
- clkname = asprintf("ldb_di%d_podf", imx_ldb_ch->chno);
+ clkname = basprintf("ldb_di%d_podf", imx_ldb_ch->chno);
ldbclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(ldbclk)) {
@@ -208,7 +208,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
dino = di & 0x1;
- clkname = asprintf("ipu_di%d_sel", dino);
+ clkname = basprintf("ipu_di%d_sel", dino);
diclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(diclk)) {
@@ -216,7 +216,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di,
return PTR_ERR(diclk);
}
- clkname = asprintf("ldb_di%d_div", imx_ldb_ch->chno);
+ clkname = basprintf("ldb_di%d_div", imx_ldb_ch->chno);
ldbclk = clk_lookup(clkname);
free(clkname);
if (IS_ERR(ldbclk)) {
diff --git a/drivers/video/imx-ipu-v3/ipu-di.c b/drivers/video/imx-ipu-v3/ipu-di.c
index 8df9c9f06b..b6e64fe16a 100644
--- a/drivers/video/imx-ipu-v3/ipu-di.c
+++ b/drivers/video/imx-ipu-v3/ipu-di.c
@@ -732,8 +732,7 @@ int ipu_di_init(struct ipu_soc *ipu, struct device_d *dev, int id,
ipu_di_write(di, 0x10, DI_BS_CLKGEN0);
di->clk_di_pixel.parent_names = di->di_parent_names;
- di->clk_name = asprintf("%s_di%d_pixel",
- dev_name(dev), id);
+ di->clk_name = basprintf("%s_di%d_pixel", dev_name(dev), id);
if (!di->clk_name)
return -ENOMEM;
diff --git a/drivers/video/imx-ipu-v3/ipufb.c b/drivers/video/imx-ipu-v3/ipufb.c
index 747e094789..67fec11d4a 100644
--- a/drivers/video/imx-ipu-v3/ipufb.c
+++ b/drivers/video/imx-ipu-v3/ipufb.c
@@ -284,7 +284,7 @@ static int ipufb_probe(struct device_d *dev)
info = &fbi->info;
ipuid = of_alias_get_id(dev->parent->device_node, "ipu");
- fbi->name = asprintf("ipu%d-di%d", ipuid + 1, pdata->di);
+ fbi->name = basprintf("ipu%d-di%d", ipuid + 1, pdata->di);
fbi->id = ipuid * 2 + pdata->di;
fbi->dino = pdata->di;
diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c
index 30e6e1d496..e3e929670d 100644
--- a/drivers/w1/slaves/w1_ds2431.c
+++ b/drivers/w1/slaves/w1_ds2431.c
@@ -272,7 +272,7 @@ static int ds2431_probe(struct w1_device *dev)
cdev->priv = dev;
cdev->ops = &ds2431_ops;
cdev->size = W1_F2D_EEPROM_SIZE;
- cdev->name = asprintf(DRIVERNAME"%d", ds2431_count++);
+ cdev->name = basprintf(DRIVERNAME"%d", ds2431_count++);
if (cdev->name == NULL)
return -ENOMEM;
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c
index a840d9a2f2..a907c6bf3c 100644
--- a/drivers/w1/slaves/w1_ds2433.c
+++ b/drivers/w1/slaves/w1_ds2433.c
@@ -171,7 +171,7 @@ static int ds2433_cdev_create(struct w1_device *dev, int size, int id)
cdev->priv = dev;
cdev->ops = &ds2433_ops;
cdev->size = size;
- cdev->name = asprintf("%s%d", dev->dev.driver->name, id);
+ cdev->name = basprintf("%s%d", dev->dev.driver->name, id);
if (cdev->name == NULL)
return -ENOMEM;