a2bc8474783f59bfc1830c3d7d31f81ab0292c2e
[platform/kernel/linux-stable.git] /
1 From ltsi-dev-bounces@lists.linuxfoundation.org Mon May 28 23:22:40 2012
2 From: "Shimoda, Yoshihiro" <yoshihiro.shimoda.uh@renesas.com>
3 Date: Tue, 29 May 2012 15:22:35 +0900
4 Subject: [LTSI-dev] [PATCH 03/12] usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data
5 To: ltsi-dev@lists.linuxfoundation.org
6 Message-ID: <4FC46B2B.7010109@renesas.com>
7
8
9 >From 0d5a5cc7d8b2da62c70d9ab7a9cdd626b889c745 Mon Sep 17 00:00:00 2001
10 From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
11 Date: Fri, 8 Jul 2011 14:51:27 +0900
12 Subject: usb: gadget: r8a66597-udc: Make BUSWAIT configurable through platform data
13
14 BUSWAIT is a 4-bit-wide value that controls the number of access waits
15 from the CPU to on-chip USB module. b'0000 inserts 0 wait (2 access
16 cycles) and b'1111 inserts 15 waits (17 access cycles, hardware
17 initial value), respectively.
18
19 BUSWAIT value depends on peripheral clock frequency supplied to on-chip
20 of each CPU, hence should be configurable through platform data.
21
22 Note that this patch assumes that b'0000 (0 wait, 2 access cycles) is
23 rerely used and considered as invalid. If valid 'buswait' data is not
24 provided by platform, initial b'1111 (15 waits, 17 access cycles) will
25 be applied as a safe default.
26
27 Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
28 Signed-off-by: Felipe Balbi <balbi@ti.com>
29 (cherry picked from commit 5154e9f126c1d2ee8f5f93d9954f83d82b2d5e64)
30
31 Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
32 ---
33  drivers/usb/gadget/r8a66597-udc.c |    6 +++++-
34  include/linux/usb/r8a66597.h      |    3 +++
35  2 files changed, 8 insertions(+), 1 deletion(-)
36
37 --- a/drivers/usb/gadget/r8a66597-udc.c
38 +++ b/drivers/usb/gadget/r8a66597-udc.c
39 @@ -576,7 +576,11 @@ static void init_controller(struct r8a66
40         u16 endian = r8a66597->pdata->endian ? BIGEND : 0;
41  
42         if (r8a66597->pdata->on_chip) {
43 -               r8a66597_bset(r8a66597, 0x04, SYSCFG1);
44 +               if (r8a66597->pdata->buswait)
45 +                       r8a66597_write(r8a66597, r8a66597->pdata->buswait,
46 +                                       SYSCFG1);
47 +               else
48 +                       r8a66597_write(r8a66597, 0x0f, SYSCFG1);
49                 r8a66597_bset(r8a66597, HSE, SYSCFG0);
50  
51                 r8a66597_bclr(r8a66597, USBE, SYSCFG0);
52 --- a/include/linux/usb/r8a66597.h
53 +++ b/include/linux/usb/r8a66597.h
54 @@ -31,6 +31,9 @@ struct r8a66597_platdata {
55         /* This callback can control port power instead of DVSTCTR register. */
56         void (*port_power)(int port, int power);
57  
58 +       /* This parameter is for BUSWAIT */
59 +       u16             buswait;
60 +
61         /* set one = on chip controller, set zero = external controller */
62         unsigned        on_chip:1;
63