aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/mach-mscc/include/mach/common.h
blob: d18ae78bfd1b47f06347847f03167e4e09222db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
 * Copyright (c) 2018 Microsemi Corporation
 */

#ifndef __ASM_MACH_COMMON_H
#define __ASM_MACH_COMMON_H

#if defined(CONFIG_SOC_OCELOT)
#include <mach/ocelot/ocelot.h>
#include <mach/ocelot/ocelot_devcpu_gcb.h>
#include <mach/ocelot/ocelot_devcpu_gcb_miim_regs.h>
#include <mach/ocelot/ocelot_icpu_cfg.h>
#elif defined(CONFIG_SOC_LUTON)
#include <mach/luton/luton.h>
#include <mach/luton/luton_devcpu_gcb.h>
#include <mach/luton/luton_devcpu_gcb_miim_regs.h>
#include <mach/luton/luton_icpu_cfg.h>
#else
#error Unsupported platform
#endif

#define MSCC_DDR_TO	0x20000000	/* DDR RAM base offset */
#define MSCC_MEMCTL1_TO	0x40000000	/* SPI/PI base offset */
#define MSCC_MEMCTL2_TO	0x50000000	/* SPI/PI base offset */
#define MSCC_FLASH_TO	MSCC_MEMCTL1_TO	/* Flash base offset */

#define VCOREIII_TIMER_DIVIDER 25	/* Clock tick ~ 0.1 us */

/* Common utility functions */

int mscc_phy_rd_wr(u8 read,
		   u32 miim_controller,
		   u8 miim_addr,
		   u8 addr,
		   u16 *value);

int mscc_phy_rd(u32 miim_controller,
		u8 miim_addr,
		u8 addr,
		u16 *value);

int mscc_phy_wr(u32 miim_controller,
		u8 miim_addr,
		u8 addr,
		u16 value);

void mscc_gpio_set_alternate(int gpio, int mode);

#endif				/* __ASM_MACH_COMMON_H */