ehci-atmel.c (0d768fcfc01098ae0e676c78746c9f4fd8228cd7) | ehci-atmel.c (22d9d8e8316d7f69046c8805ce9aa8d9c43d4e5b) |
---|---|
1/* 2 * Driver for EHCI UHP on Atmel chips 3 * 4 * Copyright (C) 2009 Atmel Corporation, 5 * Nicolas Ferre <nicolas.ferre@atmel.com> 6 * 7 * Based on various ehci-*.c drivers 8 * --- 16 unchanged lines hidden (view full) --- 25#include "ehci.h" 26 27#define DRIVER_DESC "EHCI Atmel driver" 28 29static const char hcd_name[] = "ehci-atmel"; 30static struct hc_driver __read_mostly ehci_atmel_hc_driver; 31 32/* interface and function clocks */ | 1/* 2 * Driver for EHCI UHP on Atmel chips 3 * 4 * Copyright (C) 2009 Atmel Corporation, 5 * Nicolas Ferre <nicolas.ferre@atmel.com> 6 * 7 * Based on various ehci-*.c drivers 8 * --- 16 unchanged lines hidden (view full) --- 25#include "ehci.h" 26 27#define DRIVER_DESC "EHCI Atmel driver" 28 29static const char hcd_name[] = "ehci-atmel"; 30static struct hc_driver __read_mostly ehci_atmel_hc_driver; 31 32/* interface and function clocks */ |
33static struct clk *iclk, *fclk, *uclk; | 33static struct clk *iclk, *fclk; |
34static int clocked; 35 36/*-------------------------------------------------------------------------*/ 37 38static void atmel_start_clock(void) 39{ | 34static int clocked; 35 36/*-------------------------------------------------------------------------*/ 37 38static void atmel_start_clock(void) 39{ |
40 if (IS_ENABLED(CONFIG_COMMON_CLK)) { 41 clk_set_rate(uclk, 48000000); 42 clk_prepare_enable(uclk); 43 } | |
44 clk_prepare_enable(iclk); 45 clk_prepare_enable(fclk); 46 clocked = 1; 47} 48 49static void atmel_stop_clock(void) 50{ 51 clk_disable_unprepare(fclk); 52 clk_disable_unprepare(iclk); | 40 clk_prepare_enable(iclk); 41 clk_prepare_enable(fclk); 42 clocked = 1; 43} 44 45static void atmel_stop_clock(void) 46{ 47 clk_disable_unprepare(fclk); 48 clk_disable_unprepare(iclk); |
53 if (IS_ENABLED(CONFIG_COMMON_CLK)) 54 clk_disable_unprepare(uclk); | |
55 clocked = 0; 56} 57 58static void atmel_start_ehci(struct platform_device *pdev) 59{ 60 dev_dbg(&pdev->dev, "start\n"); 61 atmel_start_clock(); 62} --- 30 unchanged lines hidden (view full) --- 93 } 94 95 /* Right now device-tree probed devices don't get dma_mask set. 96 * Since shared usb code relies on it, set it here for now. 97 * Once we have dma capability bindings this can go away. 98 */ 99 if (!pdev->dev.dma_mask) 100 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; | 49 clocked = 0; 50} 51 52static void atmel_start_ehci(struct platform_device *pdev) 53{ 54 dev_dbg(&pdev->dev, "start\n"); 55 atmel_start_clock(); 56} --- 30 unchanged lines hidden (view full) --- 87 } 88 89 /* Right now device-tree probed devices don't get dma_mask set. 90 * Since shared usb code relies on it, set it here for now. 91 * Once we have dma capability bindings this can go away. 92 */ 93 if (!pdev->dev.dma_mask) 94 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
101 if (!pdev->dev.coherent_dma_mask) 102 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 95 retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 96 if (retval) 97 goto fail_create_hcd; |
103 104 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 105 if (!hcd) { 106 retval = -ENOMEM; 107 goto fail_create_hcd; 108 } 109 110 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); --- 20 unchanged lines hidden (view full) --- 131 goto fail_request_resource; 132 } 133 fclk = devm_clk_get(&pdev->dev, "uhpck"); 134 if (IS_ERR(fclk)) { 135 dev_err(&pdev->dev, "Error getting function clock\n"); 136 retval = -ENOENT; 137 goto fail_request_resource; 138 } | 98 99 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 100 if (!hcd) { 101 retval = -ENOMEM; 102 goto fail_create_hcd; 103 } 104 105 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); --- 20 unchanged lines hidden (view full) --- 126 goto fail_request_resource; 127 } 128 fclk = devm_clk_get(&pdev->dev, "uhpck"); 129 if (IS_ERR(fclk)) { 130 dev_err(&pdev->dev, "Error getting function clock\n"); 131 retval = -ENOENT; 132 goto fail_request_resource; 133 } |
139 if (IS_ENABLED(CONFIG_COMMON_CLK)) { 140 uclk = devm_clk_get(&pdev->dev, "usb_clk"); 141 if (IS_ERR(uclk)) { 142 dev_err(&pdev->dev, "failed to get uclk\n"); 143 retval = PTR_ERR(uclk); 144 goto fail_request_resource; 145 } 146 } | |
147 148 ehci = hcd_to_ehci(hcd); 149 /* registers start at offset 0x0 */ 150 ehci->caps = hcd->regs; 151 152 atmel_start_ehci(pdev); 153 154 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); --- 69 unchanged lines hidden --- | 134 135 ehci = hcd_to_ehci(hcd); 136 /* registers start at offset 0x0 */ 137 ehci->caps = hcd->regs; 138 139 atmel_start_ehci(pdev); 140 141 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); --- 69 unchanged lines hidden --- |