162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __MPC83XX_H__
362306a36Sopenharmony_ci#define __MPC83XX_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/init.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/* System Clock Control Register */
862306a36Sopenharmony_ci#define MPC83XX_SCCR_OFFS          0xA08
962306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_MASK      0x00f00000
1062306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_MPHCM_11  0x00c00000
1162306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_MPHCM_01  0x00400000
1262306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_MPHCM_10  0x00800000
1362306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_DRCM_11   0x00300000
1462306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_DRCM_01   0x00100000
1562306a36Sopenharmony_ci#define MPC83XX_SCCR_USB_DRCM_10   0x00200000
1662306a36Sopenharmony_ci#define MPC8315_SCCR_USB_MASK      0x00c00000
1762306a36Sopenharmony_ci#define MPC8315_SCCR_USB_DRCM_11   0x00c00000
1862306a36Sopenharmony_ci#define MPC8315_SCCR_USB_DRCM_01   0x00400000
1962306a36Sopenharmony_ci#define MPC837X_SCCR_USB_DRCM_11   0x00c00000
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* system i/o configuration register low */
2262306a36Sopenharmony_ci#define MPC83XX_SICRL_OFFS         0x114
2362306a36Sopenharmony_ci#define MPC834X_SICRL_USB_MASK     0x60000000
2462306a36Sopenharmony_ci#define MPC834X_SICRL_USB0         0x20000000
2562306a36Sopenharmony_ci#define MPC834X_SICRL_USB1         0x40000000
2662306a36Sopenharmony_ci#define MPC831X_SICRL_USB_MASK     0x00000c00
2762306a36Sopenharmony_ci#define MPC831X_SICRL_USB_ULPI     0x00000800
2862306a36Sopenharmony_ci#define MPC8315_SICRL_USB_MASK     0x000000fc
2962306a36Sopenharmony_ci#define MPC8315_SICRL_USB_ULPI     0x00000054
3062306a36Sopenharmony_ci#define MPC837X_SICRL_USB_MASK     0xf0000000
3162306a36Sopenharmony_ci#define MPC837X_SICRL_USB_ULPI     0x50000000
3262306a36Sopenharmony_ci#define MPC837X_SICRL_USBB_MASK    0x30000000
3362306a36Sopenharmony_ci#define MPC837X_SICRL_SD           0x20000000
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* system i/o configuration register high */
3662306a36Sopenharmony_ci#define MPC83XX_SICRH_OFFS         0x118
3762306a36Sopenharmony_ci#define MPC8308_SICRH_USB_MASK     0x000c0000
3862306a36Sopenharmony_ci#define MPC8308_SICRH_USB_ULPI     0x00040000
3962306a36Sopenharmony_ci#define MPC834X_SICRH_USB_UTMI     0x00020000
4062306a36Sopenharmony_ci#define MPC831X_SICRH_USB_MASK     0x000000e0
4162306a36Sopenharmony_ci#define MPC831X_SICRH_USB_ULPI     0x000000a0
4262306a36Sopenharmony_ci#define MPC8315_SICRH_USB_MASK     0x0000ff00
4362306a36Sopenharmony_ci#define MPC8315_SICRH_USB_ULPI     0x00000000
4462306a36Sopenharmony_ci#define MPC837X_SICRH_SPI_MASK     0x00000003
4562306a36Sopenharmony_ci#define MPC837X_SICRH_SD           0x00000001
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* USB Control Register */
4862306a36Sopenharmony_ci#define FSL_USB2_CONTROL_OFFS      0x500
4962306a36Sopenharmony_ci#define CONTROL_UTMI_PHY_EN        0x00000200
5062306a36Sopenharmony_ci#define CONTROL_REFSEL_24MHZ       0x00000040
5162306a36Sopenharmony_ci#define CONTROL_REFSEL_48MHZ       0x00000080
5262306a36Sopenharmony_ci#define CONTROL_PHY_CLK_SEL_ULPI   0x00000400
5362306a36Sopenharmony_ci#define CONTROL_OTG_PORT           0x00000020
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci/* USB PORTSC Registers */
5662306a36Sopenharmony_ci#define FSL_USB2_PORTSC1_OFFS      0x184
5762306a36Sopenharmony_ci#define FSL_USB2_PORTSC2_OFFS      0x188
5862306a36Sopenharmony_ci#define PORTSCX_PTW_16BIT          0x10000000
5962306a36Sopenharmony_ci#define PORTSCX_PTS_UTMI           0x00000000
6062306a36Sopenharmony_ci#define PORTSCX_PTS_ULPI           0x80000000
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci/*
6362306a36Sopenharmony_ci * Declaration for the various functions exported by the
6462306a36Sopenharmony_ci * mpc83xx_* files. Mostly for use by mpc83xx_setup
6562306a36Sopenharmony_ci */
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciextern void __noreturn mpc83xx_restart(char *cmd);
6862306a36Sopenharmony_ciextern long mpc83xx_time_init(void);
6962306a36Sopenharmony_ciint __init mpc837x_usb_cfg(void);
7062306a36Sopenharmony_ciint __init mpc834x_usb_cfg(void);
7162306a36Sopenharmony_ciint __init mpc831x_usb_cfg(void);
7262306a36Sopenharmony_ciextern void mpc83xx_ipic_init_IRQ(void);
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#ifdef CONFIG_PCI
7562306a36Sopenharmony_ciextern void mpc83xx_setup_pci(void);
7662306a36Sopenharmony_ci#else
7762306a36Sopenharmony_ci#define mpc83xx_setup_pci	NULL
7862306a36Sopenharmony_ci#endif
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciextern int mpc83xx_declare_of_platform_devices(void);
8162306a36Sopenharmony_ciextern void mpc83xx_setup_arch(void);
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci#endif				/* __MPC83XX_H__ */
84