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