source: src/linux/universal/linux-3.2/drivers/usb/dwc_otg/dwc_otg_ifx.c @ 18256

Last change on this file since 18256 was 18256, checked in by BrainSlayer, 16 months ago

power up postfix for gigaset sx763

File size: 4.4 KB
Line 
1/******************************************************************************
2**
3** FILE NAME    : dwc_otg_ifx.c
4** PROJECT      : Twinpass/Danube
5** MODULES      : DWC OTG USB
6**
7** DATE         : 12 Auguest 2007
8** AUTHOR       : Sung Winder
9** DESCRIPTION  : Platform specific initialization.
10** COPYRIGHT    :       Copyright (c) 2007
11**                      Infineon Technologies AG
12**                      2F, No.2, Li-Hsin Rd., Hsinchu Science Park,
13**                      Hsin-chu City, 300 Taiwan.
14**
15**    This program is free software; you can redistribute it and/or modify
16**    it under the terms of the GNU General Public License as published by
17**    the Free Software Foundation; either version 2 of the License, or
18**    (at your option) any later version.
19**
20** HISTORY
21** $Date             $Author         $Comment
22** 12 Auguest 2007   Sung Winder     Initiate Version
23*******************************************************************************/
24#include "dwc_otg_ifx.h"
25
26#include <linux/platform_device.h>
27#include <linux/kernel.h>
28#include <linux/ioport.h>
29#include <linux/gpio.h>
30
31#include <asm/io.h>
32//#include <asm/mach-ifxmips/ifxmips.h>
33#include <lantiq_soc.h>
34
35#define IFXMIPS_GPIO_BASE_ADDR  (0xBE100B00)
36
37#define IFXMIPS_GPIO_P0_OUT     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0010))
38#define IFXMIPS_GPIO_P1_OUT     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0040))
39#define IFXMIPS_GPIO_P0_IN      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0014))
40#define IFXMIPS_GPIO_P1_IN      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0044))
41#define IFXMIPS_GPIO_P0_DIR     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0018))
42#define IFXMIPS_GPIO_P1_DIR     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0048))
43#define IFXMIPS_GPIO_P0_ALTSEL0     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x001C))
44#define IFXMIPS_GPIO_P1_ALTSEL0     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x004C))
45#define IFXMIPS_GPIO_P0_ALTSEL1     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0020))
46#define IFXMIPS_GPIO_P1_ALTSEL1     ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0050))
47#define IFXMIPS_GPIO_P0_OD      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0024))
48#define IFXMIPS_GPIO_P1_OD      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0054))
49#define IFXMIPS_GPIO_P0_STOFF       ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0028))
50#define IFXMIPS_GPIO_P1_STOFF       ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0058))
51#define IFXMIPS_GPIO_P0_PUDSEL      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x002C))
52#define IFXMIPS_GPIO_P1_PUDSEL      ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x005C))
53#define IFXMIPS_GPIO_P0_PUDEN       ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0030))
54#define IFXMIPS_GPIO_P1_PUDEN       ((u32 *)(IFXMIPS_GPIO_BASE_ADDR + 0x0060))
55
56
57#define writel ltq_w32
58#define readl ltq_r32
59void dwc_otg_power_on (void)
60{
61        // clear power
62        writel(readl(DANUBE_PMU_PWDCR) | 0x41, DANUBE_PMU_PWDCR);
63        // set clock gating
64        writel(readl(DANUBE_CGU_IFCCR) | 0x30, DANUBE_CGU_IFCCR);
65        // set power
66        writel(readl(DANUBE_PMU_PWDCR) & ~0x1, DANUBE_PMU_PWDCR);
67        writel(readl(DANUBE_PMU_PWDCR) & ~0x40, DANUBE_PMU_PWDCR);
68        writel(readl(DANUBE_PMU_PWDCR) & ~0x8000, DANUBE_PMU_PWDCR);
69#ifdef CONFIG_LANTIQ_MACH_GIGASX76X
70        writel(0x8b87, IFXMIPS_GPIO_P1_ALTSEL0);
71        writel(0x400, IFXMIPS_GPIO_P1_ALTSEL1);
72        writel(0xf3fc, IFXMIPS_GPIO_P1_OD);
73        writel(0xfb3e, IFXMIPS_GPIO_P1_DIR);
74        writel(0x850, IFXMIPS_GPIO_P1_PUDSEL);
75        writel(readl(IFXMIPS_GPIO_P1_OUT) | (1<<13), IFXMIPS_GPIO_P1_OUT);
76#endif
77#if 1//defined (DWC_HOST_ONLY)
78        // make the hardware be a host controller (default)
79        //clear_bit (DANUBE_USBCFG_HDSEL_BIT, (volatile unsigned long *)DANUBE_RCU_UBSCFG);
80        writel(readl(DANUBE_RCU_UBSCFG) & ~(1<<DANUBE_USBCFG_HDSEL_BIT), DANUBE_RCU_UBSCFG);
81
82        //#elif defined (DWC_DEVICE_ONLY)
83        /* set the controller to the device mode */
84        //    set_bit (DANUBE_USBCFG_HDSEL_BIT, (volatile unsigned long *)DANUBE_RCU_UBSCFG);
85#else
86#error  "For Danube/Twinpass, it should be HOST or Device Only."
87#endif
88
89        // set the HC's byte-order to big-endian
90        //set_bit (DANUBE_USBCFG_HOST_END_BIT, (volatile unsigned long *)DANUBE_RCU_UBSCFG);
91        writel(readl(DANUBE_RCU_UBSCFG) | (1<<DANUBE_USBCFG_HOST_END_BIT), DANUBE_RCU_UBSCFG);
92        //clear_bit (DANUBE_USBCFG_SLV_END_BIT, (volatile unsigned long *)DANUBE_RCU_UBSCFG);
93        writel(readl(DANUBE_RCU_UBSCFG) & ~(1<<DANUBE_USBCFG_SLV_END_BIT), DANUBE_RCU_UBSCFG);
94        //writel(0x400, DANUBE_RCU_UBSCFG);
95
96        // PHY configurations.
97        writel (0x14014, (volatile unsigned long *)0xbe10103c);
98}
99
100int ifx_usb_hc_init(unsigned long base_addr, int irq)
101{
102        return 0;
103}
104
105void ifx_usb_hc_remove(void)
106{
107}
Note: See TracBrowser for help on using the repository browser.