Skip to content

Instantly share code, notes, and snippets.

@swiftgeek
Created March 19, 2015 02:29
Show Gist options
  • Save swiftgeek/6128eb9a6c9ad26f9fdf to your computer and use it in GitHub Desktop.
Save swiftgeek/6128eb9a6c9ad26f9fdf to your computer and use it in GitHub Desktop.
Apply to mr3420_3220v1/ap99/boot/u-boot/include/configs/ap99.h . Taken from #1 pupie post, fixed formatting and removed device-specific lines https://forum.openwrt.org/viewtopic.php?id=32512
--- ap99.h.original 2010-07-05 03:23:40.000000000 +0200
+++ ap99.h.fixed 2015-03-19 03:26:25.515365506 +0100
@@ -6,26 +6,38 @@
#define __CONFIG_H
#include <configs/ar7240.h>
+
+//Support 8M/16M flash
+#define FLASH_SIZE 16
+
/*-----------------------------------------------------------------------
* FLASH and environment organization
*/
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
+#if (FLASH_SIZE == 16)
+#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip, NEED TO CHECK FLASH DATASHEET */
+#else
#if (FLASH_SIZE == 8)
#define CFG_MAX_FLASH_SECT 128 /* max number of sectors on one chip */
#else
#define CFG_MAX_FLASH_SECT 64 /* max number of sectors on one chip */
#endif
+#endif
#ifdef CONFIG_K31
#define CFG_FLASH_SECTOR_SIZE (256*1024)
#define CFG_FLASH_SIZE 0x1000000 /* Total flash size */
#else
#define CFG_FLASH_SECTOR_SIZE (64*1024)
+#if (FLASH_SIZE == 16)
+#define CFG_FLASH_SIZE 0x01000000 /* Total flash size */
+#else
#if (FLASH_SIZE == 8)
#define CFG_FLASH_SIZE 0x00800000 /* Total flash size */
#else
#define CFG_FLASH_SIZE 0x00400000 /* Total flash size */
#endif
#endif
+#endif
#define ENABLE_DYNAMIC_CONF 1
#define CONFIG_SUPPORT_AR7241 1
@@ -64,16 +76,29 @@
#undef CONFIG_BOOTARGS
/* XXX - putting rootfs in last partition results in jffs errors */
-#if (FLASH_SIZE == 8)
-#define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),5120k(rootfs),896k(uImage),64k(NVRAM),1792k(ART)"
+#if (FLASH_SIZE == 16)
+#define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),13312k(rootfs),896k(uImage),64k(NVRAM),1792k(ART)"
#else
-#define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART) REVISIONID"
+ #if (FLASH_SIZE == 8)
+ #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),5120k(rootfs),896k(uImage),64k(NVRAM),1792k(ART)"
+ #else
+ #define CONFIG_BOOTARGS "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART) REVISIONID"
+ #endif
#endif
/* default mtd partition table */
#undef MTDPARTS_DEFAULT
+//#define MTDPARTS_DEFAULT "mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)"
+#if (FLASH_SIZE == 16)
+#define MTDPARTS_DEFAULT "mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),13312k(rootfs),896k(uImage),64k(NVRAM),1792k(ART)"
+#else
+#if (FLASH_SIZE == 8)
+#define MTDPARTS_DEFAULT "mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),5120k(rootfs),896k(uImage),64k(NVRAM),1792k(ART)"
+#else
#define MTDPARTS_DEFAULT "mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),2752k(rootfs),896k(uImage),64k(NVRAM),64k(ART)"
+#endif
+#endif
#undef CFG_PLL_FREQ
@@ -150,13 +175,18 @@
#if defined(CONFIG_K31)
#define CONFIG_BOOTCOMMAND "bootm 0x9f050000"
#else
+#if (FLASH_SIZE == 16)
+#define CONFIG_BOOTCOMMAND "bootm 0x9f020000"
+#else
#if (FLASH_SIZE == 8)
-#define CONFIG_BOOTCOMMAND "bootm 0x9f550000"
+//#define CONFIG_BOOTCOMMAND "bootm 0x9f550000"
+#define CONFIG_BOOTCOMMAND "bootm 0x9f020000"
#else
//#define CONFIG_BOOTCOMMAND "bootm 0x9f300000"
#define CONFIG_BOOTCOMMAND "bootm 0x9f020000"
#endif
#endif
+#endif
//#define CONFIG_FLASH_16BIT
/* DDR init values */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment