xref: /openbmc/u-boot/drivers/pch/pch9.c (revision b20c38a9)
1 /*
2  * Copyright (C) 2014 Google, Inc
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <dm.h>
9 #include <pch.h>
10 
11 #define SBASE_ADDR	0x54
12 
13 static int pch9_get_sbase(struct udevice *dev, ulong *sbasep)
14 {
15 	uint32_t sbase_addr;
16 
17 	dm_pci_read_config32(dev, SBASE_ADDR, &sbase_addr);
18 	*sbasep = sbase_addr & 0xfffffe00;
19 
20 	return 0;
21 }
22 
23 static enum pch_version pch9_get_version(struct udevice *dev)
24 {
25 	return PCHV_9;
26 }
27 
28 static const struct pch_ops pch9_ops = {
29 	.get_sbase	= pch9_get_sbase,
30 	.get_version	= pch9_get_version,
31 };
32 
33 static const struct udevice_id pch9_ids[] = {
34 	{ .compatible = "intel,pch9" },
35 	{ }
36 };
37 
38 U_BOOT_DRIVER(pch9_drv) = {
39 	.name		= "intel-pch9",
40 	.id		= UCLASS_PCH,
41 	.of_match	= pch9_ids,
42 	.ops		= &pch9_ops,
43 };
44