Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Lyrtech <www.lyrtech.com> |
| 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __MISC_H |
| 23 | #define __MISC_H |
| 24 | |
Nick Thompson | ca8480d | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 25 | /* pin muxer definitions */ |
| 26 | #define PIN_MUX_NUM_FIELDS 8 /* Per register */ |
| 27 | #define PIN_MUX_FIELD_SIZE 4 /* n in bits */ |
| 28 | #define PIN_MUX_FIELD_MASK ((1 << PIN_MUX_FIELD_SIZE) - 1) |
| 29 | |
| 30 | /* pin definition */ |
| 31 | struct pinmux_config { |
| 32 | dv_reg *mux; /* Address of mux register */ |
| 33 | unsigned char value; /* Value to set in field */ |
| 34 | unsigned char field; /* field number */ |
| 35 | }; |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 36 | |
Nick Thompson | 90110e0 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 37 | /* pin table definition */ |
| 38 | struct pinmux_resource { |
| 39 | const struct pinmux_config *pins; |
| 40 | const int n_pins; |
| 41 | }; |
| 42 | |
| 43 | #define PINMUX_ITEM(item) { \ |
| 44 | .pins = item, \ |
| 45 | .n_pins = ARRAY_SIZE(item) \ |
| 46 | } |
| 47 | |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 48 | int dvevm_read_mac_address(uint8_t *buf); |
| 49 | void dv_configure_mac_address(uint8_t *rom_enetaddr); |
Nick Thompson | ca8480d | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 50 | int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins); |
Nick Thompson | 90110e0 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 51 | int davinci_configure_pin_mux_items(const struct pinmux_resource *item, |
| 52 | int n_items); |
Hugo Villeneuve | 264bbdd | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 53 | |
| 54 | #endif /* __MISC_H */ |