diff options
author | Frank Mori Hess <fmhess@users.sourceforge.net> | 2008-11-17 21:36:45 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 21:53:51 (GMT) |
commit | f8db88ef1f173bfc81afe244f4e6ff00d3e025e4 (patch) | |
tree | 16a83cbb84f52bc18bf4f0c282bed97022770273 /drivers/staging | |
parent | 75c794f0d2ebafd0ed86232b361762dc5d837131 (diff) | |
download | linux-fsl-qoriq-f8db88ef1f173bfc81afe244f4e6ff00d3e025e4.tar.xz |
Staging: comedi: Added reading of board serial number from eeprom for m-series boards
Nothing is done with it yet, eventually it will be made available to
user-space via a readable file in sysfs.
From: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/ni_pcimio.c | 12 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_stc.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 85ceac3..4a657d3 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -111,6 +111,7 @@ Bugs: #include "../comedidev.h" +#include <asm/byteorder.h> #include <linux/delay.h> #include "ni_stc.h" @@ -1526,6 +1527,8 @@ static void m_series_init_eeprom_buffer(comedi_device * dev) { static const int Start_Cal_EEPROM = 0x400; static const unsigned window_size = 10; + static const int serial_number_eeprom_offset = 0x4; + static const int serial_number_eeprom_length = 0x4; unsigned old_iodwbsr_bits; unsigned old_iodwbsr1_bits; unsigned old_iodwcr1_bits; @@ -1537,9 +1540,16 @@ static void m_series_init_eeprom_buffer(comedi_device * dev) writel(0x0, devpriv->mite->mite_io_addr + MITE_IODWBSR); writel(((0x80 | window_size) | devpriv->mite->daq_phys_addr), devpriv->mite->mite_io_addr + MITE_IODWBSR_1); - writel(0x0, devpriv->mite->mite_io_addr + MITE_IODWCR_1); + writel(0x1 | old_iodwcr1_bits, devpriv->mite->mite_io_addr + MITE_IODWCR_1); writel(0xf, devpriv->mite->mite_io_addr + 0x30); + BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number)); + for (i = 0; i < serial_number_eeprom_length; ++i) { + char *byte_ptr = (char*)&devpriv->serial_number + i; + *byte_ptr = ni_readb(serial_number_eeprom_offset + i); + } + devpriv->serial_number = be32_to_cpu(devpriv->serial_number); + for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i) { devpriv->eeprom_buffer[i] = ni_readb(Start_Cal_EEPROM + i); } diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index 040dda2..0c869ad 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -1484,6 +1484,7 @@ typedef struct ni_board_struct { \ sampl_t ai_fifo_buffer[0x2000]; \ uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE]; \ + uint32_t serial_number; \ \ struct mite_struct *mite; \ struct mite_channel *ai_mite_chan; \ |