blob: 142a9365a96b733f84110d025615eb7518e736a0 [file] [log] [blame]
Angel Pons0612b272020-04-05 15:46:56 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Furquan Shaikha8198eb2017-08-04 16:12:19 -07002
Furquan Shaikh76cedd22020-05-02 10:24:23 -07003#include <acpi/acpi.h>
Patrick Rudolph49ae5962020-04-15 11:19:31 +02004#include <acpi/acpigen.h>
Kyösti Mälkki5daa1d32020-06-14 12:01:58 +03005#include <acpi/acpi_gnvs.h>
Subrata Banikafa07f72018-05-24 12:21:06 +05306#include <console/uart.h>
Aamir Bohra83f7bae2017-04-26 19:30:41 +05307#include <device/device.h>
8#include <device/pci.h>
Aamir Bohra01d75f42017-03-30 20:12:21 +05309#include <device/pci_def.h>
Aamir Bohra83f7bae2017-04-26 19:30:41 +053010#include <device/pci_ids.h>
Furquan Shaikha8198eb2017-08-04 16:12:19 -070011#include <device/pci_ops.h>
Aamir Bohra01d75f42017-03-30 20:12:21 +053012#include <intelblocks/lpss.h>
13#include <intelblocks/uart.h>
Subrata Banikafa07f72018-05-24 12:21:06 +053014#include <soc/pci_devs.h>
15#include <soc/iomap.h>
Patrick Rudolph49ae5962020-04-15 11:19:31 +020016#include <soc/irq.h>
Subrata Banikafa07f72018-05-24 12:21:06 +053017#include <soc/nvs.h>
Patrick Rudolph49ae5962020-04-15 11:19:31 +020018#include "chip.h"
Aamir Bohra01d75f42017-03-30 20:12:21 +053019
Furquan Shaikha8198eb2017-08-04 16:12:19 -070020#define UART_PCI_ENABLE (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER)
Subrata Banikafa07f72018-05-24 12:21:06 +053021#define UART_CONSOLE_INVALID_INDEX 0xFF
22
23extern const struct uart_gpio_pad_config uart_gpio_pads[];
24extern const int uart_max_index;
Furquan Shaikha8198eb2017-08-04 16:12:19 -070025
Usha P5e59a822019-08-09 18:42:00 +053026static void uart_lpss_init(const struct device *dev, uintptr_t baseaddr)
Furquan Shaikh3406dd62017-08-04 15:58:26 -070027{
Usha P5e59a822019-08-09 18:42:00 +053028 /* Ensure controller is in D0 state */
29 lpss_set_power_state(dev, STATE_D0);
30
Furquan Shaikh3406dd62017-08-04 15:58:26 -070031 /* Take UART out of reset */
32 lpss_reset_release(baseaddr);
33
34 /* Set M and N divisor inputs and enable clock */
35 lpss_clk_update(baseaddr, CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_M_VAL,
36 CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_N_VAL);
37}
38
Nico Huber62ddc492019-05-29 18:39:31 +020039#if CONFIG(INTEL_LPSS_UART_FOR_CONSOLE)
Felix Helde3a12472020-09-11 15:47:09 +020040uintptr_t uart_platform_base(unsigned int idx)
Aamir Bohra01d75f42017-03-30 20:12:21 +053041{
Nico Huberce8eebd2019-05-29 18:33:35 +020042 if (idx == CONFIG_UART_FOR_CONSOLE)
Nico Huber99954182019-05-29 23:33:06 +020043 return CONFIG_CONSOLE_UART_BASE_ADDRESS;
Nico Huberce8eebd2019-05-29 18:33:35 +020044 return 0;
Subrata Banikafa07f72018-05-24 12:21:06 +053045}
46#endif
47
48static int uart_get_valid_index(void)
49{
50 int index;
51
52 for (index = 0; index < uart_max_index; index++) {
53 if (uart_gpio_pads[index].console_index ==
54 CONFIG_UART_FOR_CONSOLE)
55 return index;
56 }
57 /* For valid index, code should not reach here */
58 return UART_CONSOLE_INVALID_INDEX;
59}
60
Aamir Bohra17cfba62019-07-25 20:56:54 +053061void uart_common_init(const struct device *device, uintptr_t baseaddr)
Subrata Banikafa07f72018-05-24 12:21:06 +053062{
63#if defined(__SIMPLE_DEVICE__)
Aamir Bohra17cfba62019-07-25 20:56:54 +053064 pci_devfn_t dev = PCI_BDF(device);
Subrata Banikafa07f72018-05-24 12:21:06 +053065#else
Aamir Bohra17cfba62019-07-25 20:56:54 +053066 const struct device *dev = device;
Subrata Banikafa07f72018-05-24 12:21:06 +053067#endif
Subrata Banikafa07f72018-05-24 12:21:06 +053068
Aamir Bohra01d75f42017-03-30 20:12:21 +053069 /* Set UART base address */
70 pci_write_config32(dev, PCI_BASE_ADDRESS_0, baseaddr);
71
72 /* Enable memory access and bus master */
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +020073 pci_write_config16(dev, PCI_COMMAND, UART_PCI_ENABLE);
Aamir Bohra01d75f42017-03-30 20:12:21 +053074
Usha P5e59a822019-08-09 18:42:00 +053075 uart_lpss_init(device, baseaddr);
Furquan Shaikha8198eb2017-08-04 16:12:19 -070076}
Aamir Bohra01d75f42017-03-30 20:12:21 +053077
Aamir Bohra17cfba62019-07-25 20:56:54 +053078const struct device *uart_get_device(void)
Furquan Shaikha8198eb2017-08-04 16:12:19 -070079{
80 /*
Nico Hubera96e66a2018-11-11 02:51:14 +010081 * This function will get called even if INTEL_LPSS_UART_FOR_CONSOLE
82 * config option is not selected.
83 * By default return NULL in this case to avoid compilation errors.
Furquan Shaikha8198eb2017-08-04 16:12:19 -070084 */
Julius Wernercd49cce2019-03-05 16:53:33 -080085 if (!CONFIG(INTEL_LPSS_UART_FOR_CONSOLE))
Subrata Banikafa07f72018-05-24 12:21:06 +053086 return NULL;
87
88 int console_index = uart_get_valid_index();
89
90 if (console_index != UART_CONSOLE_INVALID_INDEX)
91 return soc_uart_console_to_device(CONFIG_UART_FOR_CONSOLE);
92 else
93 return NULL;
Furquan Shaikha8198eb2017-08-04 16:12:19 -070094}
95
Subrata Banikafa07f72018-05-24 12:21:06 +053096bool uart_is_controller_initialized(void)
Furquan Shaikha8198eb2017-08-04 16:12:19 -070097{
Furquan Shaikha8198eb2017-08-04 16:12:19 -070098 uintptr_t base;
Aamir Bohra17cfba62019-07-25 20:56:54 +053099 const struct device *dev_uart = uart_get_device();
100
101 if (!dev_uart)
102 return false;
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700103
Subrata Banikafa07f72018-05-24 12:21:06 +0530104#if defined(__SIMPLE_DEVICE__)
Aamir Bohra17cfba62019-07-25 20:56:54 +0530105 pci_devfn_t dev = PCI_BDF(dev_uart);
Subrata Banikafa07f72018-05-24 12:21:06 +0530106#else
Aamir Bohra17cfba62019-07-25 20:56:54 +0530107 const struct device *dev = dev_uart;
Subrata Banikafa07f72018-05-24 12:21:06 +0530108#endif
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700109
110 base = pci_read_config32(dev, PCI_BASE_ADDRESS_0) & ~0xFFF;
111 if (!base)
112 return false;
113
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +0200114 if ((pci_read_config16(dev, PCI_COMMAND) & UART_PCI_ENABLE)
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700115 != UART_PCI_ENABLE)
116 return false;
117
118 return !lpss_is_controller_in_reset(base);
Aamir Bohra01d75f42017-03-30 20:12:21 +0530119}
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530120
Subrata Banikafa07f72018-05-24 12:21:06 +0530121static void uart_configure_gpio_pads(void)
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530122{
Subrata Banikafa07f72018-05-24 12:21:06 +0530123 int index = uart_get_valid_index();
124
125 if (index != UART_CONSOLE_INVALID_INDEX)
126 gpio_configure_pads(uart_gpio_pads[index].gpios,
127 MAX_GPIO_PAD_PER_UART);
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530128}
129
Subrata Banikafa07f72018-05-24 12:21:06 +0530130void uart_bootblock_init(void)
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700131{
Aamir Bohra17cfba62019-07-25 20:56:54 +0530132 const struct device *dev_uart;
133
134 dev_uart = uart_get_device();
135
136 if (!dev_uart)
137 return;
138
Subrata Banikafa07f72018-05-24 12:21:06 +0530139 /* Program UART BAR0, command, reset and clock register */
Aamir Bohra17cfba62019-07-25 20:56:54 +0530140 uart_common_init(dev_uart, CONFIG_CONSOLE_UART_BASE_ADDRESS);
Subrata Banikafa07f72018-05-24 12:21:06 +0530141
Subrata Banikafa07f72018-05-24 12:21:06 +0530142 /* Configure the 2 pads per UART. */
143 uart_configure_gpio_pads();
144}
145
146#if ENV_RAMSTAGE
147
148static void uart_read_resources(struct device *dev)
149{
150 pci_dev_read_resources(dev);
151
152 /* Set the configured UART base address for the debug port */
Julius Wernercd49cce2019-03-05 16:53:33 -0800153 if (CONFIG(INTEL_LPSS_UART_FOR_CONSOLE) &&
Nico Hubera96e66a2018-11-11 02:51:14 +0100154 uart_is_debug_controller(dev)) {
Subrata Banikafa07f72018-05-24 12:21:06 +0530155 struct resource *res = find_resource(dev, PCI_BASE_ADDRESS_0);
156 /* Need to set the base and size for the resource allocator. */
Nico Huber99954182019-05-29 23:33:06 +0200157 res->base = CONFIG_CONSOLE_UART_BASE_ADDRESS;
158 res->size = 0x1000;
Subrata Banikafa07f72018-05-24 12:21:06 +0530159 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED |
160 IORESOURCE_FIXED;
161 }
162}
163
164/*
165 * Check if UART debug port controller needs to be initialized on resume.
166 *
167 * Returns:
168 * true = when SoC wants debug port initialization on resume
169 * false = otherwise
170 */
171static bool pch_uart_init_debug_controller_on_resume(void)
172{
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300173 struct global_nvs *gnvs = acpi_get_gnvs();
Subrata Banikafa07f72018-05-24 12:21:06 +0530174
175 if (gnvs)
176 return !!gnvs->uior;
177
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700178 return false;
179}
180
181bool uart_is_debug_controller(struct device *dev)
182{
Subrata Banikafa07f72018-05-24 12:21:06 +0530183 return dev == uart_get_device();
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700184}
185
186/*
187 * This is a workaround to enable UART controller for the debug port if:
188 * 1. CONSOLE_SERIAL is not enabled in coreboot, and
189 * 2. This boot is S3 resume, and
190 * 3. SoC wants to initialize debug UART controller.
191 *
192 * This workaround is required because Linux kernel hangs on resume if console
193 * is not enabled in coreboot, but it is enabled in kernel and not suspended.
194 */
195static bool uart_controller_needs_init(struct device *dev)
196{
197 /*
Jonathan Neuschäfer5268b762018-02-12 12:24:25 +0100198 * If coreboot has CONSOLE_SERIAL enabled, the skip re-initializing
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700199 * controller here.
200 */
Julius Wernercd49cce2019-03-05 16:53:33 -0800201 if (CONFIG(CONSOLE_SERIAL))
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700202 return false;
203
204 /* If this device does not correspond to debug port, then skip. */
205 if (!uart_is_debug_controller(dev))
206 return false;
207
208 /* Initialize UART controller only on S3 resume. */
209 if (!acpi_is_wakeup_s3())
210 return false;
211
212 /*
Subrata Banikafa07f72018-05-24 12:21:06 +0530213 * check if SOC wants to initialize UART on resume
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700214 */
215 return pch_uart_init_debug_controller_on_resume();
216}
217
218static void uart_common_enable_resources(struct device *dev)
219{
220 pci_dev_enable_resources(dev);
221
222 if (uart_controller_needs_init(dev)) {
223 uintptr_t base;
224
225 base = pci_read_config32(dev, PCI_BASE_ADDRESS_0) & ~0xFFF;
226 if (base)
Usha P5e59a822019-08-09 18:42:00 +0530227 uart_lpss_init(dev, base);
Furquan Shaikha8198eb2017-08-04 16:12:19 -0700228 }
229}
230
Patrick Rudolph49ae5962020-04-15 11:19:31 +0200231static void uart_acpi_write_irq(const struct device *dev)
232{
233 struct acpi_irq irq;
234
235 switch (dev->path.pci.devfn) {
236 case PCH_DEVFN_UART0:
237 irq = (struct acpi_irq)ACPI_IRQ_LEVEL_LOW(LPSS_UART0_IRQ);
238 break;
239 case PCH_DEVFN_UART1:
240 irq = (struct acpi_irq)ACPI_IRQ_LEVEL_LOW(LPSS_UART1_IRQ);
241 break;
242 case PCH_DEVFN_UART2:
243 irq = (struct acpi_irq)ACPI_IRQ_LEVEL_LOW(LPSS_UART2_IRQ);
244 break;
245 default:
246 return;
247 }
248
249 acpi_device_write_interrupt(&irq);
250}
251
252/*
253 * Generate an ACPI entry if the device is enabled in devicetree for the ACPI
254 * LPSS driver. In this mode the device and vendor ID reads as 0xffff, but the
255 * PCI device is still there.
256 */
257static void uart_fill_ssdt(const struct device *dev)
258{
259 const char *scope = acpi_device_scope(dev);
260 const char *hid = acpi_device_hid(dev);
261 struct resource *res;
262
263 /* In ACPI mode the device is "invisible" */
264 if (!dev->hidden)
265 return;
266
267 if (!scope || !hid)
268 return;
269
270 res = probe_resource(dev, PCI_BASE_ADDRESS_0);
271 if (!res)
272 return;
273
274 /* Scope */
275 acpigen_write_scope(scope);
276
277 /* Device */
278 acpigen_write_device(acpi_device_name(dev));
279 acpigen_write_name_string("_HID", hid);
280 /*
281 * Advertise compatibility to Sunrise Point, as the Linux kernel doesn't support
282 * CannonPoint yet...
283 */
284 if (strcmp(hid, "INT34B8") == 0)
285 acpigen_write_name_string("_CID", "INT3448");
286 else if (strcmp(hid, "INT34B9") == 0)
287 acpigen_write_name_string("_CID", "INT3449");
288 else if (strcmp(hid, "INT34BA") == 0)
289 acpigen_write_name_string("_CID", "INT344A");
290
291 acpi_device_write_uid(dev);
292 acpigen_write_name_string("_DDN", "LPSS ACPI UART");
293 acpigen_write_STA(acpi_device_status(dev));
294
295 /* Resources */
296 acpigen_write_name("_CRS");
297 acpigen_write_resourcetemplate_header();
298
299 uart_acpi_write_irq(dev);
300 acpigen_write_mem32fixed(1, res->base, res->size);
301
302 acpigen_write_resourcetemplate_footer();
303
304 acpigen_pop_len(); /* Device */
305 acpigen_pop_len(); /* Scope */
306}
307
308static const char *uart_acpi_hid(const struct device *dev)
309{
310 switch (dev->device) {
311 case PCI_DEVICE_ID_INTEL_APL_UART0:
312 return "80865abc";
313 case PCI_DEVICE_ID_INTEL_APL_UART1:
314 return "80865abe";
315 case PCI_DEVICE_ID_INTEL_APL_UART2:
316 return "80865ac0";
317 case PCI_DEVICE_ID_INTEL_GLK_UART0:
318 return "808631bc";
319 case PCI_DEVICE_ID_INTEL_GLK_UART1:
320 return "808631be";
321 case PCI_DEVICE_ID_INTEL_GLK_UART2:
322 return "808631c0";
323 case PCI_DEVICE_ID_INTEL_GLK_UART3:
324 return "808631ee";
325 case PCI_DEVICE_ID_INTEL_SPT_UART0:
326 case PCI_DEVICE_ID_INTEL_SPT_H_UART0:
327 return "INT3448";
328 case PCI_DEVICE_ID_INTEL_SPT_UART1:
329 case PCI_DEVICE_ID_INTEL_SPT_H_UART1:
330 return "INT3449";
331 case PCI_DEVICE_ID_INTEL_SPT_UART2:
332 case PCI_DEVICE_ID_INTEL_SPT_H_UART2:
333 return "INT344A";
334 case PCI_DEVICE_ID_INTEL_CNP_H_UART0:
335 return "INT34B8";
336 case PCI_DEVICE_ID_INTEL_CNP_H_UART1:
337 return "INT34B9";
338 case PCI_DEVICE_ID_INTEL_CNP_H_UART2:
339 return "INT34BA";
340 default:
341 return NULL;
342 }
343}
344
345static const char *uart_acpi_name(const struct device *dev)
346{
347 switch (dev->device) {
348 case PCI_DEVICE_ID_INTEL_APL_UART0:
349 case PCI_DEVICE_ID_INTEL_GLK_UART0:
350 case PCI_DEVICE_ID_INTEL_SPT_UART0:
351 case PCI_DEVICE_ID_INTEL_SPT_H_UART0:
352 case PCI_DEVICE_ID_INTEL_CNP_H_UART0:
353 return "UAR0";
354 case PCI_DEVICE_ID_INTEL_APL_UART1:
355 case PCI_DEVICE_ID_INTEL_GLK_UART1:
356 case PCI_DEVICE_ID_INTEL_SPT_UART1:
357 case PCI_DEVICE_ID_INTEL_SPT_H_UART1:
358 case PCI_DEVICE_ID_INTEL_CNP_H_UART1:
359 return "UAR1";
360 case PCI_DEVICE_ID_INTEL_APL_UART2:
361 case PCI_DEVICE_ID_INTEL_GLK_UART2:
362 case PCI_DEVICE_ID_INTEL_SPT_UART2:
363 case PCI_DEVICE_ID_INTEL_SPT_H_UART2:
364 case PCI_DEVICE_ID_INTEL_CNP_H_UART2:
365 return "UAR2";
366 case PCI_DEVICE_ID_INTEL_GLK_UART3:
367 return "UAR3";
368 default:
369 return NULL;
370 }
371}
372
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530373static struct device_operations device_ops = {
Elyes HAOUAS1d191272018-11-27 12:23:48 +0100374 .read_resources = uart_read_resources,
375 .set_resources = pci_dev_set_resources,
376 .enable_resources = uart_common_enable_resources,
Subrata Banik6bbc91a2017-12-07 14:55:51 +0530377 .ops_pci = &pci_dev_ops_pci,
Patrick Rudolph49ae5962020-04-15 11:19:31 +0200378 .acpi_fill_ssdt = uart_fill_ssdt,
379 .acpi_hid = uart_acpi_hid,
380 .acpi_name = uart_acpi_name,
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530381};
382
383static const unsigned short pci_device_ids[] = {
384 PCI_DEVICE_ID_INTEL_SPT_UART0,
385 PCI_DEVICE_ID_INTEL_SPT_UART1,
386 PCI_DEVICE_ID_INTEL_SPT_UART2,
V Sowmya7c150472018-01-23 14:44:45 +0530387 PCI_DEVICE_ID_INTEL_SPT_H_UART0,
388 PCI_DEVICE_ID_INTEL_SPT_H_UART1,
389 PCI_DEVICE_ID_INTEL_SPT_H_UART2,
V Sowmyaacc2a482018-01-23 15:27:23 +0530390 PCI_DEVICE_ID_INTEL_KBP_H_UART0,
391 PCI_DEVICE_ID_INTEL_KBP_H_UART1,
392 PCI_DEVICE_ID_INTEL_KBP_H_UART2,
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530393 PCI_DEVICE_ID_INTEL_APL_UART0,
394 PCI_DEVICE_ID_INTEL_APL_UART1,
395 PCI_DEVICE_ID_INTEL_APL_UART2,
396 PCI_DEVICE_ID_INTEL_APL_UART3,
Lijian Zhaobbedef92017-07-29 16:38:38 -0700397 PCI_DEVICE_ID_INTEL_CNL_UART0,
398 PCI_DEVICE_ID_INTEL_CNL_UART1,
399 PCI_DEVICE_ID_INTEL_CNL_UART2,
Hannah Williamsf7149652017-05-13 16:18:02 -0700400 PCI_DEVICE_ID_INTEL_GLK_UART0,
401 PCI_DEVICE_ID_INTEL_GLK_UART1,
402 PCI_DEVICE_ID_INTEL_GLK_UART2,
403 PCI_DEVICE_ID_INTEL_GLK_UART3,
praveen hodagatta praneshe26c4a42018-09-20 03:49:45 +0800404 PCI_DEVICE_ID_INTEL_CNP_H_UART0,
405 PCI_DEVICE_ID_INTEL_CNP_H_UART1,
406 PCI_DEVICE_ID_INTEL_CNP_H_UART2,
Aamir Bohra9eac0392018-06-30 12:07:04 +0530407 PCI_DEVICE_ID_INTEL_ICP_UART0,
408 PCI_DEVICE_ID_INTEL_ICP_UART1,
409 PCI_DEVICE_ID_INTEL_ICP_UART2,
Ronak Kanabarda7ffb482019-02-05 01:51:13 +0530410 PCI_DEVICE_ID_INTEL_CMP_UART0,
411 PCI_DEVICE_ID_INTEL_CMP_UART1,
412 PCI_DEVICE_ID_INTEL_CMP_UART2,
Gaggery Tsai12a651c2019-12-05 11:23:20 -0800413 PCI_DEVICE_ID_INTEL_CMP_H_UART0,
414 PCI_DEVICE_ID_INTEL_CMP_H_UART1,
415 PCI_DEVICE_ID_INTEL_CMP_H_UART2,
Ravi Sarawadi6b5bf402019-10-21 22:25:04 -0700416 PCI_DEVICE_ID_INTEL_TGP_UART0,
417 PCI_DEVICE_ID_INTEL_TGP_UART1,
418 PCI_DEVICE_ID_INTEL_TGP_UART2,
Tan, Lean Sheng26136092020-01-20 19:13:56 -0800419 PCI_DEVICE_ID_INTEL_MCC_UART0,
420 PCI_DEVICE_ID_INTEL_MCC_UART1,
421 PCI_DEVICE_ID_INTEL_MCC_UART2,
Meera Ravindranath3f4af0d2020-02-12 16:01:22 +0530422 PCI_DEVICE_ID_INTEL_JSP_UART0,
423 PCI_DEVICE_ID_INTEL_JSP_UART1,
424 PCI_DEVICE_ID_INTEL_JSP_UART2,
Subrata Banikf672f7f2020-08-03 14:29:25 +0530425 PCI_DEVICE_ID_INTEL_ADP_S_UART0,
426 PCI_DEVICE_ID_INTEL_ADP_S_UART1,
427 PCI_DEVICE_ID_INTEL_ADP_S_UART2,
428 PCI_DEVICE_ID_INTEL_ADP_S_UART3,
429 PCI_DEVICE_ID_INTEL_ADP_S_UART4,
430 PCI_DEVICE_ID_INTEL_ADP_S_UART5,
431 PCI_DEVICE_ID_INTEL_ADP_S_UART6,
432 PCI_DEVICE_ID_INTEL_ADP_P_UART0,
433 PCI_DEVICE_ID_INTEL_ADP_P_UART1,
434 PCI_DEVICE_ID_INTEL_ADP_P_UART2,
435 PCI_DEVICE_ID_INTEL_ADP_P_UART3,
436 PCI_DEVICE_ID_INTEL_ADP_P_UART4,
437 PCI_DEVICE_ID_INTEL_ADP_P_UART5,
438 PCI_DEVICE_ID_INTEL_ADP_P_UART6,
Hannah Williamsf7149652017-05-13 16:18:02 -0700439 0,
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530440};
441
442static const struct pci_driver pch_uart __pci_driver = {
Subrata Banikafa07f72018-05-24 12:21:06 +0530443 .ops = &device_ops,
444 .vendor = PCI_VENDOR_ID_INTEL,
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530445 .devices = pci_device_ids,
446};
Patrick Rudolph49ae5962020-04-15 11:19:31 +0200447
448static void uart_enable(struct device *dev)
449{
450 struct soc_intel_common_block_uart_config *conf = dev->chip_info;
451 dev->ops = &device_ops;
452 dev->device = conf ? conf->devid : 0;
453}
454
455struct chip_operations soc_intel_common_block_uart_ops = {
456 CHIP_NAME("LPSS UART in ACPI mode")
457 .enable_dev = uart_enable
458};
459
Aamir Bohra83f7bae2017-04-26 19:30:41 +0530460#endif /* ENV_RAMSTAGE */