]> git.sur5r.net Git - u-boot/commitdiff
powerpc/km82xx: rework DIP switch detection
authorHuber, Andreas <Andreas.Huber@keymile.com>
Mon, 2 May 2011 22:56:54 +0000 (22:56 +0000)
committerWolfgang Denk <wd@denx.de>
Tue, 10 May 2011 20:48:45 +0000 (22:48 +0200)
Introduce a struct for the BFTICU FPGA to increase the readability of
the code. And the define CONFIG_SYS_BFTICU_BASE was removed because
the CONFIG_SYS_FPGA_BASE is already the base value for BFTICU registers.

Signed-off-by: Andreas Huber <andreas.huber@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Acked-by: Heiko Schocher <hs@denx.de>
cc: Wolfgang Denk <wd@denx.de>
cc: Detlev Zundel <dzu@denx.de>

board/keymile/common/common.h
board/keymile/km82xx/km82xx.c
include/configs/mgcoge.h

index 14768c99bbaad285794005e13eb369e4a1b001b5..6ce992ac32429786b50dec157d710d7dff4a918b 100644 (file)
@@ -39,6 +39,85 @@ struct km_bec_fpga {
        unsigned char   pgy_eth;
 };
 
+#define BFTICU_DIPSWITCH_MASK   0x0f
+
+/*
+ * BFTICU FPGA iomap
+ * BFTICU is used on mgcoge and mgocge3ne
+ */
+struct bfticu_iomap {
+       u8      xi_ena;         /* General defect enable */
+       u8      pack1[3];
+       u8      en_csn;
+       u8      pack2;
+       u8      safe_mem;
+       u8      pack3;
+       u8      id;
+       u8      pack4;
+       u8      rev;
+       u8      build;
+       u8      p_frc;
+       u8      p_msk;
+       u8      pack5[2];
+       u8      xg_int;
+       u8      pack6[15];
+       u8      s_conf;
+       u8      pack7;
+       u8      dmx_conf12;
+       u8      pack8;
+       u8      s_clkslv;
+       u8      pack9[11];
+       u8      d_conf;
+       u8      d_mask_ca;
+       u8      d_pll_del;
+       u8      pack10[16];
+       u8      t_conf_ca;
+       u8      t_mask_ca;
+       u8      pack11[13];
+       u8      m_def0;
+       u8      m_def1;
+       u8      m_def2;
+       u8      m_def3;
+       u8      m_def4;
+       u8      m_def5;
+       u8      m_def_trap0;
+       u8      m_def_trap1;
+       u8      m_def_trap2;
+       u8      m_def_trap3;
+       u8      m_def_trap4;
+       u8      m_def_trap5;
+       u8      m_mask_def0;
+       u8      m_mask_def1;
+       u8      m_mask_def2;
+       u8      m_mask_def3;
+       u8      m_mask_def4;
+       u8      m_mask_def5;
+       u8      m_def_mask0;
+       u8      m_def_mask1;
+       u8      m_def_mask2;
+       u8      m_def_mask3;
+       u8      m_def_mask4;
+       u8      m_def_mask5;
+       u8      m_def_pri;
+       u8      pack12[11];
+       u8      hw_status;
+       u8      pack13;
+       u8      hw_control1;
+       u8      hw_control2;
+       u8      hw_control3;
+       u8      pack14[7];
+       u8      led_on;         /* Leds */
+       u8      pack15;
+       u8      sfp_control;    /* SFP modules */
+       u8      pack16;
+       u8      alarm_control;  /* Alarm output */
+       u8      pack17;
+       u8      icps;           /* ICN clock pulse shaping */
+       u8      mswitch;        /* Read mode switch */
+       u8      pack18[6];
+       u8      pb_dbug;
+};
+
 #if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
 #define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
 #endif
index 6c511a6ea688f4c14b4cb2894a9c8603d6dccb19..01c0bfd29a2cf9becc55ba318ab14861539a9d5a 100644 (file)
@@ -296,15 +296,14 @@ int checkboard(void)
        return 0;
 }
 
-#define DIPSWITCH_OFFSET 0x89
-#define DIPSWITCH_MASK   0x0f
-
 int last_stage_init(void)
 {
+       struct bfticu_iomap *base =
+               (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE;
        u8 dip_switch;
-       /* Dip switch */
-       dip_switch = readb(CONFIG_SYS_BFTICU_BASE + DIPSWITCH_OFFSET);
-       dip_switch &= DIPSWITCH_MASK;
+
+       dip_switch = in_8(&base->mswitch);
+       dip_switch &= BFTICU_DIPSWITCH_MASK;
        /* dip switch 'full reset' or 'db erase' */
        if (dip_switch & 0x1 || dip_switch & 0x2) {
                /* start bootloader */
index dcde76c86f201ffb2cbc679f749acc5baa23bcb9..3d2ee2490b68021e609b481562e1e0476c040fc4 100644 (file)
@@ -61,7 +61,4 @@
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"
 
-/* bfticu address */
-#define CONFIG_SYS_BFTICU_BASE          0x40000000
-
 #endif /* __CONFIG_H */