1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27d13d21aSKumar Gala #ifndef __MPC83XX_H__
37d13d21aSKumar Gala #define __MPC83XX_H__
47d13d21aSKumar Gala 
57d13d21aSKumar Gala #include <linux/init.h>
67d13d21aSKumar Gala 
7c1616982SLi Yang /* System Clock Control Register */
8c1616982SLi Yang #define MPC83XX_SCCR_OFFS          0xA08
9e5a94af8SLi Yang #define MPC83XX_SCCR_USB_MASK      0x00f00000
10c1616982SLi Yang #define MPC83XX_SCCR_USB_MPHCM_11  0x00c00000
11c1616982SLi Yang #define MPC83XX_SCCR_USB_MPHCM_01  0x00400000
12c1616982SLi Yang #define MPC83XX_SCCR_USB_MPHCM_10  0x00800000
13c1616982SLi Yang #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
14c1616982SLi Yang #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
15c1616982SLi Yang #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
16b74a7e50SKim Phillips #define MPC8315_SCCR_USB_MASK      0x00c00000
17b74a7e50SKim Phillips #define MPC8315_SCCR_USB_DRCM_11   0x00c00000
181a9ebc0cSAnton Vorontsov #define MPC8315_SCCR_USB_DRCM_01   0x00400000
19e10241d8SLi Yang #define MPC837X_SCCR_USB_DRCM_11   0x00c00000
20c1616982SLi Yang 
21c1616982SLi Yang /* system i/o configuration register low */
22c1616982SLi Yang #define MPC83XX_SICRL_OFFS         0x114
23e5a94af8SLi Yang #define MPC834X_SICRL_USB_MASK     0x60000000
24b7d66c88SPeter Korsgaard #define MPC834X_SICRL_USB0         0x20000000
25b7d66c88SPeter Korsgaard #define MPC834X_SICRL_USB1         0x40000000
26e5a94af8SLi Yang #define MPC831X_SICRL_USB_MASK     0x00000c00
27e5a94af8SLi Yang #define MPC831X_SICRL_USB_ULPI     0x00000800
28c0a20159SAnton Vorontsov #define MPC8315_SICRL_USB_MASK     0x000000fc
29c0a20159SAnton Vorontsov #define MPC8315_SICRL_USB_ULPI     0x00000054
30e10241d8SLi Yang #define MPC837X_SICRL_USB_MASK     0xf0000000
31e10241d8SLi Yang #define MPC837X_SICRL_USB_ULPI     0x50000000
3289f37296SAnton Vorontsov #define MPC837X_SICRL_USBB_MASK    0x30000000
3389f37296SAnton Vorontsov #define MPC837X_SICRL_SD           0x20000000
34c1616982SLi Yang 
35c1616982SLi Yang /* system i/o configuration register high */
36c1616982SLi Yang #define MPC83XX_SICRH_OFFS         0x118
37fd066e85SIlya Yanok #define MPC8308_SICRH_USB_MASK     0x000c0000
38fd066e85SIlya Yanok #define MPC8308_SICRH_USB_ULPI     0x00040000
39e5a94af8SLi Yang #define MPC834X_SICRH_USB_UTMI     0x00020000
40e5a94af8SLi Yang #define MPC831X_SICRH_USB_MASK     0x000000e0
41e5a94af8SLi Yang #define MPC831X_SICRH_USB_ULPI     0x000000a0
42c0a20159SAnton Vorontsov #define MPC8315_SICRH_USB_MASK     0x0000ff00
43c0a20159SAnton Vorontsov #define MPC8315_SICRH_USB_ULPI     0x00000000
4489f37296SAnton Vorontsov #define MPC837X_SICRH_SPI_MASK     0x00000003
4589f37296SAnton Vorontsov #define MPC837X_SICRH_SD           0x00000001
46e5a94af8SLi Yang 
47e5a94af8SLi Yang /* USB Control Register */
48e5a94af8SLi Yang #define FSL_USB2_CONTROL_OFFS      0x500
49e5a94af8SLi Yang #define CONTROL_UTMI_PHY_EN        0x00000200
501a9ebc0cSAnton Vorontsov #define CONTROL_REFSEL_24MHZ       0x00000040
51e5a94af8SLi Yang #define CONTROL_REFSEL_48MHZ       0x00000080
52e5a94af8SLi Yang #define CONTROL_PHY_CLK_SEL_ULPI   0x00000400
53e5a94af8SLi Yang #define CONTROL_OTG_PORT           0x00000020
54e5a94af8SLi Yang 
55e5a94af8SLi Yang /* USB PORTSC Registers */
56e5a94af8SLi Yang #define FSL_USB2_PORTSC1_OFFS      0x184
57e5a94af8SLi Yang #define FSL_USB2_PORTSC2_OFFS      0x188
58e5a94af8SLi Yang #define PORTSCX_PTW_16BIT          0x10000000
59e5a94af8SLi Yang #define PORTSCX_PTS_UTMI           0x00000000
60e5a94af8SLi Yang #define PORTSCX_PTS_ULPI           0x80000000
61c1616982SLi Yang 
627d13d21aSKumar Gala /*
637d13d21aSKumar Gala  * Declaration for the various functions exported by the
647d13d21aSKumar Gala  * mpc83xx_* files. Mostly for use by mpc83xx_setup
657d13d21aSKumar Gala  */
667d13d21aSKumar Gala 
6795ec77c0SDaniel Axtens extern void __noreturn mpc83xx_restart(char *cmd);
6830f59336SKumar Gala extern long mpc83xx_time_init(void);
69*f4a88b0eSNick Child int __init mpc837x_usb_cfg(void);
70*f4a88b0eSNick Child int __init mpc834x_usb_cfg(void);
71*f4a88b0eSNick Child int __init mpc831x_usb_cfg(void);
72d4fb5ebdSDmitry Eremin-Solenikov extern void mpc83xx_ipic_init_IRQ(void);
73d4fb5ebdSDmitry Eremin-Solenikov 
74bede480dSDmitry Eremin-Solenikov #ifdef CONFIG_PCI
75bede480dSDmitry Eremin-Solenikov extern void mpc83xx_setup_pci(void);
76bede480dSDmitry Eremin-Solenikov #else
775c47c44fSMichael Ellerman #define mpc83xx_setup_pci	NULL
78bede480dSDmitry Eremin-Solenikov #endif
79bede480dSDmitry Eremin-Solenikov 
807669d58cSDmitry Eremin-Solenikov extern int mpc83xx_declare_of_platform_devices(void);
81fff69fd0SKevin Hao extern void mpc83xx_setup_arch(void);
827d13d21aSKumar Gala 
837d13d21aSKumar Gala #endif				/* __MPC83XX_H__ */
84