1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#ifndef __MACH_MXS_DEVICES_H
#define __MACH_MXS_DEVICES_H
#include <common.h>
#include <sizes.h>
#include <xfuncs.h>
#include <driver.h>
#include <mach/imx-regs.h>
static inline struct device_d *mxs_add_nand(unsigned long gpmi_base, unsigned long bch_base)
{
struct resource res[] = {
{
.start = gpmi_base,
.end = gpmi_base + SZ_8K - 1,
.flags = IORESOURCE_MEM,
}, {
.start = bch_base,
.end = bch_base + SZ_8K - 1,
.flags = IORESOURCE_MEM,
},
};
struct device_d *dev = xzalloc(sizeof(*dev));
dev->resource = xzalloc(sizeof(struct resource) * ARRAY_SIZE(res));
memcpy(dev->resource, res, sizeof(struct resource) * ARRAY_SIZE(res));
dev->num_resources = ARRAY_SIZE(res);
strcpy(dev->name, "mxs_nand");
dev->id = DEVICE_ID_DYNAMIC;
platform_device_register(dev);
return dev;
};
static inline struct device_d *imx23_add_nand(void)
{
return mxs_add_nand(MXS_GPMI_BASE, MXS_BCH_BASE);
}
static inline struct device_d *imx28_add_nand(void)
{
return mxs_add_nand(MXS_GPMI_BASE, MXS_BCH_BASE);
}
#endif /* __MACH_MXS_DEVICES_H */
|