Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Lyrtech <www.lyrtech.com> |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __MISC_H |
| 8 | #define __MISC_H |
| 9 | |
Nick Thompson | 68bfdc8 | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 10 | /* pin muxer definitions */ |
| 11 | #define PIN_MUX_NUM_FIELDS 8 /* Per register */ |
| 12 | #define PIN_MUX_FIELD_SIZE 4 /* n in bits */ |
| 13 | #define PIN_MUX_FIELD_MASK ((1 << PIN_MUX_FIELD_SIZE) - 1) |
| 14 | |
| 15 | /* pin definition */ |
| 16 | struct pinmux_config { |
| 17 | dv_reg *mux; /* Address of mux register */ |
| 18 | unsigned char value; /* Value to set in field */ |
| 19 | unsigned char field; /* field number */ |
| 20 | }; |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 21 | |
Nick Thompson | ced1855 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 22 | /* pin table definition */ |
| 23 | struct pinmux_resource { |
| 24 | const struct pinmux_config *pins; |
| 25 | const int n_pins; |
| 26 | }; |
| 27 | |
| 28 | #define PINMUX_ITEM(item) { \ |
| 29 | .pins = item, \ |
| 30 | .n_pins = ARRAY_SIZE(item) \ |
| 31 | } |
| 32 | |
Stefano Babic | 6470f73 | 2010-11-30 11:32:10 -0500 | [diff] [blame] | 33 | struct lpsc_resource { |
| 34 | const int lpsc_no; |
| 35 | }; |
| 36 | |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 37 | int dvevm_read_mac_address(uint8_t *buf); |
Ben Gardiner | 1fb49e3 | 2010-09-23 09:58:43 -0400 | [diff] [blame] | 38 | void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr); |
Nick Thompson | 68bfdc8 | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 39 | int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins); |
Nick Thompson | ced1855 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 40 | int davinci_configure_pin_mux_items(const struct pinmux_resource *item, |
| 41 | int n_items); |
Laurence Withers | b2c2c63 | 2011-07-18 09:53:14 -0400 | [diff] [blame] | 42 | #if defined(CONFIG_DRIVER_TI_EMAC) && defined(CONFIG_SOC_DA8XX) |
Stefano Babic | 6470f73 | 2010-11-30 11:32:10 -0500 | [diff] [blame] | 43 | void davinci_emac_mii_mode_sel(int mode_sel); |
| 44 | #endif |
| 45 | #if defined(CONFIG_SOC_DA8XX) |
| 46 | void irq_init(void); |
| 47 | int da8xx_configure_lpsc_items(const struct lpsc_resource *item, |
| 48 | const int n_items); |
| 49 | #endif |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 50 | |
| 51 | #endif /* __MISC_H */ |