Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2016 Arthur Heymans <arthur@aheymans.xyz> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <southbridge/intel/common/gpio.h> |
| 17 | |
| 18 | static const struct pch_gpio_set1 pch_gpio_set1_mode = { |
| 19 | .gpio1 = GPIO_MODE_GPIO, |
| 20 | .gpio5 = GPIO_MODE_GPIO, |
| 21 | .gpio6 = GPIO_MODE_GPIO, |
| 22 | .gpio7 = GPIO_MODE_GPIO, |
| 23 | .gpio8 = GPIO_MODE_GPIO, |
| 24 | .gpio9 = GPIO_MODE_GPIO, |
| 25 | .gpio10 = GPIO_MODE_GPIO, |
| 26 | .gpio12 = GPIO_MODE_GPIO, |
| 27 | .gpio13 = GPIO_MODE_GPIO, |
| 28 | .gpio14 = GPIO_MODE_GPIO, |
| 29 | .gpio15 = GPIO_MODE_GPIO, |
| 30 | .gpio22 = GPIO_MODE_GPIO, |
| 31 | .gpio24 = GPIO_MODE_GPIO, |
| 32 | .gpio25 = GPIO_MODE_GPIO, |
| 33 | .gpio26 = GPIO_MODE_GPIO, |
| 34 | .gpio27 = GPIO_MODE_GPIO, |
| 35 | .gpio28 = GPIO_MODE_GPIO, |
| 36 | }; |
| 37 | |
| 38 | static const struct pch_gpio_set1 pch_gpio_set1_direction = { |
| 39 | .gpio1 = GPIO_DIR_INPUT, |
| 40 | .gpio5 = GPIO_DIR_OUTPUT, |
| 41 | .gpio6 = GPIO_DIR_OUTPUT, |
| 42 | .gpio7 = GPIO_DIR_INPUT, |
| 43 | .gpio8 = GPIO_DIR_INPUT, |
| 44 | .gpio9 = GPIO_DIR_INPUT, |
| 45 | .gpio10 = GPIO_DIR_INPUT, |
| 46 | .gpio12 = GPIO_DIR_OUTPUT, |
| 47 | .gpio13 = GPIO_DIR_INPUT, |
| 48 | .gpio14 = GPIO_DIR_OUTPUT, |
| 49 | .gpio15 = GPIO_DIR_INPUT, |
| 50 | .gpio22 = GPIO_DIR_OUTPUT, |
| 51 | .gpio24 = GPIO_DIR_OUTPUT, |
| 52 | .gpio25 = GPIO_DIR_INPUT, |
| 53 | .gpio26 = GPIO_DIR_INPUT, |
| 54 | .gpio27 = GPIO_DIR_INPUT, |
| 55 | .gpio28 = GPIO_DIR_INPUT, |
| 56 | }; |
| 57 | |
| 58 | static const struct pch_gpio_set1 pch_gpio_set1_level = { |
Martin Roth | f95911a | 2017-06-24 21:45:13 -0600 | [diff] [blame] | 59 | #if IS_ENABLED(CONFIG_BOARD_APPLE_MACBOOK11) || \ |
| 60 | IS_ENABLED(CONFIG_BOARD_APPLE_MACBOOK21) |
Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 61 | .gpio5 = GPIO_LEVEL_LOW, |
| 62 | #else /* CONFIG_BOARD_APPLE_IMAC52 */ |
| 63 | .gpio5 = GPIO_LEVEL_HIGH, |
| 64 | #endif |
| 65 | .gpio6 = GPIO_LEVEL_HIGH, |
| 66 | .gpio12 = GPIO_LEVEL_LOW, |
| 67 | .gpio14 = GPIO_LEVEL_HIGH, |
| 68 | .gpio22 = GPIO_LEVEL_HIGH, |
| 69 | .gpio24 = GPIO_LEVEL_LOW, |
| 70 | }; |
| 71 | |
| 72 | static const struct pch_gpio_set1 pch_gpio_set1_invert = { |
| 73 | .gpio1 = GPIO_INVERT, |
| 74 | .gpio7 = GPIO_INVERT, |
Martin Roth | f95911a | 2017-06-24 21:45:13 -0600 | [diff] [blame] | 75 | #if IS_ENABLED(CONFIG_BOARD_APPLE_MACBOOK11) || \ |
| 76 | IS_ENABLED(CONFIG_BOARD_APPLE_MACBOOK21) |
Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 77 | .gpio13 = GPIO_INVERT, |
| 78 | #endif |
| 79 | }; |
| 80 | |
| 81 | static const struct pch_gpio_set1 pch_gpio_set1_blink = { |
| 82 | }; |
| 83 | |
| 84 | static const struct pch_gpio_set2 pch_gpio_set2_mode = { |
Martin Roth | f95911a | 2017-06-24 21:45:13 -0600 | [diff] [blame] | 85 | #if IS_ENABLED(CONFIG_BOARD_APPLE_IMAC52) |
Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 86 | .gpio35 = GPIO_MODE_GPIO, |
| 87 | #endif |
| 88 | .gpio38 = GPIO_MODE_GPIO, |
| 89 | .gpio39 = GPIO_MODE_GPIO, |
| 90 | .gpio48 = GPIO_MODE_GPIO, |
| 91 | }; |
| 92 | |
| 93 | static const struct pch_gpio_set2 pch_gpio_set2_direction = { |
Martin Roth | f95911a | 2017-06-24 21:45:13 -0600 | [diff] [blame] | 94 | #if IS_ENABLED(CONFIG_BOARD_APPLE_IMAC52) |
Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 95 | .gpio35 = GPIO_DIR_OUTPUT, |
| 96 | #endif |
| 97 | .gpio38 = GPIO_DIR_OUTPUT, |
| 98 | .gpio39 = GPIO_DIR_OUTPUT, |
| 99 | .gpio48 = GPIO_DIR_OUTPUT, |
| 100 | }; |
| 101 | |
| 102 | static const struct pch_gpio_set2 pch_gpio_set2_level = { |
Martin Roth | f95911a | 2017-06-24 21:45:13 -0600 | [diff] [blame] | 103 | #if IS_ENABLED(CONFIG_BOARD_APPLE_IMAC52) |
Arthur Heymans | 62902ca | 2016-11-29 14:13:43 +0100 | [diff] [blame] | 104 | .gpio35 = GPIO_LEVEL_LOW, |
| 105 | #endif |
| 106 | .gpio38 = GPIO_LEVEL_HIGH, |
| 107 | .gpio39 = GPIO_LEVEL_HIGH, |
| 108 | .gpio48 = GPIO_LEVEL_HIGH, |
| 109 | }; |
| 110 | |
| 111 | const struct pch_gpio_map mainboard_gpio_map = { |
| 112 | .set1 = { |
| 113 | .mode = &pch_gpio_set1_mode, |
| 114 | .direction = &pch_gpio_set1_direction, |
| 115 | .level = &pch_gpio_set1_level, |
| 116 | .blink = &pch_gpio_set1_blink, |
| 117 | .invert = &pch_gpio_set1_invert, |
| 118 | }, |
| 119 | .set2 = { |
| 120 | .mode = &pch_gpio_set2_mode, |
| 121 | .direction = &pch_gpio_set2_direction, |
| 122 | .level = &pch_gpio_set2_level, |
| 123 | }, |
| 124 | }; |