Patchwork spd_rom FIX H8QME-2+

login
register
about
Submitter Knut Kujat
Date 2010-03-12 11:00:40
Message ID <4B9A1ED8.1070106@gap.upv.es>
Download mbox | patch
Permalink /patch/1037/
State Accepted
Headers show

Comments

Knut Kujat - 2010-03-12 11:00:40
Hello,

this patch fixes the issue where the board wasn't able to start after
getting unplugged. I also added some GPIOs so now the power on led is
working.

Signed-off-by: Knut Kujat <knuku@gap.upv.es>

---
Myles Watson - 2010-03-12 16:09:58
On Fri, Mar 12, 2010 at 4:00 AM, Knut Kujat <knuku@gap.upv.es> wrote:

> Hello,
>
> this patch fixes the issue where the board wasn't able to start after
> getting unplugged. I also added some GPIOs so now the power on led is
> working.
>

The spacing doesn't look like it follows these guidelines:
http://www.coreboot.org/Development_Guidelines#Coding_Style

 static inline void activate_spd_rom(const struct mem_controller *ctrl)
 {
-    /* nothing to do */
+#define SMBUS_SWITCH1 0x70
+#define SMBUS_SWITCH2 0x72
+//     unsigned device=(ctrl->spd_addr[0])>>8;
It's unclear what this comment is for.  Maybe just drop it?

Signed-off-by: Knut Kujat <knuku@gap.upv.es>

With the formatting and comment addressed:
Acked-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Knut Kujat - 2010-03-12 17:26:38
Myles Watson escribió:
>
>
> On Fri, Mar 12, 2010 at 4:00 AM, Knut Kujat <knuku@gap.upv.es
> <mailto:knuku@gap.upv.es>> wrote:
>
>     Hello,
>
>     this patch fixes the issue where the board wasn't able to start after
>     getting unplugged. I also added some GPIOs so now the power on led is
>     working.
>
>
> The spacing doesn't look like it follows these guidelines:
> http://www.coreboot.org/Development_Guidelines#Coding_Style
Sorry, Patrick tells me so, too! I'll take a look at that article this
weekend.
>
>  static inline void activate_spd_rom(const struct mem_controller *ctrl)
>  {
> -    /* nothing to do */
> +#define SMBUS_SWITCH1 0x70
> +#define SMBUS_SWITCH2 0x72
> +//     unsigned device=(ctrl->spd_addr[0])>>8;
> It's unclear what this comment is for.  Maybe just drop it?
Yes, that one can go, since I was testing multiple options because I
wasn't really sure what to do.
>
>     Signed-off-by: Knut Kujat <knuku@gap.upv.es <mailto:knuku@gap.upv.es>>
>
> With the formatting and comment addressed:
> Acked-by: Myles Watson <mylesgw@gmail.com <mailto:mylesgw@gmail.com>>
>
> Thanks,
> Myles

thx and have a nice weekend,
Knut Kujat.

Patch

Index: src/mainboard/supermicro/h8qme_fam10/romstage.c
===================================================================
--- src/mainboard/supermicro/h8qme_fam10/romstage.c	(revisión: 5202)
+++ src/mainboard/supermicro/h8qme_fam10/romstage.c	(copia de trabajo)
@@ -97,7 +97,11 @@ 
 
 static inline void activate_spd_rom(const struct mem_controller *ctrl)
 {
-	/* nothing to do */
+#define SMBUS_SWITCH1 0x70
+#define SMBUS_SWITCH2 0x72
+//     unsigned device=(ctrl->spd_addr[0])>>8;
+    smbus_send_byte(SMBUS_SWITCH1, 5 & 0x0f);
+    smbus_send_byte(SMBUS_SWITCH2, (5 >> 4) & 0x0f);
 }
 
 static inline int spd_read_byte(unsigned device, unsigned address)
@@ -239,6 +243,47 @@ 
 #include "cpu/amd/microcode/microcode.c"
 #include "cpu/amd/model_10xxx/update_microcode.c"
 
+#define GPIO1_DEV PNP_DEV(0x2e, W83627HF_GAME_MIDI_GPIO1)
+#define GPIO2_DEV PNP_DEV(0x2e, W83627HF_GPIO2)
+#define GPIO3_DEV PNP_DEV(0x2e, W83627HF_GPIO3)
+void write_GPIO(void)
+{
+   pnp_enter_ext_func_mode(GPIO1_DEV);
+   pnp_set_logical_device(GPIO1_DEV);
+   pnp_write_config(GPIO1_DEV, 0x30, 0x01);
+   pnp_write_config(GPIO1_DEV, 0x60, 0x00);
+   pnp_write_config(GPIO1_DEV, 0x61, 0x00);
+   pnp_write_config(GPIO1_DEV, 0x62, 0x00);
+   pnp_write_config(GPIO1_DEV, 0x63, 0x00);
+   pnp_write_config(GPIO1_DEV, 0x70, 0x00);
+   pnp_write_config(GPIO1_DEV, 0xf0, 0xff);
+   pnp_write_config(GPIO1_DEV, 0xf1, 0xff);
+   pnp_write_config(GPIO1_DEV, 0xf2, 0x00);
+   pnp_exit_ext_func_mode(GPIO1_DEV);
+
+   pnp_enter_ext_func_mode(GPIO2_DEV);
+   pnp_set_logical_device(GPIO2_DEV);
+   pnp_write_config(GPIO2_DEV, 0x30, 0x01);
+   pnp_write_config(GPIO2_DEV, 0xf0, 0xef);
+   pnp_write_config(GPIO2_DEV, 0xf1, 0xff);
+   pnp_write_config(GPIO2_DEV, 0xf2, 0x00);
+   pnp_write_config(GPIO2_DEV, 0xf3, 0x00);
+   pnp_write_config(GPIO2_DEV, 0xf5, 0x48);
+   pnp_write_config(GPIO2_DEV, 0xf6, 0x00);
+   pnp_write_config(GPIO2_DEV, 0xf7, 0xc0);
+   pnp_exit_ext_func_mode(GPIO2_DEV);
+
+   pnp_enter_ext_func_mode(GPIO3_DEV);
+   pnp_set_logical_device(GPIO3_DEV);
+   pnp_write_config(GPIO3_DEV, 0x30, 0x00);
+   pnp_write_config(GPIO3_DEV, 0xf0, 0xff);
+   pnp_write_config(GPIO3_DEV, 0xf1, 0xff);
+   pnp_write_config(GPIO3_DEV, 0xf2, 0xff);
+   pnp_write_config(GPIO3_DEV, 0xf3, 0x40);
+   pnp_exit_ext_func_mode(GPIO3_DEV);
+}
+
+
 void real_main(unsigned long bist, unsigned long cpu_init_detectedx)
 {
   struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE);
@@ -261,8 +306,9 @@ 
  	w83627hf_enable_dev(SERIAL_DEV, CONFIG_TTYS0_BASE);
 	pnp_exit_ext_func_mode(SERIAL_DEV);
 
-        uart_init();
-        console_init();
+  uart_init();
+  console_init();
+  write_GPIO();
   printk_debug("\n");