31 #include <linux/kernel.h>
32 #include <linux/export.h>
39 #define MCC1_30MHZ_POWERUP_SELECT (1 << 14)
40 #define MCC1_DIV9 (1 << 13)
41 #define MCC1_ETHMIPS_POWERUP_SELECT (1 << 11)
42 #define MCC1_USB_POWERUP_SELECT (1 << 1)
43 #define MCC1_CLOCK108_POWERUP_SELECT (1 << 0)
46 #define MCC1_USB_CLOCK_HIGH_Z (0 << 4)
47 #define MCC1_USB_CLOCK_48MHZ (1 << 4)
48 #define MCC1_USB_CLOCK_24MHZ (2 << 4)
49 #define MCC1_USB_CLOCK_6MHZ (3 << 4)
51 #define MCC1_CONFIG (MCC1_30MHZ_POWERUP_SELECT | \
53 MCC1_ETHMIPS_POWERUP_SELECT | \
54 MCC1_USB_POWERUP_SELECT | \
55 MCC1_CLOCK108_POWERUP_SELECT)
58 #define MCC2_GMII_GCLK_TO_PAD (1 << 31)
59 #define MCC2_ETHER125_0_CLOCK_SELECT (1 << 29)
60 #define MCC2_RMII_0_CLOCK_SELECT (1 << 28)
61 #define MCC2_GMII_TX0_CLOCK_SELECT (1 << 27)
62 #define MCC2_GMII_RX0_CLOCK_SELECT (1 << 26)
63 #define MCC2_ETHER125_1_CLOCK_SELECT (1 << 24)
64 #define MCC2_RMII_1_CLOCK_SELECT (1 << 23)
65 #define MCC2_GMII_TX1_CLOCK_SELECT (1 << 22)
66 #define MCC2_GMII_RX1_CLOCK_SELECT (1 << 21)
67 #define MCC2_ETHER125_2_CLOCK_SELECT (1 << 19)
68 #define MCC2_RMII_2_CLOCK_SELECT (1 << 18)
69 #define MCC2_GMII_TX2_CLOCK_SELECT (1 << 17)
70 #define MCC2_GMII_RX2_CLOCK_SELECT (1 << 16)
72 #define ETHER_CLK_CONFIG (MCC2_GMII_GCLK_TO_PAD | \
73 MCC2_ETHER125_0_CLOCK_SELECT | \
74 MCC2_RMII_0_CLOCK_SELECT | \
75 MCC2_GMII_TX0_CLOCK_SELECT | \
76 MCC2_GMII_RX0_CLOCK_SELECT | \
77 MCC2_ETHER125_1_CLOCK_SELECT | \
78 MCC2_RMII_1_CLOCK_SELECT | \
79 MCC2_GMII_TX1_CLOCK_SELECT | \
80 MCC2_GMII_RX1_CLOCK_SELECT | \
81 MCC2_ETHER125_2_CLOCK_SELECT | \
82 MCC2_RMII_2_CLOCK_SELECT | \
83 MCC2_GMII_TX2_CLOCK_SELECT | \
84 MCC2_GMII_RX2_CLOCK_SELECT)
87 #define FSX4A_REF_SELECT (1 << 16)
88 #define FSX4B_REF_SELECT (1 << 17)
89 #define FSX4C_REF_SELECT (1 << 18)
90 #define DDR_PLL_REF_SELECT (1 << 19)
91 #define MIPS_PLL_REF_SELECT (1 << 20)
94 #define QAM_FS_SDIV_SHIFT 29
95 #define QAM_FS_MD_SHIFT 24
96 #define QAM_FS_MD_MASK 0x1f
97 #define QAM_FS_PE_SHIFT 8
99 #define QAM_FS_DISABLE_DIVIDE_BY_3 (1 << 5)
100 #define QAM_FS_ENABLE_PROGRAM (1 << 4)
101 #define QAM_FS_ENABLE_OUTPUT (1 << 3)
102 #define QAM_FS_SELECT_TEST_BYPASS (1 << 2)
103 #define QAM_FS_DISABLE_DIGITAL_STANDBY (1 << 1)
104 #define QAM_FS_CHOOSE_FS (1 << 0)
107 #define QAM_FS_NSDIV_54MHZ (1 << 2)
110 #define BCM1_USB2_CTL_BISTOK (1 << 11)
111 #define BCM1_USB2_CTL_PORT2_SHIFT_JK (1 << 7)
112 #define BCM1_USB2_CTL_PORT1_SHIFT_JK (1 << 6)
113 #define BCM1_USB2_CTL_PORT2_FAST_EDGE (1 << 5)
114 #define BCM1_USB2_CTL_PORT1_FAST_EDGE (1 << 4)
115 #define BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH (1 << 1)
116 #define BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH (1 << 0)
119 #define CRT_SPARE_PORT2_SHIFT_JK (1 << 21)
120 #define CRT_SPARE_PORT1_SHIFT_JK (1 << 20)
121 #define CRT_SPARE_PORT2_FAST_EDGE (1 << 19)
122 #define CRT_SPARE_PORT1_FAST_EDGE (1 << 18)
123 #define CRT_SPARE_DIVIDE_BY_9_FROM_432 (1 << 17)
124 #define CRT_SPARE_USB_DIVIDE_BY_9 (1 << 16)
127 #define USB_STBUS_OBC_STORE32_LOAD32 0x3
130 #define USB2_STBUS_MESS_SIZE_2 0x1
133 #define USB2_STBUS_CHUNK_SIZE_2 0x1
136 #define USB2_STRAP_HFREQ_SELECT 0x1
156 static u64 ehci_dmamask = 0xffffffffULL;
159 .name =
"powertv-ehci",
164 .dma_mask = &ehci_dmamask,
165 .coherent_dma_mask = 0xffffffff,
169 static struct resource ohci_resources[] = {
183 static u64 ohci_dmamask = 0xffffffffULL;
186 .name =
"powertv-ohci",
189 .resource = ohci_resources,
191 .dma_mask = &ohci_dmamask,
192 .coherent_dma_mask = 0xffffffff,
196 static unsigned usb_users;
221 static void fs_update(
u32 pe_bits,
int md_bits,
u32 sdiv_bits,
257 static void platform_configure_usb(
void)
259 u32 bcm1_usb2_ctl_value;
266 if (usb_users != 1) {
267 spin_unlock_irqrestore(&usb_regs_lock, flags);
275 fs_update(0x0000, -15, 0x02, 0, 0);
324 pr_err(
"Unknown ASIC type: %d\n", asic_type);
325 bcm1_usb2_ctl_value = 0;
332 asic_write(bcm1_usb2_ctl_value, usb2_control);
339 spin_unlock_irqrestore(&usb_regs_lock, flags);
342 static void platform_unconfigure_usb(
void)
350 spin_unlock_irqrestore(&usb_regs_lock, flags);
358 platform_configure_usb();
367 platform_configure_usb();
376 platform_unconfigure_usb();
385 platform_unconfigure_usb();
395 *ehci_dev = &ehci_device;
397 ehci_resources[0].
end += ehci_resources[0].
start;
399 *ohci_dev = &ohci_device;
401 ohci_resources[0].
end += ohci_resources[0].
start;