diff options
author | Michael Brown | 2017-07-10 12:54:24 +0200 |
---|---|---|
committer | Michael Brown | 2017-07-10 12:55:04 +0200 |
commit | 340f03392d37e1f8552b3bd3021705744caecf25 (patch) | |
tree | c1ea9ec53da70027e57b1c66c3b1e03ab1edf0bb /src/drivers | |
parent | [virtio] Support VIRTIO_NET_F_IOMMU_PLATFORM (diff) | |
download | ipxe-340f03392d37e1f8552b3bd3021705744caecf25.tar.gz ipxe-340f03392d37e1f8552b3bd3021705744caecf25.tar.xz ipxe-340f03392d37e1f8552b3bd3021705744caecf25.zip |
[smscusb] Move non-inline register access functions to smscusb.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/net/smscusb.c | 57 | ||||
-rw-r--r-- | src/drivers/net/smscusb.h | 53 |
2 files changed, 61 insertions, 49 deletions
diff --git a/src/drivers/net/smscusb.c b/src/drivers/net/smscusb.c index 32e24418..19a679c4 100644 --- a/src/drivers/net/smscusb.c +++ b/src/drivers/net/smscusb.c @@ -44,6 +44,63 @@ static struct profiler smscusb_intr_profiler __profiler = /****************************************************************************** * + * Register access + * + ****************************************************************************** + */ + +/** + * Write register (without byte-swapping) + * + * @v smscusb Smscusb device + * @v address Register address + * @v value Register value + * @ret rc Return status code + */ +int smscusb_raw_writel ( struct smscusb_device *smscusb, unsigned int address, + uint32_t value ) { + int rc; + + /* Write register */ + DBGCIO ( smscusb, "SMSCUSB %p [%03x] <= %08x\n", + smscusb, address, le32_to_cpu ( value ) ); + if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_WRITE, 0, + address, &value, sizeof ( value ) ) ) != 0 ) { + DBGC ( smscusb, "SMSCUSB %p could not write %03x: %s\n", + smscusb, address, strerror ( rc ) ); + return rc; + } + + return 0; +} + +/** + * Read register (without byte-swapping) + * + * @v smscusb SMSC USB device + * @v address Register address + * @ret value Register value + * @ret rc Return status code + */ +int smscusb_raw_readl ( struct smscusb_device *smscusb, unsigned int address, + uint32_t *value ) { + int rc; + + /* Read register */ + if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_READ, 0, + address, value, sizeof ( *value ) ) ) != 0 ) { + DBGC ( smscusb, "SMSCUSB %p could not read %03x: %s\n", + smscusb, address, strerror ( rc ) ); + return rc; + } + DBGCIO ( smscusb, "SMSCUSB %p [%03x] => %08x\n", + smscusb, address, le32_to_cpu ( *value ) ); + + return 0; +} + +/****************************************************************************** + * * EEPROM access * ****************************************************************************** diff --git a/src/drivers/net/smscusb.h b/src/drivers/net/smscusb.h index 8c602dc5..d7216d9a 100644 --- a/src/drivers/net/smscusb.h +++ b/src/drivers/net/smscusb.h @@ -170,30 +170,10 @@ struct smscusb_device { uint32_t int_sts; }; -/** - * Write register (without byte-swapping) - * - * @v smscusb Smscusb device - * @v address Register address - * @v value Register value - * @ret rc Return status code - */ -static int smscusb_raw_writel ( struct smscusb_device *smscusb, - unsigned int address, uint32_t value ) { - int rc; - - /* Write register */ - DBGCIO ( smscusb, "SMSCUSB %p [%03x] <= %08x\n", - smscusb, address, le32_to_cpu ( value ) ); - if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_WRITE, 0, - address, &value, sizeof ( value ) ) ) != 0 ) { - DBGC ( smscusb, "SMSCUSB %p could not write %03x: %s\n", - smscusb, address, strerror ( rc ) ); - return rc; - } - - return 0; -} +extern int smscusb_raw_writel ( struct smscusb_device *smscusb, + unsigned int address, uint32_t value ); +extern int smscusb_raw_readl ( struct smscusb_device *smscusb, + unsigned int address, uint32_t *value ); /** * Write register @@ -217,31 +197,6 @@ smscusb_writel ( struct smscusb_device *smscusb, unsigned int address, } /** - * Read register (without byte-swapping) - * - * @v smscusb SMSC USB device - * @v address Register address - * @ret value Register value - * @ret rc Return status code - */ -static int smscusb_raw_readl ( struct smscusb_device *smscusb, - unsigned int address, uint32_t *value ) { - int rc; - - /* Read register */ - if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_READ, 0, - address, value, sizeof ( *value ) ) ) != 0 ) { - DBGC ( smscusb, "SMSCUSB %p could not read %03x: %s\n", - smscusb, address, strerror ( rc ) ); - return rc; - } - DBGCIO ( smscusb, "SMSCUSB %p [%03x] => %08x\n", - smscusb, address, le32_to_cpu ( *value ) ); - - return 0; -} - -/** * Read register * * @v smscusb SMSC USB device |