···1313 * Overview:1414 * This is a device driver for the NAND flash controller found on1515 * the AMD CS5535/CS5536 companion chipsets for the Geode processor.1616+ * mtd-id for command line partitioning is cs553x_nand_cs[0-3]1717+ * where 0-3 reflects the chip select for NAND.1618 *1719 */18202121+#include <linux/kernel.h>1922#include <linux/slab.h>2023#include <linux/init.h>2124#include <linux/module.h>···247244 goto out_ior;248245 }249246247247+ new_mtd->name = kasprintf(GFP_KERNEL, "cs553x_nand_cs%d", cs);248248+250249 cs553x_mtd[cs] = new_mtd;251250 goto out;252251···277272 return 0;278273}279274275275+276276+#ifdef CONFIG_MTD_PARTITIONS277277+const char *part_probes[] = { "cmdlinepart", NULL };278278+#endif279279+280280+280281static int __init cs553x_init(void)281282{282283 int err = -ENXIO;283284 int i;284285 uint64_t val;286286+287287+ int mtd_parts_nb = 0;288288+ struct mtd_partition *mtd_parts = NULL;285289286290 /* If the CPU isn't a Geode GX or LX, abort */287291 if (!is_geode())···304290305291 /* If it doesn't have the NAND controller enabled, abort */306292 rdmsrl(MSR_DIVIL_BALL_OPTS, val);307307- if (val & 1) {293293+ if (val & PIN_OPT_IDE) {308294 printk(KERN_INFO "CS553x NAND controller: Flash I/O not enabled in MSR_DIVIL_BALL_OPTS.\n");309295 return -ENXIO;310296 }···320306 do mtdconcat etc. if we want to. */321307 for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {322308 if (cs553x_mtd[i]) {323323- add_mtd_device(cs553x_mtd[i]);324309325310 /* If any devices registered, return success. Else the last error. */311311+#ifdef CONFIG_MTD_PARTITIONS312312+ mtd_parts_nb = parse_mtd_partitions(cs553x_mtd[i], part_probes, &mtd_parts, 0);313313+ if (mtd_parts_nb > 0) {314314+ printk(KERN_NOTICE "Using command line partition definition\n");315315+ add_mtd_partitions(cs553x_mtd[i], mtd_parts, mtd_parts_nb);316316+ } else {317317+ add_mtd_device(cs553x_mtd[i]);318318+ }319319+#else320320+ add_mtd_device(cs553x_mtd[i]);321321+#endif326322 err = 0;327323 }328324 }···352328 void __iomem *mmio_base;353329354330 if (!mtd)355355- break;331331+ continue;356332357333 this = cs553x_mtd[i]->priv;358334 mmio_base = this->IO_ADDR_R;359335360336 /* Release resources, unregister device */361337 nand_release(cs553x_mtd[i]);338338+ kfree(cs553x_mtd[i]->name);362339 cs553x_mtd[i] = NULL;363340364341 /* unmap physical address */