summaryrefslogtreecommitdiff
path: root/firmware/target/sh/archos/ondio/usb-ondio.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh/archos/ondio/usb-ondio.c')
-rw-r--r--firmware/target/sh/archos/ondio/usb-ondio.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/firmware/target/sh/archos/ondio/usb-ondio.c b/firmware/target/sh/archos/ondio/usb-ondio.c
deleted file mode 100644
index 093ebd3ad8..0000000000
--- a/firmware/target/sh/archos/ondio/usb-ondio.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include <stdbool.h>
23#include "adc.h"
24#include "ata_mmc.h"
25#include "cpu.h"
26#include "hwcompat.h"
27#include "system.h"
28#include "usb.h"
29
30int usb_detect(void)
31{
32 return (adc_read(ADC_USB_POWER) <= 512) ? USB_INSERTED : USB_EXTRACTED;
33}
34
35void usb_enable(bool on)
36{
37 if (on)
38 {
39 mmc_enable_int_flash_clock(!mmc_detect());
40
41 if (!(HW_MASK & MMC_CLOCK_POLARITY))
42 and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */
43 or_b(0x20, &PADRL); /* enable USB */
44 and_b(~0x08, &PADRL); /* assert card detect */
45 }
46 else
47 {
48 if (!(HW_MASK & MMC_CLOCK_POLARITY))
49 or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */
50 and_b(~0x20, &PADRL); /* disable USB */
51 or_b(0x08, &PADRL); /* deassert card detect */
52 }
53}
54
55void usb_init_device(void)
56{
57 PACR2 &= ~0x04C0; /* use PA3 (card detect) and PA5 (USB enabled) as GPIO */
58 and_b(~0x20, &PADRL); /* disable USB */
59 or_b(0x08, &PADRL); /* deassert card detect */
60 or_b(0x28, &PAIORL); /* output for USB enable and card detect */
61}