Re: [flashrom] ck804 enable improvement

2011-01-20 Thread Stefan Reinauer
* Jonathan A. Kollasch jakll...@kollasch.net [110120 20:04]:
 Ensure all read and write locks are disabled on ck804.
 
 Signed-off-by: Jonathan Kollasch jakll...@kollasch.net

 Index: chipset_enable.c
 ===
 --- chipset_enable.c  (revision 1253)
 +++ chipset_enable.c  (working copy)
 @@ -764,8 +764,50 @@
  
  static int enable_flash_ck804(struct pci_dev *dev, const char *name)
  {
 + uint32_t segctrl;
 + int segreg;
   uint8_t old, new;
  
 + for (segreg = 0x8c; segreg = 0x97; segreg += 4) {

In steps of 4 this would be 8c, 90 and 94. So it would make sense to
write = 0x94 or  0x98 as that would be the next offset that's reached.

Otherwise:
Acked-by: Stefan Reinauer ste...@coreboot.org

But you might want to wait for some final words from Carl-Daniel.

Stefan


___
flashrom mailing list
flashrom@flashrom.org
http://www.flashrom.org/mailman/listinfo/flashrom


[flashrom] ck804 enable improvement

2010-10-26 Thread Jonathan A. Kollasch
Hi,

Attached is a proposed patch for improving the ck804 chipset enable.

Comments?

Jonathan Kollasch
Index: chipset_enable.c
===
--- chipset_enable.c(revision 1216)
+++ chipset_enable.c(working copy)
@@ -776,8 +776,50 @@
 
 static int enable_flash_ck804(struct pci_dev *dev, const char *name)
 {
+   uint32_t segctrl;
+   int segreg;
uint8_t old, new;
 
+   for (segreg = 0x8c; segreg = 0x97; segreg += 4) {
+   segctrl = pci_read_long(dev, segreg);
+   if ((segctrl  0x) != 0x) {
+   /* reads or writes are locked */
+   if ((segctrl  0x) == 0x) {
+   /* we can unlock */
+   msg_pinfo(unlocking in %#02x\n, segreg);
+   pci_write_long(dev, segreg, 0x);
+   } else {
+   msg_pinfo(can't unlock in %#02x\n, segreg);
+   programmer_may_write = 0;
+   return -1;
+   }
+   }
+   segctrl = pci_read_long(dev, segreg);
+   if ((segctrl  0x) != 0x) {
+   msg_pinfo(still locked in %#02x (%#08x)\n,
+ segreg, segctrl);
+   programmer_may_write = 0;
+   return -1;
+   }
+   }
+   segctrl = pci_read_byte(dev, 0x8a);
+   if ((segctrl  0x3) != 0x0) {
+   if ((segctrl  0xc) == 0x0) {
+   msg_pinfo(unlocking in %#02x\n, 0x8a);
+   pci_write_byte(dev, 0x8a, segctrl  0xf0);
+   } else {
+   msg_pinfo(can't unlock in %#02x\n, 0x8a);
+   programmer_may_write = 0;
+   return -1;
+   }
+   }
+   segctrl = pci_read_byte(dev, 0x8a);
+   if ((segctrl  0x3) != 0x0) {
+   msg_pinfo(still locked in %#02x (%#08x)\n, segreg, segctrl);
+   programmer_may_write = 0;
+   return -1;
+   }
+
old = pci_read_byte(dev, 0x88);
new = old | 0xc0;
if (new != old) {
___
flashrom mailing list
flashrom@flashrom.org
http://www.flashrom.org/mailman/listinfo/flashrom