diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2013-06-18 07:33:40 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-18 14:46:46 -0400 |
commit | 7b5d6043de31290de98e9232cbd9a07968aef5bd (patch) | |
tree | 228e02ecbbe6b22041b8f6a5e7eba43bb852f5f9 /drivers/ssb/driver_chipcommon_sflash.c | |
parent | e861ef523cd91270d108edc394e648b1f9e6fbd5 (diff) | |
download | talos-obmc-linux-7b5d6043de31290de98e9232cbd9a07968aef5bd.tar.gz talos-obmc-linux-7b5d6043de31290de98e9232cbd9a07968aef5bd.zip |
ssb: register serial flash as platform device
This allows writing MTD driver working as a platform driver. In
platform_data it will receive struct ssb_sflash, which contains all
important data about flash (window, size).
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/driver_chipcommon_sflash.c')
-rw-r--r-- | drivers/ssb/driver_chipcommon_sflash.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/ssb/driver_chipcommon_sflash.c b/drivers/ssb/driver_chipcommon_sflash.c index 205f1c499c46..e84cf04f4416 100644 --- a/drivers/ssb/driver_chipcommon_sflash.c +++ b/drivers/ssb/driver_chipcommon_sflash.c @@ -9,6 +9,19 @@ #include "ssb_private.h" +static struct resource ssb_sflash_resource = { + .name = "ssb_sflash", + .start = SSB_FLASH2, + .end = 0, + .flags = IORESOURCE_MEM | IORESOURCE_READONLY, +}; + +struct platform_device ssb_sflash_dev = { + .name = "ssb_sflash", + .resource = &ssb_sflash_resource, + .num_resources = 1, +}; + struct ssb_sflash_tbl_e { char *name; u32 id; @@ -141,6 +154,12 @@ int ssb_sflash_init(struct ssb_chipcommon *cc) pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n", e->name, e->blocksize, e->numblocks); + /* Prepare platform device, but don't register it yet. It's too early, + * malloc (required by device_private_init) is not available yet. */ + ssb_sflash_dev.resource[0].end = ssb_sflash_dev.resource[0].start + + sflash->size; + ssb_sflash_dev.dev.platform_data = sflash; + pr_err("Serial flash support is not implemented yet!\n"); return -ENOTSUPP; |