Simon Glass | 937bb47 | 2019-12-06 21:41:57 -0700 | [diff] [blame] | 1 | // 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 | |
Simon Glass | 937bb47 | 2019-12-06 21:41:57 -0700 | [diff] [blame] | 10 | #include <dm.h> |
| 11 | #include <asm/io.h> |
| 12 | #include <p2sb.h> |
| 13 | |
| 14 | struct sandbox_p2sb_priv { |
| 15 | ulong base; |
| 16 | }; |
| 17 | |
| 18 | static int sandbox_p2sb_probe(struct udevice *dev) |
| 19 | { |
| 20 | struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev); |
| 21 | |
| 22 | upriv->mmio_base = dm_pci_read_bar32(dev, 0); |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | static const struct udevice_id sandbox_p2sb_ids[] = { |
| 28 | { .compatible = "sandbox,p2sb" }, |
| 29 | { } |
| 30 | }; |
| 31 | |
| 32 | U_BOOT_DRIVER(p2sb_sandbox) = { |
| 33 | .name = "p2sb_sandbox", |
| 34 | .id = UCLASS_P2SB, |
| 35 | .of_match = sandbox_p2sb_ids, |
| 36 | .probe = sandbox_p2sb_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 37 | .priv_auto = sizeof(struct sandbox_p2sb_priv), |
Simon Glass | 937bb47 | 2019-12-06 21:41:57 -0700 | [diff] [blame] | 38 | }; |