1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

store ids for all links in link structure and add devid attribute

This commit is contained in:
Ralph Metzler 2015-09-06 19:08:57 +02:00
parent 4e1b527c35
commit 4f53aa9a1b
5 changed files with 44 additions and 30 deletions

View File

@ -3661,10 +3661,10 @@ static long ddb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct ddb_id ddbid; struct ddb_id ddbid;
ddbid.vendor = dev->ids.vendor; ddbid.vendor = dev->link[0].ids.vendor;
ddbid.device = dev->ids.device; ddbid.device = dev->link[0].ids.device;
ddbid.subvendor = dev->ids.subvendor; ddbid.subvendor = dev->link[0].ids.subvendor;
ddbid.subdevice = dev->ids.subdevice; ddbid.subdevice = dev->link[0].ids.subdevice;
ddbid.hw = ddbreadl(dev, 0); ddbid.hw = ddbreadl(dev, 0);
ddbid.regmap = ddbreadl(dev, 4); ddbid.regmap = ddbreadl(dev, 4);
if (copy_to_user(parg, &ddbid, sizeof(ddbid))) if (copy_to_user(parg, &ddbid, sizeof(ddbid)))
@ -4165,7 +4165,7 @@ static ssize_t version_show(struct device *device,
struct ddb *dev = dev_get_drvdata(device); struct ddb *dev = dev_get_drvdata(device);
return sprintf(buf, "%08x %08x\n", return sprintf(buf, "%08x %08x\n",
dev->ids.hwid, dev->ids.regmapid); dev->link[0].ids.hwid, dev->link[0].ids.regmapid);
} }
static ssize_t hwid_show(struct device *device, static ssize_t hwid_show(struct device *device,
@ -4173,7 +4173,7 @@ static ssize_t hwid_show(struct device *device,
{ {
struct ddb *dev = dev_get_drvdata(device); struct ddb *dev = dev_get_drvdata(device);
return sprintf(buf, "0x%08X\n", dev->ids.hwid); return sprintf(buf, "0x%08X\n", dev->link[0].ids.hwid);
} }
static ssize_t regmap_show(struct device *device, static ssize_t regmap_show(struct device *device,
@ -4181,7 +4181,7 @@ static ssize_t regmap_show(struct device *device,
{ {
struct ddb *dev = dev_get_drvdata(device); struct ddb *dev = dev_get_drvdata(device);
return sprintf(buf, "0x%08X\n", dev->ids.regmapid); return sprintf(buf, "0x%08X\n", dev->link[0].ids.regmapid);
} }
static ssize_t vlan_show(struct device *device, static ssize_t vlan_show(struct device *device,
@ -4218,6 +4218,15 @@ static ssize_t fmode_show(struct device *device,
return sprintf(buf, "%u\n", dev->link[num].lnb.fmode); return sprintf(buf, "%u\n", dev->link[num].lnb.fmode);
} }
static ssize_t devid_show(struct device *device,
struct device_attribute *attr, char *buf)
{
int num = attr->attr.name[5] - 0x30;
struct ddb *dev = dev_get_drvdata(device);
return sprintf(buf, "%08x\n", dev->link[num].ids.devid);
}
static ssize_t fmode_store(struct device *device, struct device_attribute *attr, static ssize_t fmode_store(struct device *device, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
@ -4247,6 +4256,10 @@ static struct device_attribute ddb_attrs[] = {
__ATTR(fmode1, 0664, fmode_show, fmode_store), __ATTR(fmode1, 0664, fmode_show, fmode_store),
__ATTR(fmode2, 0664, fmode_show, fmode_store), __ATTR(fmode2, 0664, fmode_show, fmode_store),
__ATTR(fmode3, 0664, fmode_show, fmode_store), __ATTR(fmode3, 0664, fmode_show, fmode_store),
__ATTR_MRO(devid0, devid_show),
__ATTR_MRO(devid1, devid_show),
__ATTR_MRO(devid2, devid_show),
__ATTR_MRO(devid3, devid_show),
__ATTR_RO(hwid), __ATTR_RO(hwid),
__ATTR_RO(regmap), __ATTR_RO(regmap),
#if 0 #if 0
@ -4536,6 +4549,7 @@ static int ddb_gtl_init_link(struct ddb *dev, u32 l)
id); id);
return -1; return -1;
} }
link->ids.devid = id;
ddbwritel(dev, 1, 0x1a0); ddbwritel(dev, 1, 0x1a0);

View File

@ -102,7 +102,7 @@ static int ns_set_pids(struct dvbnss *nss)
struct ddb *dev = input->port->dev; struct ddb *dev = input->port->dev;
struct ddb_ns *dns = (struct ddb_ns *) nss->priv; struct ddb_ns *dns = (struct ddb_ns *) nss->priv;
if (dev->ids.devid == 0x0301dd01) { if (dev->link[0].ids.devid == 0x0301dd01) {
u32 sys = 0; u32 sys = 0;
int pid, j = 1; int pid, j = 1;
@ -134,7 +134,7 @@ static int ns_set_pid(struct dvbnss *nss, u16 pid)
u32 off = STREAM_PIDS(dns->nr); u32 off = STREAM_PIDS(dns->nr);
#if 1 #if 1
if (dev->ids.devid == 0x0301dd01) { if (dev->link[0].ids.devid == 0x0301dd01) {
if (pid & 0x2000) { if (pid & 0x2000) {
if (pid & 0x8000) if (pid & 0x8000)
memset(nss->pids, 0xff, 0x400); memset(nss->pids, 0xff, 0x400);

View File

@ -112,10 +112,10 @@ static int __devinit ddb_probe(struct pci_dev *pdev,
dev->dev = &pdev->dev; dev->dev = &pdev->dev;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
dev->ids.vendor = id->vendor; dev->link[0].ids.vendor = id->vendor;
dev->ids.device = id->device; dev->link[0].ids.device = id->device;
dev->ids.subvendor = id->subvendor; dev->link[0].ids.subvendor = id->subvendor;
dev->ids.subdevice = id->subdevice; dev->link[0].ids.subdevice = id->subdevice;
dev->link[0].dev = dev; dev->link[0].dev = dev;
dev->link[0].info = (struct ddb_info *) id->driver_data; dev->link[0].info = (struct ddb_info *) id->driver_data;
@ -136,11 +136,11 @@ static int __devinit ddb_probe(struct pci_dev *pdev,
goto fail; goto fail;
} }
dev->ids.hwid = ddbreadl(dev, 0); dev->link[0].ids.hwid = ddbreadl(dev, 0);
dev->ids.regmapid = ddbreadl(dev, 4); dev->link[0].ids.regmapid = ddbreadl(dev, 4);
pr_info("DDBridge: HW %08x REGMAP %08x\n", pr_info("DDBridge: HW %08x REGMAP %08x\n",
dev->ids.hwid, dev->ids.regmapid); dev->link[0].ids.hwid, dev->link[0].ids.regmapid);
if (dev->link[0].info->ns_num) { if (dev->link[0].info->ns_num) {
int i; int i;

View File

@ -382,13 +382,13 @@ struct ddb_link {
struct mutex flash_mutex; struct mutex flash_mutex;
struct ddb_lnb lnb; struct ddb_lnb lnb;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
struct ddb_ids ids;
}; };
struct ddb { struct ddb {
struct pci_dev *pdev; struct pci_dev *pdev;
struct platform_device *pfdev; struct platform_device *pfdev;
struct device *dev; struct device *dev;
struct ddb_ids ids;
int msi; int msi;
struct workqueue_struct *wq; struct workqueue_struct *wq;

View File

@ -156,28 +156,28 @@ static int __init octonet_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
dev->ids.hwid = ddbreadl(dev, 0); dev->link[0].ids.hwid = ddbreadl(dev, 0);
dev->ids.regmapid = ddbreadl(dev, 4); dev->link[0].ids.regmapid = ddbreadl(dev, 4);
dev->ids.devid = ddbreadl(dev, 8); dev->link[0].ids.devid = ddbreadl(dev, 8);
dev->ids.mac = ddbreadl(dev, 12); dev->link[0].ids.mac = ddbreadl(dev, 12);
dev->ids.vendor = dev->ids.devid & 0xffff; dev->link[0].ids.vendor = dev->link[0].ids.devid & 0xffff;
dev->ids.device = dev->ids.devid >> 16; dev->link[0].ids.device = dev->link[0].ids.devid >> 16;
dev->ids.subvendor = dev->ids.devid & 0xffff; dev->link[0].ids.subvendor = dev->link[0].ids.devid & 0xffff;
dev->ids.subdevice = dev->ids.devid >> 16; dev->link[0].ids.subdevice = dev->link[0].ids.devid >> 16;
dev->link[0].dev = dev; dev->link[0].dev = dev;
if (dev->ids.devid == 0x0300dd01) if (dev->link[0].ids.devid == 0x0300dd01)
dev->link[0].info = &ddb_octonet; dev->link[0].info = &ddb_octonet;
else if (dev->ids.devid == 0x0301dd01) else if (dev->link[0].ids.devid == 0x0301dd01)
dev->link[0].info = &ddb_octonet_jse; dev->link[0].info = &ddb_octonet_jse;
else if (dev->ids.devid == 0x0307dd01) else if (dev->link[0].ids.devid == 0x0307dd01)
dev->link[0].info = &ddb_octonet_gtl; dev->link[0].info = &ddb_octonet_gtl;
else else
dev->link[0].info = &ddb_octonet_tbd; dev->link[0].info = &ddb_octonet_tbd;
pr_info("HW %08x REGMAP %08x\n", dev->ids.hwid, dev->ids.regmapid); pr_info("HW %08x REGMAP %08x\n", dev->link[0].ids.hwid, dev->link[0].ids.regmapid);
pr_info("MAC %08x DEVID %08x\n", dev->ids.mac, dev->ids.devid); pr_info("MAC %08x DEVID %08x\n", dev->link[0].ids.mac, dev->link[0].ids.devid);
ddbwritel(dev, 0, ETHER_CONTROL); ddbwritel(dev, 0, ETHER_CONTROL);
ddbwritel(dev, 0x00000000, INTERRUPT_ENABLE); ddbwritel(dev, 0x00000000, INTERRUPT_ENABLE);