1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
4  */
5 
6 #ifndef __MISC_H
7 #define __MISC_H
8 
9 #include <asm/arch/hardware.h>
10 
11 /* pin muxer definitions */
12 #define PIN_MUX_NUM_FIELDS	8	/* Per register */
13 #define PIN_MUX_FIELD_SIZE	4	/* n in bits */
14 #define PIN_MUX_FIELD_MASK	((1 << PIN_MUX_FIELD_SIZE) - 1)
15 
16 /* pin definition */
17 struct pinmux_config {
18 	dv_reg		*mux;		/* Address of mux register */
19 	unsigned char	value;		/* Value to set in field */
20 	unsigned char	field;		/* field number */
21 };
22 
23 /* pin table definition */
24 struct pinmux_resource {
25 	const struct pinmux_config	*pins;
26 	const int 			n_pins;
27 };
28 
29 #define PINMUX_ITEM(item) { \
30 				.pins = item, \
31 				.n_pins = ARRAY_SIZE(item) \
32 			  }
33 
34 struct lpsc_resource {
35 	const int	lpsc_no;
36 };
37 
38 int dvevm_read_mac_address(uint8_t *buf);
39 void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
40 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
41 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
42 				    int n_items);
43 #if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_SOC_DA8XX)
44 void davinci_emac_mii_mode_sel(int mode_sel);
45 #endif
46 #if defined(CONFIG_SOC_DA8XX)
47 void irq_init(void);
48 int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
49 				    const int n_items);
50 #endif
51 
52 #endif /* __MISC_H */
53