Jonathan Corbet | f045f77 | 2009-12-01 20:29:39 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. |
| 3 | * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. |
| 4 | * Copyright 2009 Jonathan Corbet <corbet@lwn.net> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public |
| 8 | * License as published by the Free Software Foundation; |
| 9 | * either version 2, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even |
| 13 | * the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 14 | * A PARTICULAR PURPOSE.See the GNU General Public License |
| 15 | * 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., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #ifndef __VIA_CORE_H__ |
| 24 | #define __VIA_CORE_H__ |
Jonathan Corbet | 24b4d82 | 2010-04-22 13:48:09 -0600 | [diff] [blame] | 25 | #include <linux/spinlock.h> |
| 26 | #include <linux/pci.h> |
| 27 | |
Jonathan Corbet | f045f77 | 2009-12-01 20:29:39 -0700 | [diff] [blame] | 28 | /* |
| 29 | * A description of each known serial I2C/GPIO port. |
| 30 | */ |
| 31 | enum via_port_type { |
| 32 | VIA_PORT_NONE = 0, |
| 33 | VIA_PORT_I2C, |
| 34 | VIA_PORT_GPIO, |
| 35 | }; |
| 36 | |
| 37 | enum via_port_mode { |
| 38 | VIA_MODE_OFF = 0, |
| 39 | VIA_MODE_I2C, /* Used as I2C port */ |
| 40 | VIA_MODE_GPIO, /* Two GPIO ports */ |
| 41 | }; |
| 42 | |
| 43 | enum viafb_i2c_adap { |
| 44 | VIA_PORT_26 = 0, |
| 45 | VIA_PORT_31, |
| 46 | VIA_PORT_25, |
| 47 | VIA_PORT_2C, |
| 48 | VIA_PORT_3D, |
| 49 | }; |
| 50 | #define VIAFB_NUM_PORTS 5 |
| 51 | |
| 52 | struct via_port_cfg { |
| 53 | enum via_port_type type; |
| 54 | enum via_port_mode mode; |
Jonathan Corbet | 24b4d82 | 2010-04-22 13:48:09 -0600 | [diff] [blame] | 55 | u16 io_port; |
| 56 | u8 ioport_index; |
Jonathan Corbet | f045f77 | 2009-12-01 20:29:39 -0700 | [diff] [blame] | 57 | }; |
Jonathan Corbet | 24b4d82 | 2010-04-22 13:48:09 -0600 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * This is the global viafb "device" containing stuff needed by |
| 61 | * all subdevs. |
| 62 | */ |
| 63 | struct viafb_dev { |
| 64 | struct pci_dev *pdev; |
| 65 | int chip_type; |
Jonathan Corbet | 7582eb9 | 2010-04-22 17:39:34 -0600 | [diff] [blame^] | 66 | struct via_port_cfg *port_cfg; |
Jonathan Corbet | 24b4d82 | 2010-04-22 13:48:09 -0600 | [diff] [blame] | 67 | /* |
| 68 | * Spinlock for access to device registers. Not yet |
| 69 | * globally used. |
| 70 | */ |
| 71 | spinlock_t reg_lock; |
| 72 | /* |
| 73 | * The framebuffer MMIO region. Little, if anything, touches |
| 74 | * this memory directly, and certainly nothing outside of the |
| 75 | * framebuffer device itself. We *do* have to be able to allocate |
| 76 | * chunks of this memory for other devices, though. |
| 77 | */ |
| 78 | unsigned long fbmem_start; |
| 79 | long fbmem_len; |
| 80 | void __iomem *fbmem; |
| 81 | /* |
| 82 | * The MMIO region for device registers. |
| 83 | */ |
| 84 | unsigned long engine_start; |
| 85 | unsigned long engine_len; |
| 86 | void __iomem *engine_mmio; |
| 87 | |
| 88 | }; |
| 89 | |
Jonathan Corbet | f045f77 | 2009-12-01 20:29:39 -0700 | [diff] [blame] | 90 | #endif /* __VIA_CORE_H__ */ |