소스 검색

[smscusb] Move non-inline register access functions to smscusb.c

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 년 전
부모
커밋
340f03392d
2개의 변경된 파일61개의 추가작업 그리고 49개의 파일을 삭제
  1. 57
    0
      src/drivers/net/smscusb.c
  2. 4
    49
      src/drivers/net/smscusb.h

+ 57
- 0
src/drivers/net/smscusb.c 파일 보기

@@ -42,6 +42,63 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
42 42
 static struct profiler smscusb_intr_profiler __profiler =
43 43
 	{ .name = "smscusb.intr" };
44 44
 
45
+/******************************************************************************
46
+ *
47
+ * Register access
48
+ *
49
+ ******************************************************************************
50
+ */
51
+
52
+/**
53
+ * Write register (without byte-swapping)
54
+ *
55
+ * @v smscusb		Smscusb device
56
+ * @v address		Register address
57
+ * @v value		Register value
58
+ * @ret rc		Return status code
59
+ */
60
+int smscusb_raw_writel ( struct smscusb_device *smscusb, unsigned int address,
61
+			 uint32_t value ) {
62
+	int rc;
63
+
64
+	/* Write register */
65
+	DBGCIO ( smscusb, "SMSCUSB %p [%03x] <= %08x\n",
66
+		 smscusb, address, le32_to_cpu ( value ) );
67
+	if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_WRITE, 0,
68
+				  address, &value, sizeof ( value ) ) ) != 0 ) {
69
+		DBGC ( smscusb, "SMSCUSB %p could not write %03x: %s\n",
70
+		       smscusb, address, strerror ( rc ) );
71
+		return rc;
72
+	}
73
+
74
+	return 0;
75
+}
76
+
77
+/**
78
+ * Read register (without byte-swapping)
79
+ *
80
+ * @v smscusb		SMSC USB device
81
+ * @v address		Register address
82
+ * @ret value		Register value
83
+ * @ret rc		Return status code
84
+ */
85
+int smscusb_raw_readl ( struct smscusb_device *smscusb, unsigned int address,
86
+			uint32_t *value ) {
87
+	int rc;
88
+
89
+	/* Read register */
90
+	if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_READ, 0,
91
+				  address, value, sizeof ( *value ) ) ) != 0 ) {
92
+		DBGC ( smscusb, "SMSCUSB %p could not read %03x: %s\n",
93
+		       smscusb, address, strerror ( rc ) );
94
+		return rc;
95
+	}
96
+	DBGCIO ( smscusb, "SMSCUSB %p [%03x] => %08x\n",
97
+		 smscusb, address, le32_to_cpu ( *value ) );
98
+
99
+	return 0;
100
+}
101
+
45 102
 /******************************************************************************
46 103
  *
47 104
  * EEPROM access

+ 4
- 49
src/drivers/net/smscusb.h 파일 보기

@@ -170,30 +170,10 @@ struct smscusb_device {
170 170
 	uint32_t int_sts;
171 171
 };
172 172
 
173
-/**
174
- * Write register (without byte-swapping)
175
- *
176
- * @v smscusb		Smscusb device
177
- * @v address		Register address
178
- * @v value		Register value
179
- * @ret rc		Return status code
180
- */
181
-static int smscusb_raw_writel ( struct smscusb_device *smscusb,
182
-				unsigned int address, uint32_t value ) {
183
-	int rc;
184
-
185
-	/* Write register */
186
-	DBGCIO ( smscusb, "SMSCUSB %p [%03x] <= %08x\n",
187
-		 smscusb, address, le32_to_cpu ( value ) );
188
-	if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_WRITE, 0,
189
-				  address, &value, sizeof ( value ) ) ) != 0 ) {
190
-		DBGC ( smscusb, "SMSCUSB %p could not write %03x: %s\n",
191
-		       smscusb, address, strerror ( rc ) );
192
-		return rc;
193
-	}
194
-
195
-	return 0;
196
-}
173
+extern int smscusb_raw_writel ( struct smscusb_device *smscusb,
174
+				unsigned int address, uint32_t value );
175
+extern int smscusb_raw_readl ( struct smscusb_device *smscusb,
176
+			       unsigned int address, uint32_t *value );
197 177
 
198 178
 /**
199 179
  * Write register
@@ -216,31 +196,6 @@ smscusb_writel ( struct smscusb_device *smscusb, unsigned int address,
216 196
 	return 0;
217 197
 }
218 198
 
219
-/**
220
- * Read register (without byte-swapping)
221
- *
222
- * @v smscusb		SMSC USB device
223
- * @v address		Register address
224
- * @ret value		Register value
225
- * @ret rc		Return status code
226
- */
227
-static int smscusb_raw_readl ( struct smscusb_device *smscusb,
228
-			       unsigned int address, uint32_t *value ) {
229
-	int rc;
230
-
231
-	/* Read register */
232
-	if ( ( rc = usb_control ( smscusb->usb, SMSCUSB_REGISTER_READ, 0,
233
-				  address, value, sizeof ( *value ) ) ) != 0 ) {
234
-		DBGC ( smscusb, "SMSCUSB %p could not read %03x: %s\n",
235
-		       smscusb, address, strerror ( rc ) );
236
-		return rc;
237
-	}
238
-	DBGCIO ( smscusb, "SMSCUSB %p [%03x] => %08x\n",
239
-		 smscusb, address, le32_to_cpu ( *value ) );
240
-
241
-	return 0;
242
-}
243
-
244 199
 /**
245 200
  * Read register
246 201
  *

Loading…
취소
저장