2012-06-27 21:58:20 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2012
|
|
|
|
* Atmel Semiconductor <www.atmel.com>
|
|
|
|
* Written-by: Bo Shen <voice.shen@atmel.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-06-27 21:58:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <usb.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/clk.h>
|
|
|
|
|
|
|
|
#include "ehci.h"
|
|
|
|
|
2013-10-10 22:27:57 +00:00
|
|
|
int ehci_hcd_init(int index, enum usb_init_type init,
|
|
|
|
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
|
2012-06-27 21:58:20 +00:00
|
|
|
{
|
|
|
|
/* Enable UTMI PLL */
|
2016-02-02 03:11:53 +00:00
|
|
|
if (at91_upll_clk_enable())
|
|
|
|
return -1;
|
2012-06-27 21:58:20 +00:00
|
|
|
|
|
|
|
/* Enable USB Host clock */
|
2014-08-06 09:24:57 +00:00
|
|
|
at91_periph_clk_enable(ATMEL_ID_UHPHS);
|
2012-06-27 21:58:20 +00:00
|
|
|
|
2012-09-25 22:14:35 +00:00
|
|
|
*hccr = (struct ehci_hccr *)ATMEL_BASE_EHCI;
|
|
|
|
*hcor = (struct ehci_hcor *)((uint32_t)*hccr +
|
|
|
|
HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
|
2012-06-27 21:58:20 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-25 22:14:35 +00:00
|
|
|
int ehci_hcd_stop(int index)
|
2012-06-27 21:58:20 +00:00
|
|
|
{
|
|
|
|
/* Disable USB Host Clock */
|
2014-08-06 09:24:57 +00:00
|
|
|
at91_periph_clk_disable(ATMEL_ID_UHPHS);
|
2012-06-27 21:58:20 +00:00
|
|
|
|
|
|
|
/* Disable UTMI PLL */
|
2016-02-02 03:11:53 +00:00
|
|
|
if (at91_upll_clk_disable())
|
|
|
|
return -1;
|
2012-06-27 21:58:20 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|