mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
ARM: EXYNOS: Add USB OHCI device
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
This commit is contained in:
parent
384703b8e6
commit
6e7eb170fd
7 changed files with 96 additions and 0 deletions
|
@ -82,6 +82,11 @@ config EXYNOS4_DEV_DWMCI
|
|||
help
|
||||
Compile in platform device definitions for DWMCI
|
||||
|
||||
config EXYNOS4_DEV_USB_OHCI
|
||||
bool
|
||||
help
|
||||
Compile in platform device definition for USB OHCI
|
||||
|
||||
config EXYNOS4_SETUP_I2C1
|
||||
bool
|
||||
help
|
||||
|
|
|
@ -44,6 +44,7 @@ obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
|
|||
obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o
|
||||
obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o
|
||||
obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
|
||||
obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
|
||||
|
||||
obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
|
||||
obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
|
||||
|
|
52
arch/arm/mach-exynos/dev-ohci.c
Normal file
52
arch/arm/mach-exynos/dev-ohci.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* linux/arch/arm/mach-exynos/dev-ohci.c
|
||||
*
|
||||
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* EXYNOS - OHCI support
|
||||
*
|
||||
* 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 Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <mach/irqs.h>
|
||||
#include <mach/map.h>
|
||||
#include <mach/ohci.h>
|
||||
|
||||
#include <plat/devs.h>
|
||||
#include <plat/usb-phy.h>
|
||||
|
||||
static struct resource exynos4_ohci_resource[] = {
|
||||
[0] = DEFINE_RES_MEM(EXYNOS4_PA_OHCI, SZ_256),
|
||||
[1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
|
||||
};
|
||||
|
||||
static u64 exynos4_ohci_dma_mask = DMA_BIT_MASK(32);
|
||||
|
||||
struct platform_device exynos4_device_ohci = {
|
||||
.name = "exynos-ohci",
|
||||
.id = -1,
|
||||
.num_resources = ARRAY_SIZE(exynos4_ohci_resource),
|
||||
.resource = exynos4_ohci_resource,
|
||||
.dev = {
|
||||
.dma_mask = &exynos4_ohci_dma_mask,
|
||||
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||
}
|
||||
};
|
||||
|
||||
void __init exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd)
|
||||
{
|
||||
struct exynos4_ohci_platdata *npd;
|
||||
|
||||
npd = s3c_set_platdata(pd, sizeof(struct exynos4_ohci_platdata),
|
||||
&exynos4_device_ohci);
|
||||
|
||||
if (!npd->phy_init)
|
||||
npd->phy_init = s5p_usb_phy_init;
|
||||
if (!npd->phy_exit)
|
||||
npd->phy_exit = s5p_usb_phy_exit;
|
||||
}
|
|
@ -107,6 +107,7 @@
|
|||
#define EXYNOS4_PA_SROMC 0x12570000
|
||||
|
||||
#define EXYNOS4_PA_EHCI 0x12580000
|
||||
#define EXYNOS4_PA_OHCI 0x12590000
|
||||
#define EXYNOS4_PA_HSPHY 0x125B0000
|
||||
#define EXYNOS4_PA_MFC 0x13400000
|
||||
|
||||
|
|
21
arch/arm/mach-exynos/include/mach/ohci.h
Normal file
21
arch/arm/mach-exynos/include/mach/ohci.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Samsung Electronics Co.Ltd
|
||||
* http://www.samsung.com/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __MACH_EXYNOS_OHCI_H
|
||||
#define __MACH_EXYNOS_OHCI_H
|
||||
|
||||
struct exynos4_ohci_platdata {
|
||||
int (*phy_init)(struct platform_device *pdev, int type);
|
||||
int (*phy_exit)(struct platform_device *pdev, int type);
|
||||
};
|
||||
|
||||
extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
|
||||
|
||||
#endif /* __MACH_EXYNOS_OHCI_H */
|
|
@ -19,6 +19,13 @@
|
|||
#include <plat/cpu.h>
|
||||
#include <plat/usb-phy.h>
|
||||
|
||||
static atomic_t host_usage;
|
||||
|
||||
static int exynos4_usb_host_phy_is_on(void)
|
||||
{
|
||||
return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
|
||||
}
|
||||
|
||||
static int exynos4_usb_phy1_init(struct platform_device *pdev)
|
||||
{
|
||||
struct clk *otg_clk;
|
||||
|
@ -27,6 +34,8 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
|
|||
u32 rstcon;
|
||||
int err;
|
||||
|
||||
atomic_inc(&host_usage);
|
||||
|
||||
otg_clk = clk_get(&pdev->dev, "otg");
|
||||
if (IS_ERR(otg_clk)) {
|
||||
dev_err(&pdev->dev, "Failed to get otg clock\n");
|
||||
|
@ -39,6 +48,9 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
if (exynos4_usb_host_phy_is_on())
|
||||
return 0;
|
||||
|
||||
writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
|
||||
S5P_USBHOST_PHY_CONTROL);
|
||||
|
||||
|
@ -95,6 +107,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
|
|||
struct clk *otg_clk;
|
||||
int err;
|
||||
|
||||
if (atomic_dec_return(&host_usage) > 0)
|
||||
return 0;
|
||||
|
||||
otg_clk = clk_get(&pdev->dev, "otg");
|
||||
if (IS_ERR(otg_clk)) {
|
||||
dev_err(&pdev->dev, "Failed to get otg clock\n");
|
||||
|
|
|
@ -129,6 +129,7 @@ extern struct platform_device exynos4_device_dwmci;
|
|||
extern struct platform_device exynos4_device_i2s0;
|
||||
extern struct platform_device exynos4_device_i2s1;
|
||||
extern struct platform_device exynos4_device_i2s2;
|
||||
extern struct platform_device exynos4_device_ohci;
|
||||
extern struct platform_device exynos4_device_pcm0;
|
||||
extern struct platform_device exynos4_device_pcm1;
|
||||
extern struct platform_device exynos4_device_pcm2;
|
||||
|
|
Loading…
Reference in a new issue