blob: 1133a23bdee321b9db8802da1b9b5e391e6ae016 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -04002/*
3 * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -04004 */
5
6#ifndef __MISC_H
7#define __MISC_H
8
Simon Glassce3574f2017-05-17 08:23:09 -06009#include <asm/arch/hardware.h>
10
Nick Thompson68bfdc82009-11-12 11:03:23 -050011/* 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 */
17struct 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};
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040022
Nick Thompsonced18552009-12-12 12:10:51 -050023/* pin table definition */
24struct pinmux_resource {
25 const struct pinmux_config *pins;
Wolfgang Denk62fb2b42021-09-27 17:42:39 +020026 const int n_pins;
Nick Thompsonced18552009-12-12 12:10:51 -050027};
28
29#define PINMUX_ITEM(item) { \
30 .pins = item, \
31 .n_pins = ARRAY_SIZE(item) \
32 }
33
Stefano Babic6470f732010-11-30 11:32:10 -050034struct lpsc_resource {
35 const int lpsc_no;
36};
37
Ben Gardiner1fb49e32010-09-23 09:58:43 -040038void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
Nick Thompson68bfdc82009-11-12 11:03:23 -050039int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
Nick Thompsonced18552009-12-12 12:10:51 -050040int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
41 int n_items);
Bartosz Golaszewski644c52f2019-04-29 18:37:12 +020042#if defined(CONFIG_DRIVER_TI_EMAC)
Stefano Babic6470f732010-11-30 11:32:10 -050043void davinci_emac_mii_mode_sel(int mode_sel);
44#endif
Stefano Babic6470f732010-11-30 11:32:10 -050045void irq_init(void);
46int da8xx_configure_lpsc_items(const struct lpsc_resource *item,
47 const int n_items);
Hugo Villeneuve4e352ef2008-07-11 15:10:13 -040048
49#endif /* __MISC_H */