-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 295867 b: refs/heads/master c: 7f471ee h: refs/heads/master i: 295865: 3a96862 295863: ff73348 v: v3
- Loading branch information
Joonyoung Shim
authored and
Kukjin Kim
committed
Mar 9, 2012
1 parent
c38df15
commit dd7fc4c
Showing
5 changed files
with
98 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 99f6e1f50cbb048325c966f2d0e7fe3e47010905 | ||
refs/heads/master: 7f471ee8bed570c0f8ea48f17a957c3b31f54a61 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright (C) 2012 Samsung Electronics Co.Ltd | ||
* Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundationr | ||
*/ | ||
|
||
#include <linux/clk.h> | ||
#include <linux/delay.h> | ||
#include <linux/err.h> | ||
#include <linux/io.h> | ||
#include <linux/platform_device.h> | ||
#include <mach/map.h> | ||
#include <mach/regs-sys.h> | ||
#include <plat/cpu.h> | ||
#include <plat/regs-usb-hsotg-phy.h> | ||
#include <plat/usb-phy.h> | ||
|
||
static int s5pv210_usb_otgphy_init(struct platform_device *pdev) | ||
{ | ||
struct clk *xusbxti; | ||
u32 phyclk; | ||
|
||
writel(readl(S5PV210_USB_PHY_CON) | S5PV210_USB_PHY0_EN, | ||
S5PV210_USB_PHY_CON); | ||
|
||
/* set clock frequency for PLL */ | ||
phyclk = readl(S3C_PHYCLK) & ~S3C_PHYCLK_CLKSEL_MASK; | ||
|
||
xusbxti = clk_get(&pdev->dev, "xusbxti"); | ||
if (xusbxti && !IS_ERR(xusbxti)) { | ||
switch (clk_get_rate(xusbxti)) { | ||
case 12 * MHZ: | ||
phyclk |= S3C_PHYCLK_CLKSEL_12M; | ||
break; | ||
case 24 * MHZ: | ||
phyclk |= S3C_PHYCLK_CLKSEL_24M; | ||
break; | ||
default: | ||
case 48 * MHZ: | ||
/* default reference clock */ | ||
break; | ||
} | ||
clk_put(xusbxti); | ||
} | ||
|
||
/* TODO: select external clock/oscillator */ | ||
writel(phyclk | S3C_PHYCLK_CLK_FORCE, S3C_PHYCLK); | ||
|
||
/* set to normal OTG PHY */ | ||
writel((readl(S3C_PHYPWR) & ~S3C_PHYPWR_NORMAL_MASK), S3C_PHYPWR); | ||
mdelay(1); | ||
|
||
/* reset OTG PHY and Link */ | ||
writel(S3C_RSTCON_PHY | S3C_RSTCON_HCLK | S3C_RSTCON_PHYCLK, | ||
S3C_RSTCON); | ||
udelay(20); /* at-least 10uS */ | ||
writel(0, S3C_RSTCON); | ||
|
||
return 0; | ||
} | ||
|
||
static int s5pv210_usb_otgphy_exit(struct platform_device *pdev) | ||
{ | ||
writel((readl(S3C_PHYPWR) | S3C_PHYPWR_ANALOG_POWERDOWN | | ||
S3C_PHYPWR_OTG_DISABLE), S3C_PHYPWR); | ||
|
||
writel(readl(S5PV210_USB_PHY_CON) & ~S5PV210_USB_PHY0_EN, | ||
S5PV210_USB_PHY_CON); | ||
|
||
return 0; | ||
} | ||
|
||
int s5p_usb_phy_init(struct platform_device *pdev, int type) | ||
{ | ||
if (type == S5P_USB_PHY_DEVICE) | ||
return s5pv210_usb_otgphy_init(pdev); | ||
|
||
return -EINVAL; | ||
} | ||
|
||
int s5p_usb_phy_exit(struct platform_device *pdev, int type) | ||
{ | ||
if (type == S5P_USB_PHY_DEVICE) | ||
return s5pv210_usb_otgphy_exit(pdev); | ||
|
||
return -EINVAL; | ||
} |