[U-Boot] [PATCH 0/3] powerpc, mpc52xx: update for digsy_mtc support

- change PHY addr for rev5 boards - protect default sectors in NOR flash again
Heiko Schocher (3): mpc52xx, digsy_mtc: change phy addr for rev5 boards. mtd, cfi: introduce void flash_protect_default(void) mpc52xx, digsy_mtc: protect default flash sectors
board/digsy_mtc/digsy_mtc.c | 7 ++++ drivers/mtd/cfi_flash.c | 77 +++++++++++++++++++++++-------------------- include/configs/digsy_mtc.h | 4 ++ include/flash.h | 1 + 4 files changed, 53 insertions(+), 36 deletions(-)
checkpatch:
total: 0 errors, 0 warnings, 27 lines checked
20110404_rebased/0001-mpc52xx-digsy_mtc-change-phy-addr-for-rev5-boards.patch has no obvious style problems and is ready for submission. total: 0 errors, 0 warnings, 96 lines checked
20110404_rebased/0002-mtd-cfi-introduce-void-flash_protect_default-void.patch has no obvious style problems and is ready for submission. total: 0 errors, 0 warnings, 14 lines checked
20110404_rebased/0003-mpc52xx-digsy_mtc-protect-default-flash-sectors.patch has no obvious style problems and is ready for submission.

- rev5 board has phy addr 1 -> adapt CONFIG_PHY_ADDR define in board config file. - also fixup the phy addr entry in dts, before booting Linux.
Signed-off-by: Heiko Schocher hs@denx.de --- board/digsy_mtc/digsy_mtc.c | 5 +++++ include/configs/digsy_mtc.h | 4 ++++ 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/board/digsy_mtc/digsy_mtc.c b/board/digsy_mtc/digsy_mtc.c index cbfdc9e..79cb3f1 100644 --- a/board/digsy_mtc/digsy_mtc.c +++ b/board/digsy_mtc/digsy_mtc.c @@ -405,6 +405,9 @@ int update_flash_size (int flash_size)
void ft_board_setup(void *blob, bd_t *bd) { + int phy_addr = CONFIG_PHY_ADDR; + char eth_path[] = "/soc5200@f0000000/mdio@3000/ethernet-phy@0"; + ft_cpu_setup(blob, bd); /* * There are 2 RTC nodes in the DTS, so remove @@ -422,5 +425,7 @@ void ft_board_setup(void *blob, bd_t *bd) #endif ft_adapt_flash_base(blob); #endif + /* fix up the phy address */ + do_fixup_by_path(blob, eth_path, "reg", &phy_addr, sizeof(int), 0); } #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */ diff --git a/include/configs/digsy_mtc.h b/include/configs/digsy_mtc.h index d9be2b5..d4ca30e 100644 --- a/include/configs/digsy_mtc.h +++ b/include/configs/digsy_mtc.h @@ -348,7 +348,11 @@ */ #define CONFIG_MPC5xxx_FEC 1 #define CONFIG_MPC5xxx_FEC_MII100 +#if defined(CONFIG_DIGSY_REV5) +#define CONFIG_PHY_ADDR 0x01 +#else #define CONFIG_PHY_ADDR 0x00 +#endif #define CONFIG_PHY_RESET_DELAY 1000
#define CONFIG_NETCONSOLE /* include NetConsole support */

Hi Heiko,
- rev5 board has phy addr 1 -> adapt CONFIG_PHY_ADDR define in board config file.
- also fixup the phy addr entry in dts, before booting Linux.
Signed-off-by: Heiko Schocher hs@denx.de
Acked-by: Detlev Zundel dzu@denx.de
Cheers Detlev

Dear Heiko Schocher,
In message 1301897422-27326-2-git-send-email-hs@denx.de you wrote:
- rev5 board has phy addr 1 -> adapt CONFIG_PHY_ADDR define in board config file.
- also fixup the phy addr entry in dts, before booting Linux.
Signed-off-by: Heiko Schocher hs@denx.de
board/digsy_mtc/digsy_mtc.c | 5 +++++ include/configs/digsy_mtc.h | 4 ++++ 2 files changed, 9 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

