Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #include <asm/setup.h> |
| 15 | #include <mach/msm_memtypes.h> |
| 16 | |
| 17 | /* Return the number of chipselects populated with a memory bank */ |
| 18 | /* This is 7x30 only and will be extended in the future */ |
| 19 | |
| 20 | unsigned int get_num_populated_chipselects() |
| 21 | { |
| 22 | /* Currently, Linux cannot determine the memory toplogy of a target */ |
| 23 | /* This is a kludge until all this info is figured out from smem */ |
| 24 | |
| 25 | /* There is atleast one chipselect populated for hosting the 1st bank */ |
| 26 | unsigned int num_chipselects = 1; |
| 27 | int i; |
| 28 | for (i = 0; i < meminfo.nr_banks; i++) { |
| 29 | struct membank *bank = &meminfo.bank[i]; |
| 30 | if (bank->start == EBI1_PHYS_OFFSET) |
| 31 | num_chipselects++; |
| 32 | } |
| 33 | return num_chipselects; |
| 34 | } |
| 35 | |