Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions jtag/zynqMP/src/driver/xvc_driver_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static struct cdev xvc_char_ioc_dev;
#ifndef _XVC_USER_CONFIG_H
#define CONFIG_COUNT 1
#define GET_DB_BY_RES 1
static struct resource *db_res = NULL;
static struct resource *db_res[CONFIG_COUNT] = {NULL};
#endif /* _XVC_USER_CONFIG_H */

static void __iomem * db_ptrs[CONFIG_COUNT];
Expand Down Expand Up @@ -79,10 +79,11 @@ long char_ctrl_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg) {
#ifndef GET_DB_BY_RES
struct db_config config_info = db_configs[char_index];
#else
struct resource *i_db_res = (struct resource*) db_res[char_index];
struct db_config config_info = {
.name = NULL,
.base_addr = db_res ? db_res->start : 0,
.size = db_res ? resource_size(db_res) : 0,
.base_addr = i_db_res ? i_db_res->start : 0,
.size = i_db_res ? resource_size(i_db_res) : 0,
};
#endif
status = xil_xvc_readprops(&config_info, (void __user*)arg);
Expand Down Expand Up @@ -171,19 +172,21 @@ int probe(struct platform_device* pdev) {
#ifndef GET_DB_BY_RES
db_ptrs[i] = ioremap(db_addr, db_size);
#else
db_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (db_res) {
db_addr = db_res->start;
db_size = resource_size(db_res);
db_res[i] = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (db_res[i]) {
db_addr = db_res[i]->start;
db_size = resource_size(db_res[i]);
}
db_ptrs[i] = devm_ioremap_resource(&pdev->dev, db_res);
db_ptrs[i] = devm_ioremap_resource(&pdev->dev, db_res[i]);
#endif
if (!db_ptrs[i] || IS_ERR(db_ptrs[i])) {
printk(KERN_ERR LOG_PREFIX "Failed to remap debug bridge memory at offset 0x%lX, size %lu", db_addr, db_size);
return -ENOMEM;
} else {
printk(KERN_INFO LOG_PREFIX "Mapped debug bridge at offset 0x%lX, size 0x%lX", db_addr, db_size);
}

break;
}
}

Expand All @@ -207,9 +210,9 @@ static void remove(struct platform_device* pdev)
#else
unsigned long db_addr = 0;
unsigned long db_size = 0;
if (db_res) {
db_addr = db_res->start;
db_size = resource_size(db_res);
if (db_res[i]) {
db_addr = db_res[i]->start;
db_size = resource_size(db_res[i]);
}
#endif

Expand Down