]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/pch/pch-uclass.c
dm: pch: Rename get_sbase op to get_spi_base
[people/ms/u-boot.git] / drivers / pch / pch-uclass.c
CommitLineData
452f5487
SG
1/*
2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <dm.h>
ca831f49 10#include <pch.h>
452f5487
SG
11#include <dm/root.h>
12
8b097916
SG
13DECLARE_GLOBAL_DATA_PTR;
14
3e389d8b 15int pch_get_spi_base(struct udevice *dev, ulong *sbasep)
ca831f49
SG
16{
17 struct pch_ops *ops = pch_get_ops(dev);
18
19 *sbasep = 0;
3e389d8b 20 if (!ops->get_spi_base)
ca831f49
SG
21 return -ENOSYS;
22
3e389d8b 23 return ops->get_spi_base(dev, sbasep);
ca831f49
SG
24}
25
ca831f49
SG
26int pch_set_spi_protect(struct udevice *dev, bool protect)
27{
28 struct pch_ops *ops = pch_get_ops(dev);
29
30 if (!ops->set_spi_protect)
31 return -ENOSYS;
32
33 return ops->set_spi_protect(dev, protect);
34}
35
452f5487
SG
36static int pch_uclass_post_bind(struct udevice *bus)
37{
38 /*
39 * Scan the device tree for devices
40 *
41 * Before relocation, only bind devices marked for pre-relocation
42 * use.
43 */
44 return dm_scan_fdt_node(bus, gd->fdt_blob, bus->of_offset,
45 gd->flags & GD_FLG_RELOC ? false : true);
46}
47
48UCLASS_DRIVER(pch) = {
49 .id = UCLASS_PCH,
50 .name = "pch",
51 .post_bind = pch_uclass_post_bind,
52};