Rafał Miłecki | 23cb3b2 | 2012-07-17 16:26:41 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Broadcom specific AMBA |
| 3 | * ChipCommon NAND flash interface |
| 4 | * |
| 5 | * Licensed under the GNU/GPL. See COPYING for details. |
| 6 | */ |
| 7 | |
Rafał Miłecki | 371a004 | 2012-08-12 13:08:05 +0200 | [diff] [blame^] | 8 | #include <linux/platform_device.h> |
Rafał Miłecki | 23cb3b2 | 2012-07-17 16:26:41 +0200 | [diff] [blame] | 9 | #include <linux/bcma/bcma.h> |
Rafał Miłecki | 23cb3b2 | 2012-07-17 16:26:41 +0200 | [diff] [blame] | 10 | |
| 11 | #include "bcma_private.h" |
| 12 | |
Rafał Miłecki | 371a004 | 2012-08-12 13:08:05 +0200 | [diff] [blame^] | 13 | struct platform_device bcma_nflash_dev = { |
| 14 | .name = "bcma_nflash", |
| 15 | .num_resources = 0, |
| 16 | }; |
| 17 | |
Rafał Miłecki | 23cb3b2 | 2012-07-17 16:26:41 +0200 | [diff] [blame] | 18 | /* Initialize NAND flash access */ |
| 19 | int bcma_nflash_init(struct bcma_drv_cc *cc) |
| 20 | { |
Rafał Miłecki | 371a004 | 2012-08-12 13:08:05 +0200 | [diff] [blame^] | 21 | struct bcma_bus *bus = cc->core->bus; |
| 22 | |
| 23 | if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && |
| 24 | cc->core->id.rev != 0x38) { |
| 25 | bcma_err(bus, "NAND flash on unsupported board!\n"); |
| 26 | return -ENOTSUPP; |
| 27 | } |
| 28 | |
| 29 | if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) { |
| 30 | bcma_err(bus, "NAND flash not present according to ChipCommon\n"); |
| 31 | return -ENODEV; |
| 32 | } |
| 33 | |
| 34 | cc->nflash.present = true; |
| 35 | |
| 36 | /* Prepare platform device, but don't register it yet. It's too early, |
| 37 | * malloc (required by device_private_init) is not available yet. */ |
| 38 | bcma_nflash_dev.dev.platform_data = &cc->nflash; |
| 39 | |
Rafał Miłecki | 23cb3b2 | 2012-07-17 16:26:41 +0200 | [diff] [blame] | 40 | return 0; |
| 41 | } |