aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2014-01-05 21:10:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-07 19:21:06 -0500
commit21395a1aac7ce1e19dbb43542a9e06cca2bfca01 (patch)
tree23348c191684e158cd314e9aaea5eea8ac254452 /drivers/usb/chipidea
parent2627cb08129d7fa152f97dd0732736fb2df516ee (diff)
usb: chipidea: move malloced regmap directly into struct hw_bank
Without this patch a seperate chunk of memory is allocated for the regmap array. As the regmap is always used it makes no sense to allocate a seperate memory block for it, this patch moves the regmap array directly into the struct hw_bank. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/ci.h63
-rw-r--r--drivers/usb/chipidea/core.c8
2 files changed, 30 insertions, 41 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 1c94fc5257f4..a71dc1c89aa2 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -26,6 +26,35 @@
26#define ENDPT_MAX 32 26#define ENDPT_MAX 32
27 27
28/****************************************************************************** 28/******************************************************************************
29 * REGISTERS
30 *****************************************************************************/
31/* register indices */
32enum ci_hw_regs {
33 CAP_CAPLENGTH,
34 CAP_HCCPARAMS,
35 CAP_DCCPARAMS,
36 CAP_TESTMODE,
37 CAP_LAST = CAP_TESTMODE,
38 OP_USBCMD,
39 OP_USBSTS,
40 OP_USBINTR,
41 OP_DEVICEADDR,
42 OP_ENDPTLISTADDR,
43 OP_PORTSC,
44 OP_DEVLC,
45 OP_OTGSC,
46 OP_USBMODE,
47 OP_ENDPTSETUPSTAT,
48 OP_ENDPTPRIME,
49 OP_ENDPTFLUSH,
50 OP_ENDPTSTAT,
51 OP_ENDPTCOMPLETE,
52 OP_ENDPTCTRL,
53 /* endptctrl1..15 follow */
54 OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
55};
56
57/******************************************************************************
29 * STRUCTURES 58 * STRUCTURES
30 *****************************************************************************/ 59 *****************************************************************************/
31/** 60/**
@@ -98,7 +127,7 @@ struct hw_bank {
98 void __iomem *cap; 127 void __iomem *cap;
99 void __iomem *op; 128 void __iomem *op;
100 size_t size; 129 size_t size;
101 void __iomem **regmap; 130 void __iomem *regmap[OP_LAST + 1];
102}; 131};
103 132
104/** 133/**
@@ -209,38 +238,6 @@ static inline void ci_role_stop(struct ci_hdrc *ci)
209 ci->roles[role]->stop(ci); 238 ci->roles[role]->stop(ci);
210} 239}
211 240
212/******************************************************************************
213 * REGISTERS
214 *****************************************************************************/
215/* register size */
216#define REG_BITS (32)
217
218/* register indices */
219enum ci_hw_regs {
220 CAP_CAPLENGTH,
221 CAP_HCCPARAMS,
222 CAP_DCCPARAMS,
223 CAP_TESTMODE,
224 CAP_LAST = CAP_TESTMODE,
225 OP_USBCMD,
226 OP_USBSTS,
227 OP_USBINTR,
228 OP_DEVICEADDR,
229 OP_ENDPTLISTADDR,
230 OP_PORTSC,
231 OP_DEVLC,
232 OP_OTGSC,
233 OP_USBMODE,
234 OP_ENDPTSETUPSTAT,
235 OP_ENDPTPRIME,
236 OP_ENDPTFLUSH,
237 OP_ENDPTSTAT,
238 OP_ENDPTCOMPLETE,
239 OP_ENDPTCTRL,
240 /* endptctrl1..15 follow */
241 OP_LAST = OP_ENDPTCTRL + ENDPT_MAX / 2,
242};
243
244/** 241/**
245 * hw_read: reads from a hw register 242 * hw_read: reads from a hw register
246 * @reg: register index 243 * @reg: register index
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 9a5ef205cffd..b9385c1034ac 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -123,13 +123,6 @@ static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
123{ 123{
124 int i; 124 int i;
125 125
126 kfree(ci->hw_bank.regmap);
127
128 ci->hw_bank.regmap = kzalloc((OP_LAST + 1) * sizeof(void *),
129 GFP_KERNEL);
130 if (!ci->hw_bank.regmap)
131 return -ENOMEM;
132
133 for (i = 0; i < OP_ENDPTCTRL; i++) 126 for (i = 0; i < OP_ENDPTCTRL; i++)
134 ci->hw_bank.regmap[i] = 127 ci->hw_bank.regmap[i] =
135 (i <= CAP_LAST ? ci->hw_bank.cap : ci->hw_bank.op) + 128 (i <= CAP_LAST ? ci->hw_bank.cap : ci->hw_bank.op) +
@@ -681,7 +674,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
681 ci_role_destroy(ci); 674 ci_role_destroy(ci);
682 ci_hdrc_enter_lpm(ci, true); 675 ci_hdrc_enter_lpm(ci, true);
683 ci_usb_phy_destroy(ci); 676 ci_usb_phy_destroy(ci);
684 kfree(ci->hw_bank.regmap);
685 677
686 return 0; 678 return 0;
687} 679}