Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ddrdrive: read serial number from device

We can read the serial number now.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information...
commit 502d646b214e0b68d6cc50c4394f9a34b6d62255 1 parent e857eb4
@gregkh authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 ddrdrive.c
View
17 ddrdrive.c
@@ -91,6 +91,7 @@ struct ddr {
u32 hba_state;
u32 brick_state;
u32 last_sector;
+ u32 serial_number;
};
@@ -131,6 +132,20 @@ static void ddr_init(struct ddr *ddr)
ddr_write32(ddr, INT_CONTROL_REG, 0xF0000000);
}
+static void ddr_read_serial_number(struct ddr *ddr)
+{
+ u32 value;
+
+ ddr_write32(ddr, 0x2C, 0x001C0000);
+ ddr_write32(ddr, 0x24, 0x08000000);
+ do {
+ value = ddr_read32(ddr, 0x28);
+ dev_info(&ddr->pdev->dev, "%s: value = 0x%x\n", __func__, value);
+ } while (value != 0x00);
+
+ ddr->serial_number = ddr_read32(ddr, 0x30);
+}
+
static int __devinit ddr_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -179,6 +194,8 @@ static int __devinit ddr_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, ddr);
ddr_init(ddr);
+ ddr_read_serial_number(ddr);
+ dev_info(&pdev->dev, "serial number = 0x%x\n", ddr->serial_number);
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.