forked from Minki/linux
f2c73464d7
This is the branch where we usually queue up cleanup efforts, moving drivers out of the architecture directory, header file restructuring, etc. Sometimes they tangle with new development so it's hard to keep it strictly to cleanups. Some of the things included in this branch are: * Atmel SAMA5 conversion to common clock * Reset framework conversion for tegra platforms - Some of this depends on tegra clock driver reworks that are shared with Mike Turquette's clk tree. * Tegra DMA refactoring, which are shared branches with the DMA tree. * Removal of some header files on exynos to prepare for multiplatform -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJS4Vf7AAoJEIwa5zzehBx3f9UP/jwMlbfbSZHfNQ/QG0SqZ9RD zvddyDMHY/qXnzgF3Dax+JR9BDDVy8AlQe713FCoiHJZggWRAbbavkx8gxITDrZQ 6NYaEkkuVxqyM8APl3PwMqYm8UZ8MUf4lCltlOA4jkesY9vue91AFnfyKh2CvHrn Leg4XT6mFzf/vYDL6RbvTz/Qr253uv3KvYBxkeiRNa0Y7OXRemEXSOfgxh0YGxUl LZ2IWQFOh/DH4kaeQI8V4G67X3ceHiFyhCnl0CPwfxaZaNBVaxvIFgIUTdetS6Sb zcXa029tE/Dfsr55vZAv9LUHEipCSOeE5rn2EJWehTWyM7vJ42Eozqgh+zfCjXS7 Ib6g2npsvIluQit/RdITu44h5yZlrQsLgKTGJ8jjXqbT4HQ/746W8b/TP0YLtbw7 N8oqr7k4vsZyF0dAYZQtfQUZeGISz67UbFcdzl9tmYOR7HFuAYkAQYst77zkVJf8 om59BAYYTG5FNjQ4I9AKUfJzxXYveI6AKpXSCCZiahpFM2D1CJIzp9Wi0GwK1HRR sFVWhS0dajvz63pVVC2tw5Sq4J7onRRNGIXFPoE5fkmlelm0/q0zzGjw3Z0nTqbZ 8zxuwuy2FfPJK11GbUAIhAgn1sCLYyAhl6IE+FsanGeMOSGIMrH0v5/HphAxoCXt BvqMDogyLoGPce1Gm3pJ =3CcT -----END PGP SIGNATURE----- Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC cleanups from Olof Johansson: "This is the branch where we usually queue up cleanup efforts, moving drivers out of the architecture directory, header file restructuring, etc. Sometimes they tangle with new development so it's hard to keep it strictly to cleanups. Some of the things included in this branch are: * Atmel SAMA5 conversion to common clock * Reset framework conversion for tegra platforms - Some of this depends on tegra clock driver reworks that are shared with Mike Turquette's clk tree. * Tegra DMA refactoring, which are shared branches with the DMA tree. * Removal of some header files on exynos to prepare for multiplatform" * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits) ARM: mvebu: move Armada 370/XP specific definitions to armada-370-xp.h ARM: mvebu: remove prototypes of non-existing functions from common.h ARM: mvebu: move ARMADA_XP_MAX_CPUS to armada-370-xp.h serial: sh-sci: Rework baud rate calculation serial: sh-sci: Compute overrun_bit without using baud rate algo serial: sh-sci: Remove unused GPIO request code serial: sh-sci: Move overrun_bit and error_mask fields out of pdata serial: sh-sci: Support resources passed through platform resources serial: sh-sci: Don't check IRQ in verify port operation serial: sh-sci: Set the UPF_FIXED_PORT flag serial: sh-sci: Remove duplicate interrupt check in verify port op serial: sh-sci: Simplify baud rate calculation algorithms serial: sh-sci: Remove baud rate calculation algorithm 5 serial: sh-sci: Sort headers alphabetically ARM: EXYNOS: Kill exynos_pm_late_initcall() ARM: EXYNOS: Consolidate selection of PM_GENERIC_DOMAINS for Exynos4 ARM: at91: switch Calao QIL-A9260 board to DT clk: at91: fix pmc_clk_ids data type attriubte PM / devfreq: use inclusion <mach/map.h> instead of <plat/map-s5p.h> ARM: EXYNOS: remove <mach/regs-clock.h> for exynos ...
131 lines
2.8 KiB
C
131 lines
2.8 KiB
C
/* linux/arch/arm/mach-s3c2410/usb-simtec.c
|
|
*
|
|
* Copyright 2004-2005 Simtec Electronics
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
*
|
|
* http://www.simtec.co.uk/products/EB2410ITX/
|
|
*
|
|
* Simtec BAST and Thorcom VR1000 USB port support functions
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#define DEBUG
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/list.h>
|
|
#include <linux/gpio.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/init.h>
|
|
#include <linux/device.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/mach/irq.h>
|
|
|
|
#include <mach/hardware.h>
|
|
#include <mach/gpio-samsung.h>
|
|
#include <asm/irq.h>
|
|
|
|
#include <linux/platform_data/usb-ohci-s3c2410.h>
|
|
#include <plat/devs.h>
|
|
|
|
#include "bast.h"
|
|
#include "simtec.h"
|
|
|
|
/* control power and monitor over-current events on various Simtec
|
|
* designed boards.
|
|
*/
|
|
|
|
static unsigned int power_state[2];
|
|
|
|
static void
|
|
usb_simtec_powercontrol(int port, int to)
|
|
{
|
|
pr_debug("usb_simtec_powercontrol(%d,%d)\n", port, to);
|
|
|
|
power_state[port] = to;
|
|
|
|
if (power_state[0] && power_state[1])
|
|
gpio_set_value(S3C2410_GPB(4), 0);
|
|
else
|
|
gpio_set_value(S3C2410_GPB(4), 1);
|
|
}
|
|
|
|
static irqreturn_t
|
|
usb_simtec_ocirq(int irq, void *pw)
|
|
{
|
|
struct s3c2410_hcd_info *info = pw;
|
|
|
|
if (gpio_get_value(S3C2410_GPG(10)) == 0) {
|
|
pr_debug("usb_simtec: over-current irq (oc detected)\n");
|
|
s3c2410_usb_report_oc(info, 3);
|
|
} else {
|
|
pr_debug("usb_simtec: over-current irq (oc cleared)\n");
|
|
s3c2410_usb_report_oc(info, 0);
|
|
}
|
|
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
|
|
{
|
|
int ret;
|
|
|
|
if (on) {
|
|
ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq,
|
|
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
|
"USB Over-current", info);
|
|
if (ret != 0) {
|
|
printk(KERN_ERR "failed to request usb oc irq\n");
|
|
}
|
|
} else {
|
|
free_irq(BAST_IRQ_USBOC, info);
|
|
}
|
|
}
|
|
|
|
static struct s3c2410_hcd_info usb_simtec_info __initdata = {
|
|
.port[0] = {
|
|
.flags = S3C_HCDFLG_USED
|
|
},
|
|
.port[1] = {
|
|
.flags = S3C_HCDFLG_USED
|
|
},
|
|
|
|
.power_control = usb_simtec_powercontrol,
|
|
.enable_oc = usb_simtec_enableoc,
|
|
};
|
|
|
|
|
|
int __init usb_simtec_init(void)
|
|
{
|
|
int ret;
|
|
|
|
printk("USB Power Control, Copyright 2004 Simtec Electronics\n");
|
|
|
|
ret = gpio_request(S3C2410_GPB(4), "USB power control");
|
|
if (ret < 0) {
|
|
pr_err("%s: failed to get GPB4\n", __func__);
|
|
return ret;
|
|
}
|
|
|
|
ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");
|
|
if (ret < 0) {
|
|
pr_err("%s: failed to get GPG10\n", __func__);
|
|
gpio_free(S3C2410_GPB(4));
|
|
return ret;
|
|
}
|
|
|
|
/* turn power on */
|
|
gpio_direction_output(S3C2410_GPB(4), 1);
|
|
gpio_direction_input(S3C2410_GPG(10));
|
|
|
|
s3c_ohci_set_platdata(&usb_simtec_info);
|
|
return 0;
|
|
}
|