blob: d80bca22a6b2fce145b34a5512d65e964b0ff74b [file] [log] [blame]
Simon Glass3e17ffb2019-12-06 21:41:57 -07001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Sandbox P2SB for testing
4 *
5 * Copyright 2019 Google LLC
6 */
7
8#define LOG_CATEGORY UCLASS_P2SB
9
10#include <common.h>
11#include <dm.h>
12#include <asm/io.h>
13#include <p2sb.h>
14
15struct sandbox_p2sb_priv {
16 ulong base;
17};
18
19static int sandbox_p2sb_probe(struct udevice *dev)
20{
21 struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
22
23 upriv->mmio_base = dm_pci_read_bar32(dev, 0);
24
25 return 0;
26}
27
28static const struct udevice_id sandbox_p2sb_ids[] = {
29 { .compatible = "sandbox,p2sb" },
30 { }
31};
32
33U_BOOT_DRIVER(p2sb_sandbox) = {
34 .name = "p2sb_sandbox",
35 .id = UCLASS_P2SB,
36 .of_match = sandbox_p2sb_ids,
37 .probe = sandbox_p2sb_probe,
Simon Glass41575d82020-12-03 16:55:17 -070038 .priv_auto = sizeof(struct sandbox_p2sb_priv),
Simon Glass3e17ffb2019-12-06 21:41:57 -070039};