USB: modifications for at91sam9g10
authorHong Xu <hong.xu@atmel.com>
Fri, 25 Sep 2009 10:24:12 +0000 (12:24 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Dec 2009 19:55:15 +0000 (11:55 -0800)
Modify both host and gadget USB drivers for at91sam9g10.
This add a clock management equivalent to at91sam9261 on usb drivers.
It also add the way of handling gadget pull-ups (like the at91sam9261).

Signed-off-by: Hong Xu <hong.xu@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
drivers/usb/gadget/at91_udc.c
drivers/usb/host/ohci-at91.c

index 66450a1abc227a3fc437e165a385b161fd7b9792..043e04db2a0555e7548782d8ddeb967a31772bd7 100644 (file)
@@ -892,7 +892,7 @@ static void pullup(struct at91_udc *udc, int is_on)
 
                        txvc |= AT91_UDP_TXVC_PUON;
                        at91_udp_write(udc, AT91_UDP_TXVC, txvc);
-               } else if (cpu_is_at91sam9261()) {
+               } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) {
                        u32     usbpucr;
 
                        usbpucr = at91_sys_read(AT91_MATRIX_USBPUCR);
@@ -910,7 +910,7 @@ static void pullup(struct at91_udc *udc, int is_on)
 
                        txvc &= ~AT91_UDP_TXVC_PUON;
                        at91_udp_write(udc, AT91_UDP_TXVC, txvc);
-               } else if (cpu_is_at91sam9261()) {
+               } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) {
                        u32     usbpucr;
 
                        usbpucr = at91_sys_read(AT91_MATRIX_USBPUCR);
@@ -1692,7 +1692,7 @@ static int __init at91udc_probe(struct platform_device *pdev)
                udc->ep[3].maxpacket = 64;
                udc->ep[4].maxpacket = 512;
                udc->ep[5].maxpacket = 512;
-       } else if (cpu_is_at91sam9261()) {
+       } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) {
                udc->ep[3].maxpacket = 64;
        } else if (cpu_is_at91sam9263()) {
                udc->ep[0].maxpacket = 64;
index 7ccffcbe7b6f48f7ef1f0dc24b183f7be0e7a3ab..68b83ab70719aa8b76f79d7b766625cc991cbe4c 100644 (file)
@@ -35,7 +35,7 @@ extern int usb_disabled(void);
 
 static void at91_start_clock(void)
 {
-       if (cpu_is_at91sam9261())
+       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
                clk_enable(hclk);
        clk_enable(iclk);
        clk_enable(fclk);
@@ -46,7 +46,7 @@ static void at91_stop_clock(void)
 {
        clk_disable(fclk);
        clk_disable(iclk);
-       if (cpu_is_at91sam9261())
+       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
                clk_disable(hclk);
        clocked = 0;
 }
@@ -142,7 +142,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 
        iclk = clk_get(&pdev->dev, "ohci_clk");
        fclk = clk_get(&pdev->dev, "uhpck");
-       if (cpu_is_at91sam9261())
+       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
                hclk = clk_get(&pdev->dev, "hck0");
 
        at91_start_hc(pdev);
@@ -155,7 +155,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
        /* Error handling */
        at91_stop_hc(pdev);
 
-       if (cpu_is_at91sam9261())
+       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
                clk_put(hclk);
        clk_put(fclk);
        clk_put(iclk);
@@ -192,7 +192,7 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
        release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
        usb_put_hcd(hcd);
 
-       if (cpu_is_at91sam9261())
+       if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
                clk_put(hclk);
        clk_put(fclk);
        clk_put(iclk);