mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-19 00:18:51 +09:00
![Simon Glass](/assets/img/avatar_default.png)
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
40 lines
716 B
C
40 lines
716 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Sandbox P2SB for testing
|
|
*
|
|
* Copyright 2019 Google LLC
|
|
*/
|
|
|
|
#define LOG_CATEGORY UCLASS_P2SB
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <asm/io.h>
|
|
#include <p2sb.h>
|
|
|
|
struct sandbox_p2sb_priv {
|
|
ulong base;
|
|
};
|
|
|
|
static int sandbox_p2sb_probe(struct udevice *dev)
|
|
{
|
|
struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
|
|
|
|
upriv->mmio_base = dm_pci_read_bar32(dev, 0);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct udevice_id sandbox_p2sb_ids[] = {
|
|
{ .compatible = "sandbox,p2sb" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(p2sb_sandbox) = {
|
|
.name = "p2sb_sandbox",
|
|
.id = UCLASS_P2SB,
|
|
.of_match = sandbox_p2sb_ids,
|
|
.probe = sandbox_p2sb_probe,
|
|
.priv_auto = sizeof(struct sandbox_p2sb_priv),
|
|
};
|