collect code which protects default sectors in a function, called flash_protect_default. So boardspecific code can call it too.
Signed-off-by: Heiko Schocher hs@denx.de cc: Stefan Roese sr@denx.de --- drivers/mtd/cfi_flash.c | 77 +++++++++++++++++++++++++---------------------- include/flash.h | 1 + 2 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0909fe7..e3b14d4 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2085,6 +2085,46 @@ static void cfi_flash_set_config_reg(u32 base, u16 val)
/*----------------------------------------------------------------------- */ + +void flash_protect_default(void) +{ + /* Monitor protection ON by default */ +#if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \ + (!defined(CONFIG_MONITOR_IS_IN_RAM)) + flash_protect(FLAG_PROTECT_SET, + CONFIG_SYS_MONITOR_BASE, + CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, + flash_get_info(CONFIG_SYS_MONITOR_BASE)); +#endif + + /* Environment protection ON by default */ +#ifdef CONFIG_ENV_IS_IN_FLASH + flash_protect(FLAG_PROTECT_SET, + CONFIG_ENV_ADDR, + CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, + flash_get_info(CONFIG_ENV_ADDR)); +#endif + + /* Redundant environment protection ON by default */ +#ifdef CONFIG_ENV_ADDR_REDUND + flash_protect(FLAG_PROTECT_SET, + CONFIG_ENV_ADDR_REDUND, + CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, + flash_get_info(CONFIG_ENV_ADDR_REDUND)); +#endif + +#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST) + for (i = 0; i < (sizeof(apl) / sizeof(struct apl_s)); i++) { + debug("autoprotecting from %08x to %08x\n", + apl[i].start, apl[i].start + apl[i].size - 1); + flash_protect(FLAG_PROTECT_SET, + apl[i].start, + apl[i].start + apl[i].size - 1, + flash_get_info(apl[i].start)); + } +#endif +} + unsigned long flash_init (void) { unsigned long size = 0; @@ -2171,42 +2211,7 @@ unsigned long flash_init (void) #endif /* CONFIG_SYS_FLASH_PROTECTION */ }
- /* Monitor protection ON by default */ -#if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \ - (!defined(CONFIG_MONITOR_IS_IN_RAM)) - flash_protect (FLAG_PROTECT_SET, - CONFIG_SYS_MONITOR_BASE, - CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, - flash_get_info(CONFIG_SYS_MONITOR_BASE)); -#endif - - /* Environment protection ON by default */ -#ifdef CONFIG_ENV_IS_IN_FLASH - flash_protect (FLAG_PROTECT_SET, - CONFIG_ENV_ADDR, - CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, - flash_get_info(CONFIG_ENV_ADDR)); -#endif - - /* Redundant environment protection ON by default */ -#ifdef CONFIG_ENV_ADDR_REDUND - flash_protect (FLAG_PROTECT_SET, - CONFIG_ENV_ADDR_REDUND, - CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, - flash_get_info(CONFIG_ENV_ADDR_REDUND)); -#endif - -#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST) - for (i = 0; i < (sizeof(apl) / sizeof(struct apl_s)); i++) { - debug("autoprotecting from %08x to %08x\n", - apl[i].start, apl[i].start + apl[i].size - 1); - flash_protect (FLAG_PROTECT_SET, - apl[i].start, - apl[i].start + apl[i].size - 1, - flash_get_info(apl[i].start)); - } -#endif - + flash_protect_default(); #ifdef CONFIG_FLASH_CFI_MTD cfi_mtd_init(); #endif diff --git a/include/flash.h b/include/flash.h index 1b6821a..0ca70d9 100644 --- a/include/flash.h +++ b/include/flash.h @@ -92,6 +92,7 @@ typedef unsigned long flash_sect_t; /* Prototypes */
extern unsigned long flash_init (void); +extern void flash_protect_default(void); extern void flash_print_info (flash_info_t *); extern int flash_erase (flash_info_t *, int, int); extern int flash_sect_erase (ulong addr_first, ulong addr_last);

On Monday 04 April 2011 08:10:21 Heiko Schocher wrote:
collect code which protects default sectors in a function, called flash_protect_default. So boardspecific code can call it too.
Applied to u-boot-cfi-flash. Thanks.
Cheers, Stefan
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de

call flash_protect_default() to protect default sectors.
Signed-off-by: Heiko Schocher hs@denx.de --- board/digsy_mtc/digsy_mtc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/board/digsy_mtc/digsy_mtc.c b/board/digsy_mtc/digsy_mtc.c index 79cb3f1..9f13a3d 100644 --- a/board/digsy_mtc/digsy_mtc.c +++ b/board/digsy_mtc/digsy_mtc.c @@ -42,6 +42,7 @@ #if defined(CONFIG_DIGSY_REV5) #include "is45s16800a2.h" #include <mtd/cfi_flash.h> +#include <flash.h> #else #include "is42s16800a-7t.h" #endif @@ -398,6 +399,7 @@ int update_flash_size (int flash_size) size += flash_get_size(base, i); } } + flash_protect_default(); gd->bd->bi_flashstart = base; return 0; }

Dear Heiko Schocher,
In message 1301897422-27326-4-git-send-email-hs@denx.de you wrote:
call flash_protect_default() to protect default sectors.
Signed-off-by: Heiko Schocher hs@denx.de
board/digsy_mtc/digsy_mtc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (4)
-
Detlev Zundel
-
Heiko Schocher
-
Stefan Roese
-
Wolfgang Denk