linux/arch/arm/plat-mxc/devices/platform-mxc_rnga.c
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2010 Pengutronix
   3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
   4 *
   5 * This program is free software; you can redistribute it and/or modify it under
   6 * the terms of the GNU General Public License version 2 as published by the
   7 * Free Software Foundation.
   8 */
   9#include <mach/hardware.h>
  10#include <mach/devices-common.h>
  11
  12struct imx_mxc_rnga_data {
  13        resource_size_t iobase;
  14};
  15
  16#define imx_mxc_rnga_data_entry_single(soc)                             \
  17        {                                                               \
  18                .iobase = soc ## _RNGA_BASE_ADDR,                       \
  19        }
  20
  21#ifdef CONFIG_SOC_IMX31
  22static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst =
  23        imx_mxc_rnga_data_entry_single(MX31);
  24#endif /* ifdef CONFIG_SOC_IMX31 */
  25
  26static struct platform_device *__init imx_add_mxc_rnga(
  27                const struct imx_mxc_rnga_data *data)
  28{
  29        struct resource res[] = {
  30                {
  31                        .start = data->iobase,
  32                        .end = data->iobase + SZ_16K - 1,
  33                        .flags = IORESOURCE_MEM,
  34                },
  35        };
  36        return imx_add_platform_device("mxc_rnga", -1,
  37                        res, ARRAY_SIZE(res), NULL, 0);
  38}
  39
  40static int __init imxXX_add_mxc_rnga(void)
  41{
  42        struct platform_device *ret;
  43
  44#if defined(CONFIG_SOC_IMX31)
  45        if (cpu_is_mx31())
  46                ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data);
  47        else
  48#endif /* if defined(CONFIG_SOC_IMX31) */
  49                ret = ERR_PTR(-ENODEV);
  50
  51        if (IS_ERR(ret))
  52                return PTR_ERR(ret);
  53
  54        return 0;
  55}
  56arch_initcall(imxXX_add_mxc_rnga);
  57