~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/drivers/demo/demo-simple.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2013 Google, Inc
 
3
 *
 
4
 * (C) Copyright 2012
 
5
 * Pavel Herrmann <morpheus.ibis@gmail.com>
 
6
 *
 
7
 * SPDX-License-Identifier:     GPL-2.0+
 
8
 */
 
9
 
 
10
#include <common.h>
 
11
#include <dm.h>
 
12
#include <dm-demo.h>
 
13
#include <asm/io.h>
 
14
 
 
15
static int simple_hello(struct device *dev, int ch)
 
16
{
 
17
        const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 
18
 
 
19
        printf("Hello from %08x: %s %d\n", map_to_sysmem(dev), pdata->colour,
 
20
               pdata->sides);
 
21
 
 
22
        return 0;
 
23
}
 
24
 
 
25
static const struct demo_ops simple_ops = {
 
26
        .hello = simple_hello,
 
27
};
 
28
 
 
29
static int demo_shape_ofdata_to_platdata(struct device *dev)
 
30
{
 
31
        /* Parse the data that is common with all demo devices */
 
32
        return demo_parse_dt(dev);
 
33
}
 
34
 
 
35
static const struct device_id demo_shape_id[] = {
 
36
        { "demo-simple", 0 },
 
37
        { },
 
38
};
 
39
 
 
40
U_BOOT_DRIVER(demo_simple_drv) = {
 
41
        .name   = "demo_simple_drv",
 
42
        .of_match = demo_shape_id,
 
43
        .id     = UCLASS_DEMO,
 
44
        .ofdata_to_platdata = demo_shape_ofdata_to_platdata,
 
45
        .ops    = &simple_ops,
 
46
        .platdata_auto_alloc_size = sizeof(struct dm_demo_pdata),
 
47
};