xref: /openbmc/u-boot/arch/arm/mach-davinci/include/mach/davinci_misc.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
23d357619SMasahiro Yamada /*
33d357619SMasahiro Yamada  * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
43d357619SMasahiro Yamada  */
53d357619SMasahiro Yamada 
63d357619SMasahiro Yamada #ifndef __MISC_H
73d357619SMasahiro Yamada #define __MISC_H
83d357619SMasahiro Yamada 
989f5eaa1SSimon Glass #include <asm/arch/hardware.h>
1089f5eaa1SSimon Glass 
113d357619SMasahiro Yamada /* pin muxer definitions */
123d357619SMasahiro Yamada #define PIN_MUX_NUM_FIELDS	8	/* Per register */
133d357619SMasahiro Yamada #define PIN_MUX_FIELD_SIZE	4	/* n in bits */
143d357619SMasahiro Yamada #define PIN_MUX_FIELD_MASK	((1 << PIN_MUX_FIELD_SIZE) - 1)
153d357619SMasahiro Yamada 
163d357619SMasahiro Yamada /* pin definition */
173d357619SMasahiro Yamada struct pinmux_config {
183d357619SMasahiro Yamada 	dv_reg		*mux;		/* Address of mux register */
193d357619SMasahiro Yamada 	unsigned char	value;		/* Value to set in field */
203d357619SMasahiro Yamada 	unsigned char	field;		/* field number */
213d357619SMasahiro Yamada };
223d357619SMasahiro Yamada 
233d357619SMasahiro Yamada /* pin table definition */
243d357619SMasahiro Yamada struct pinmux_resource {
253d357619SMasahiro Yamada 	const struct pinmux_config	*pins;
263d357619SMasahiro Yamada 	const int 			n_pins;
273d357619SMasahiro Yamada };
283d357619SMasahiro Yamada 
293d357619SMasahiro Yamada #define PINMUX_ITEM(item) { \
303d357619SMasahiro Yamada 				.pins = item, \
313d357619SMasahiro Yamada 				.n_pins = ARRAY_SIZE(item) \
323d357619SMasahiro Yamada 			  }
333d357619SMasahiro Yamada 
343d357619SMasahiro Yamada struct lpsc_resource {
353d357619SMasahiro Yamada 	const int	lpsc_no;
363d357619SMasahiro Yamada };
373d357619SMasahiro Yamada 
383d357619SMasahiro Yamada int dvevm_read_mac_address(uint8_t *buf);
393d357619SMasahiro Yamada void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
403d357619SMasahiro Yamada int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
413d357619SMasahiro Yamada int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
423d357619SMasahiro Yamada 				    int n_items);
433d357619SMasahiro Yamada #if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_SOC_DA8XX)
443d357619SMasahiro Yamada void davinci_emac_mii_mode_sel(int mode_sel);
453d357619SMasahiro Yamada #endif
463d357619SMasahiro Yamada #if defined(CONFIG_SOC_DA8XX)
473d357619SMasahiro Yamada void irq_init(void);
483d357619SMasahiro Yamada int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
493d357619SMasahiro Yamada 				    const int n_items);
503d357619SMasahiro Yamada #endif
513d357619SMasahiro Yamada 
523d357619SMasahiro Yamada #endif /* __MISC_H */
53