Date:2011-03-05 19:57:54 (9 years 2 months ago)
Author:Peter Zotov
Commit:23d094981b389a297db4f63a754d99589a251ab6
Message:MIPS: JZ4750: Add support for UDC controller.

Files: arch/mips/include/asm/mach-jz47xx/jz4750/platform.h (1 diff)
arch/mips/jz47xx/jz4750/board-xz0032.c (1 diff)
arch/mips/jz47xx/jz4750/platform.c (1 diff)
drivers/usb/gadget/jz4740_udc.c (4 diffs)

Change Details

arch/mips/include/asm/mach-jz47xx/jz4750/platform.h
1919#include <linux/platform_device.h>
2020
2121extern struct platform_device jz4750_rtc_device;
22extern struct platform_device jz4750_udc_device;
2223
2324void jz4750_serial_device_register(void);
2425
arch/mips/jz47xx/jz4750/board-xz0032.c
2323
2424static struct platform_device *jz_platform_devices[] __initdata = {
2525    &jz4750_rtc_device,
26    &jz4750_udc_device,
2627};
2728
2829static int __init xz0032_init_platform_devices(void)
arch/mips/jz47xx/jz4750/platform.c
3232#include "../serial.h"
3333#include "../clock.h"
3434
35/* UDC (USB gadget controller) */
36static struct resource jz4750_usb_gdt_resources[] = {
37    {
38        .start = JZ47XX_UDC_BASE_ADDR,
39        .end = JZ47XX_UDC_BASE_ADDR + 0x1000 - 1,
40        .flags = IORESOURCE_MEM,
41    },
42    {
43        .start = JZ4750_IRQ_UDC,
44        .end = JZ4750_IRQ_UDC,
45        .flags = IORESOURCE_IRQ,
46        },
47};
48
49struct platform_device jz4750_udc_device = {
50    .name = "jz-udc",
51    .id = -1,
52    .dev = {
53        .dma_mask = &jz4750_udc_device.dev.coherent_dma_mask,
54        .coherent_dma_mask = DMA_BIT_MASK(32),
55    },
56    .num_resources = ARRAY_SIZE(jz4750_usb_gdt_resources),
57    .resource = jz4750_usb_gdt_resources,
58};
59
60
3561/* RTC controller */
3662static struct resource jz4750_rtc_resources[] = {
3763    {
drivers/usb/gadget/jz4740_udc.c
22402240    if (ret)
22412241        return ret;
22422242
2243    jz4740_udc->clk = clk_get(&pdev->dev, "udc");
2244    if (IS_ERR(jz4740_udc->clk)) {
2245        ret = PTR_ERR(jz4740_udc->clk);
2246        dev_err(&pdev->dev, "Failed to get udc clock: %d\n", ret);
2247        goto err_device_unregister;
2248    }
2249
22502243    jz4740_udc->phy_clk = clk_get(&pdev->dev, "udc-phy");
22512244    if (IS_ERR(jz4740_udc->phy_clk)) {
22522245        ret = PTR_ERR(jz4740_udc->phy_clk);
...... 
22542247        goto err_device_unregister;
22552248    }
22562249
2250    jz4740_udc->clk = clk_get(&pdev->dev, "udc");
2251    if (IS_ERR(jz4740_udc->clk)) {
2252        ret = PTR_ERR(jz4740_udc->clk);
2253        dev_err(&pdev->dev, "Failed to get udc clock: %d\n", ret);
2254        goto err_phy_clk_put;
2255    }
2256
22572257    platform_set_drvdata(pdev, jz4740_udc);
22582258
22592259    jz4740_udc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...... 
22982298    iounmap(jz4740_udc->base);
22992299err_release_mem_region:
23002300    release_mem_region(jz4740_udc->mem->start, resource_size(jz4740_udc->mem));
2301err_phy_clk_put:
2302    clk_put(jz4740_udc->phy_clk);
23012303err_clk_put:
23022304    clk_put(jz4740_udc->clk);
23032305err_device_unregister:
...... 
23202322    iounmap(dev->base);
23212323    release_mem_region(dev->mem->start, resource_size(dev->mem));
23222324    clk_put(dev->clk);
2325    clk_put(dev->phy_clk);
23232326
23242327    platform_set_drvdata(pdev, NULL);
23252328    device_unregister(&dev->gadget.dev);

Archive Download the corresponding diff file



interactive