Skip to contentSkip to conversation

usb: musb: replace hard coded registers with defines

PATCH In review Roman Byshko 2 participants 5 messages Oct 27, 2014 – Nov 10, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: musb: replace hard coded registers with defines

musb registers can be dumped using the file regdump which is created in debugfs. Up to now hard coded register addresses are used for that. Different glue layers however have different register addresses. The patch addresses this issue by substituting bare register addresses with defines.

---
 drivers/usb/musb/musb_debugfs.c | 57 ++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
drivers/usb/musb/musb_debugfs.c +30 -27
index 4c21679..ad3701a 100644
@@ -49,33 +49,36 @@ struct musb_register_map {
 };
 
 static const struct musb_register_map musb_regmap[] = {
-	{ "FAddr",		0x00,	8 },
-	{ "Power",		0x01,	8 },
-	{ "Frame",		0x0c,	16 },
-	{ "Index",		0x0e,	8 },
-	{ "Testmode",		0x0f,	8 },
-	{ "TxMaxPp",		0x10,	16 },
-	{ "TxCSRp",		0x12,	16 },
-	{ "RxMaxPp",		0x14,	16 },
-	{ "RxCSR",		0x16,	16 },
-	{ "RxCount",		0x18,	16 },
-	{ "ConfigData",		0x1f,	8 },
-	{ "DevCtl",		0x60,	8 },
-	{ "MISC",		0x61,	8 },
-	{ "TxFIFOsz",		0x62,	8 },
-	{ "RxFIFOsz",		0x63,	8 },
-	{ "TxFIFOadd",		0x64,	16 },
-	{ "RxFIFOadd",		0x66,	16 },
-	{ "VControl",		0x68,	32 },
-	{ "HWVers",		0x6C,	16 },
-	{ "EPInfo",		0x78,	8 },
-	{ "RAMInfo",		0x79,	8 },
-	{ "LinkInfo",		0x7A,	8 },
-	{ "VPLen",		0x7B,	8 },
-	{ "HS_EOF1",		0x7C,	8 },
-	{ "FS_EOF1",		0x7D,	8 },
-	{ "LS_EOF1",		0x7E,	8 },
-	{ "SOFT_RST",		0x7F,	8 },
+	{ "FAddr",	MUSB_FADDR,	8 },
+	{ "Power",	MUSB_POWER,	8 },
+	{ "Frame",	MUSB_FRAME,	16 },
+	{ "Index",	MUSB_INDEX,	8 },
+	{ "Testmode",	MUSB_TESTMODE,	8 },
+	{ "TxMaxPp",	MUSB_TXMAXP,	16 },
+	{ "TxCSRp",	MUSB_TXCSR,	16 },
+	{ "RxMaxPp",	MUSB_RXMAXP,	16 },
+	{ "RxCSR",	MUSB_RXCSR,	16 },
+	{ "RxCount",	MUSB_RXCOUNT,	16 },
+	{ "ConfigData",	MUSB_CONFIGDATA,8 },
+	{ "IntrRxE",	MUSB_INTRRXE,	16 },
+	{ "IntrTxE",	MUSB_INTRTXE,	16 },
+	{ "IntrUsbE",	MUSB_INTRUSBE,	8 },
+	{ "DevCtl",	MUSB_DEVCTL,	8 },
+	{ "BabbleCtl",	MUSB_BABBLE_CTL,8 },
+	{ "TxFIFOsz",	MUSB_TXFIFOSZ,	8 },
+	{ "RxFIFOsz",	MUSB_RXFIFOSZ,	8 },
+	{ "TxFIFOadd",	MUSB_TXFIFOADD,	16 },
+	{ "RxFIFOadd",	MUSB_RXFIFOADD,	16 },
+	{ "VControl",	0x68,		32 },
+	{ "HWVers",	0x69,		16 },
+	{ "EPInfo",	MUSB_EPINFO,	8 },
+	{ "RAMInfo",	MUSB_RAMINFO,	8 },
+	{ "LinkInfo",	MUSB_LINKINFO,	8 },
+	{ "VPLen",	MUSB_VPLEN,	8 },
+	{ "HS_EOF1",	MUSB_HS_EOF1,	8 },
+	{ "FS_EOF1",	MUSB_FS_EOF1,	8 },
+	{ "LS_EOF1",	MUSB_LS_EOF1,	8 },
+	{ "SOFT_RST",	0x7F,		8 },
 	{ "DMA_CNTLch0",	0x204,	16 },
 	{ "DMA_ADDRch0",	0x208,	32 },
 	{ "DMA_COUNTch0",	0x20C,	32 },
Signature · 1 line
2.1.2
#1 lore raw
Quoted 6 lines · Roman Byshko

musb registers can be dumped using the file regdump which is created in debugfs. Up to now hard coded register addresses are used for that. Different glue layers however have different register addresses. The patch addresses this issue by substituting bare register addresses with defines.

missing Signed-off-by, can't accept. Sorry.

Signature · 1 line
balbi
#2 lore raw

musb registers can be dumped using the file regdump which is created in debugfs. Up to now hard coded register addresses are used for that. Different glue layers however have different register addresses. The patch addresses this issue by substituting bare register addresses with defines.

---
 drivers/usb/musb/musb_debugfs.c | 57 ++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
drivers/usb/musb/musb_debugfs.c +30 -27
index 4c21679..ad3701a 100644
@@ -49,33 +49,36 @@ struct musb_register_map {
 };
 
 static const struct musb_register_map musb_regmap[] = {
-    { "FAddr",        0x00,    8 },
-    { "Power",        0x01,    8 },
-    { "Frame",        0x0c,    16 },
-    { "Index",        0x0e,    8 },
-    { "Testmode",        0x0f,    8 },
-    { "TxMaxPp",        0x10,    16 },
-    { "TxCSRp",        0x12,    16 },
-    { "RxMaxPp",        0x14,    16 },
-    { "RxCSR",        0x16,    16 },
-    { "RxCount",        0x18,    16 },
-    { "ConfigData",        0x1f,    8 },
-    { "DevCtl",        0x60,    8 },
-    { "MISC",        0x61,    8 },
-    { "TxFIFOsz",        0x62,    8 },
-    { "RxFIFOsz",        0x63,    8 },
-    { "TxFIFOadd",        0x64,    16 },
-    { "RxFIFOadd",        0x66,    16 },
-    { "VControl",        0x68,    32 },
-    { "HWVers",        0x6C,    16 },
-    { "EPInfo",        0x78,    8 },
-    { "RAMInfo",        0x79,    8 },
-    { "LinkInfo",        0x7A,    8 },
-    { "VPLen",        0x7B,    8 },
-    { "HS_EOF1",        0x7C,    8 },
-    { "FS_EOF1",        0x7D,    8 },
-    { "LS_EOF1",        0x7E,    8 },
-    { "SOFT_RST",        0x7F,    8 },
+    { "FAddr",    MUSB_FADDR,    8 },
+    { "Power",    MUSB_POWER,    8 },
+    { "Frame",    MUSB_FRAME,    16 },
+    { "Index",    MUSB_INDEX,    8 },
+    { "Testmode",    MUSB_TESTMODE,    8 },
+    { "TxMaxPp",    MUSB_TXMAXP,    16 },
+    { "TxCSRp",    MUSB_TXCSR,    16 },
+    { "RxMaxPp",    MUSB_RXMAXP,    16 },
+    { "RxCSR",    MUSB_RXCSR,    16 },
+    { "RxCount",    MUSB_RXCOUNT,    16 },
+    { "ConfigData",    MUSB_CONFIGDATA,8 },
+    { "IntrRxE",    MUSB_INTRRXE,    16 },
+    { "IntrTxE",    MUSB_INTRTXE,    16 },
+    { "IntrUsbE",    MUSB_INTRUSBE,    8 },
+    { "DevCtl",    MUSB_DEVCTL,    8 },
+    { "BabbleCtl",    MUSB_BABBLE_CTL,8 },
+    { "TxFIFOsz",    MUSB_TXFIFOSZ,    8 },
+    { "RxFIFOsz",    MUSB_RXFIFOSZ,    8 },
+    { "TxFIFOadd",    MUSB_TXFIFOADD,    16 },
+    { "RxFIFOadd",    MUSB_RXFIFOADD,    16 },
+    { "VControl",    0x68,        32 },
+    { "HWVers",    0x69,        16 },
+    { "EPInfo",    MUSB_EPINFO,    8 },
+    { "RAMInfo",    MUSB_RAMINFO,    8 },
+    { "LinkInfo",    MUSB_LINKINFO,    8 },
+    { "VPLen",    MUSB_VPLEN,    8 },
+    { "HS_EOF1",    MUSB_HS_EOF1,    8 },
+    { "FS_EOF1",    MUSB_FS_EOF1,    8 },
+    { "LS_EOF1",    MUSB_LS_EOF1,    8 },
+    { "SOFT_RST",    0x7F,        8 },
     { "DMA_CNTLch0",    0x204,    16 },
     { "DMA_ADDRch0",    0x208,    32 },
     { "DMA_COUNTch0",    0x20C,    32 },
Signature · 1 line
2.1.2
#3 lore raw
Quoted 8 lines · Roman Byshko

musb registers can be dumped using the file regdump which is created in debugfs. Up to now hard coded register addresses are used for that. Different glue layers however have different register addresses. The patch addresses this issue by substituting bare register addresses with defines.

TABs were converted into spaces, please fix and rebase on my testing/next. Make sure TABs remain as TABs.

Signature · 1 line
balbi
#4 lore raw

PATCH 1/1 usb: musb: replace hard coded registers with defines

musb registers can be dumped using the file regdump which is created in debugfs. Up to now hard coded register addresses are used for that. Different glue layers however have different register addresses. The patch addresses this issue by substituting bare register addresses with defines.

---
 drivers/usb/musb/musb_debugfs.c | 57 ++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 27 deletions(-)
drivers/usb/musb/musb_debugfs.c +30 -27
index 4c21679..ad3701a 100644
@@ -49,33 +49,36 @@ struct musb_register_map {
 };
 
 static const struct musb_register_map musb_regmap[] = {
-	{ "FAddr",		0x00,	8 },
-	{ "Power",		0x01,	8 },
-	{ "Frame",		0x0c,	16 },
-	{ "Index",		0x0e,	8 },
-	{ "Testmode",		0x0f,	8 },
-	{ "TxMaxPp",		0x10,	16 },
-	{ "TxCSRp",		0x12,	16 },
-	{ "RxMaxPp",		0x14,	16 },
-	{ "RxCSR",		0x16,	16 },
-	{ "RxCount",		0x18,	16 },
-	{ "ConfigData",		0x1f,	8 },
-	{ "DevCtl",		0x60,	8 },
-	{ "MISC",		0x61,	8 },
-	{ "TxFIFOsz",		0x62,	8 },
-	{ "RxFIFOsz",		0x63,	8 },
-	{ "TxFIFOadd",		0x64,	16 },
-	{ "RxFIFOadd",		0x66,	16 },
-	{ "VControl",		0x68,	32 },
-	{ "HWVers",		0x6C,	16 },
-	{ "EPInfo",		0x78,	8 },
-	{ "RAMInfo",		0x79,	8 },
-	{ "LinkInfo",		0x7A,	8 },
-	{ "VPLen",		0x7B,	8 },
-	{ "HS_EOF1",		0x7C,	8 },
-	{ "FS_EOF1",		0x7D,	8 },
-	{ "LS_EOF1",		0x7E,	8 },
-	{ "SOFT_RST",		0x7F,	8 },
+	{ "FAddr",	MUSB_FADDR,	8 },
+	{ "Power",	MUSB_POWER,	8 },
+	{ "Frame",	MUSB_FRAME,	16 },
+	{ "Index",	MUSB_INDEX,	8 },
+	{ "Testmode",	MUSB_TESTMODE,	8 },
+	{ "TxMaxPp",	MUSB_TXMAXP,	16 },
+	{ "TxCSRp",	MUSB_TXCSR,	16 },
+	{ "RxMaxPp",	MUSB_RXMAXP,	16 },
+	{ "RxCSR",	MUSB_RXCSR,	16 },
+	{ "RxCount",	MUSB_RXCOUNT,	16 },
+	{ "ConfigData",	MUSB_CONFIGDATA,8 },
+	{ "IntrRxE",	MUSB_INTRRXE,	16 },
+	{ "IntrTxE",	MUSB_INTRTXE,	16 },
+	{ "IntrUsbE",	MUSB_INTRUSBE,	8 },
+	{ "DevCtl",	MUSB_DEVCTL,	8 },
+	{ "BabbleCtl",	MUSB_BABBLE_CTL,8 },
+	{ "TxFIFOsz",	MUSB_TXFIFOSZ,	8 },
+	{ "RxFIFOsz",	MUSB_RXFIFOSZ,	8 },
+	{ "TxFIFOadd",	MUSB_TXFIFOADD,	16 },
+	{ "RxFIFOadd",	MUSB_RXFIFOADD,	16 },
+	{ "VControl",	0x68,		32 },
+	{ "HWVers",	0x69,		16 },
+	{ "EPInfo",	MUSB_EPINFO,	8 },
+	{ "RAMInfo",	MUSB_RAMINFO,	8 },
+	{ "LinkInfo",	MUSB_LINKINFO,	8 },
+	{ "VPLen",	MUSB_VPLEN,	8 },
+	{ "HS_EOF1",	MUSB_HS_EOF1,	8 },
+	{ "FS_EOF1",	MUSB_FS_EOF1,	8 },
+	{ "LS_EOF1",	MUSB_LS_EOF1,	8 },
+	{ "SOFT_RST",	0x7F,		8 },
 	{ "DMA_CNTLch0",	0x204,	16 },
 	{ "DMA_ADDRch0",	0x208,	32 },
 	{ "DMA_COUNTch0",	0x20C,	32 },
Signature · 1 line
2.1.2