Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2008 Lyrtech <www.lyrtech.com> |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __MISC_H |
| 7 | #define __MISC_H |
| 8 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 9 | #include <linux/types.h> |
Simon Glass | ce3574f | 2017-05-17 08:23:09 -0600 | [diff] [blame] | 10 | #include <asm/arch/hardware.h> |
| 11 | |
Nick Thompson | 68bfdc8 | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 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 | }; |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 23 | |
Nick Thompson | ced1855 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 24 | /* pin table definition */ |
| 25 | struct pinmux_resource { |
| 26 | const struct pinmux_config *pins; |
Wolfgang Denk | 62fb2b4 | 2021-09-27 17:42:39 +0200 | [diff] [blame] | 27 | const int n_pins; |
Nick Thompson | ced1855 | 2009-12-12 12:10:51 -0500 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | #define PINMUX_ITEM(item) { \ |
| 31 | .pins = item, \ |
| 32 | .n_pins = ARRAY_SIZE(item) \ |
| 33 | } |
| 34 | |
Stefano Babic | 6470f73 | 2010-11-30 11:32:10 -0500 | [diff] [blame] | 35 | struct lpsc_resource { |
| 36 | const int lpsc_no; |
| 37 | }; |
| 38 | |
Ben Gardiner | 1fb49e3 | 2010-09-23 09:58:43 -0400 | [diff] [blame] | 39 | void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr); |
Nick Thompson | 68bfdc8 | 2009-11-12 11:03:23 -0500 | [diff] [blame] | 40 | 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] | 41 | int davinci_configure_pin_mux_items(const struct pinmux_resource *item, |
| 42 | int n_items); |
Bartosz Golaszewski | 644c52f | 2019-04-29 18:37:12 +0200 | [diff] [blame] | 43 | #if defined(CONFIG_DRIVER_TI_EMAC) |
Stefano Babic | 6470f73 | 2010-11-30 11:32:10 -0500 | [diff] [blame] | 44 | void davinci_emac_mii_mode_sel(int mode_sel); |
| 45 | #endif |
Stefano Babic | 6470f73 | 2010-11-30 11:32:10 -0500 | [diff] [blame] | 46 | void irq_init(void); |
| 47 | int da8xx_configure_lpsc_items(const struct lpsc_resource *item, |
| 48 | const int n_items); |
Hugo Villeneuve | 4e352ef | 2008-07-11 15:10:13 -0400 | [diff] [blame] | 49 | |
| 50 | #endif /* __MISC_H */ |