Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r3688 - in trunk/src/target/OM-2007.2/libraries/libmokoui2: .
      doc/reference/tmpl libmokoui ([EMAIL PROTECTED])
   2. r3689 - in
      trunk/src/target/OM-2007.2/applications/openmoko-dialer2: .
      src/phone-kit ([EMAIL PROTECTED])
   3. r3690 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
   4. r3691 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
   5. r3692 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: chris
Date: 2007-12-19 12:00:11 +0100 (Wed, 19 Dec 2007)
New Revision: 3688

Modified:
   trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
   
trunk/src/target/OM-2007.2/libraries/libmokoui2/doc/reference/tmpl/moko-stock.sgml
   
trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c
Log:
        * libmokoui/moko-finger-scroll.c: (moko_finger_scroll_refresh),
        (moko_finger_scroll_dispose):
        Change scrollbar calculation code, as shown in bug #1073 (thanks to
        Renato Filho), make sure to remove *all* source functions on dispose


Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog   2007-12-19 
10:09:40 UTC (rev 3687)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog   2007-12-19 
11:00:11 UTC (rev 3688)
@@ -1,3 +1,10 @@
+2007-12-19  Chris Lord  <[EMAIL PROTECTED]>
+
+       * libmokoui/moko-finger-scroll.c: (moko_finger_scroll_refresh),
+       (moko_finger_scroll_dispose):
+       Change scrollbar calculation code, as shown in bug #1073 (thanks to
+       Renato Filho), make sure to remove *all* source functions on dispose
+
 2007-10-19  Chris Lord  <[EMAIL PROTECTED]>
 
        * libmokoui/moko-finger-scroll.c:

Modified: 
trunk/src/target/OM-2007.2/libraries/libmokoui2/doc/reference/tmpl/moko-stock.sgml
===================================================================
--- 
trunk/src/target/OM-2007.2/libraries/libmokoui2/doc/reference/tmpl/moko-stock.sgml
  2007-12-19 10:09:40 UTC (rev 3687)
+++ 
trunk/src/target/OM-2007.2/libraries/libmokoui2/doc/reference/tmpl/moko-stock.sgml
  2007-12-19 11:00:11 UTC (rev 3688)
@@ -59,6 +59,13 @@
 
 
 
+<!-- ##### MACRO MOKO_STOCK_CALL_IGNORE ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### MACRO MOKO_STOCK_CALL_IN ##### -->
 <para>
 The "Incoming Call" item

Modified: 
trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c
===================================================================
--- 
trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c  
    2007-12-19 10:09:40 UTC (rev 3687)
+++ 
trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c  
    2007-12-19 11:00:11 UTC (rev 3688)
@@ -284,21 +284,17 @@
 moko_finger_scroll_refresh (MokoFingerScroll *scroll)
 {
        MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll);
-       GtkAllocation *allocation = &GTK_WIDGET (scroll)->allocation;
        GtkWidget *widget = GTK_BIN (priv->align)->child;
        gboolean vscroll, hscroll;
-       GtkRequisition req;
-       guint border;
        
        if (!widget) return;
        
        /* Calculate if we need scroll indicators */
-       border = gtk_container_get_border_width (GTK_CONTAINER (scroll));
-       gtk_widget_size_request (widget, &req);
-       if (req.width + (border * 2) > allocation->width) hscroll = TRUE;
-       else hscroll = FALSE;
-       if (req.height + (border * 2) > allocation->height) vscroll = TRUE;
-       else vscroll = FALSE;
+       gtk_widget_size_request (widget, NULL);
+       hscroll = (priv->hadjust->upper - priv->hadjust->lower >
+               priv->hadjust->page_size) ? TRUE : FALSE;
+       vscroll = (priv->vadjust->upper - priv->vadjust->lower >
+               priv->vadjust->page_size) ? TRUE : FALSE;
        
        /* TODO: Read ltr settings to decide which corner gets scroll
         * indicators?
@@ -729,12 +725,9 @@
 static void
 moko_finger_scroll_dispose (GObject * object)
 {
-       MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (object);
+       /*MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (object);*/
        
-       if (priv->idle_id) {
-               g_source_remove (priv->idle_id);
-               priv->idle_id = 0;
-       }
+       while (g_source_remove_by_user_data (object));
        
        if (G_OBJECT_CLASS (moko_finger_scroll_parent_class)->dispose)
                G_OBJECT_CLASS (moko_finger_scroll_parent_class)->




--- End Message ---
--- Begin Message ---
Author: chris
Date: 2007-12-19 13:29:45 +0100 (Wed, 19 Dec 2007)
New Revision: 3689

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/Makefile.am
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sms.c
Log:
        * configure.ac:
        Add AC_GNU_SOURCE for basename(), add libnotify

        * src/phone-kit/Makefile.am:
        Add libnotify

        * src/phone-kit/dialer-main.c: (main):
        Initialise libnotify

        * src/phone-kit/moko-dialer.c: (moko_dialer_init):
        Use moko_notify_get_default()

        * src/phone-kit/moko-notify.c: (moko_notify_start),
        (moko_notify_stop), (moko_notify_init), (moko_notify_get_default):
        * src/phone-kit/moko-notify.h:
        Add moko_notify_get_default() to share MokoNotify with other objects

        * src/phone-kit/moko-sms.c: (update_notification), (note_added_cb),
        (note_modified_cb), (note_removed_cb), (sms_store_opened_cb),
        (moko_sms_init):
        Add notifications with libnotify


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2007-12-19 11:00:11 UTC (rev 3688)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2007-12-19 12:29:45 UTC (rev 3689)
@@ -1,3 +1,27 @@
+2007-12-19  Chris Lord  <[EMAIL PROTECTED]>
+
+       * configure.ac:
+       Add AC_GNU_SOURCE for basename(), add libnotify
+
+       * src/phone-kit/Makefile.am:
+       Add libnotify
+
+       * src/phone-kit/dialer-main.c: (main):
+       Initialise libnotify
+
+       * src/phone-kit/moko-dialer.c: (moko_dialer_init):
+       Use moko_notify_get_default()
+
+       * src/phone-kit/moko-notify.c: (moko_notify_start),
+       (moko_notify_stop), (moko_notify_init), (moko_notify_get_default):
+       * src/phone-kit/moko-notify.h:
+       Add moko_notify_get_default() to share MokoNotify with other objects
+
+       * src/phone-kit/moko-sms.c: (update_notification), (note_added_cb),
+       (note_modified_cb), (note_removed_cb), (sms_store_opened_cb),
+       (moko_sms_init):
+       Add notifications with libnotify
+
 2007-12-04  Thomas Wood  <[EMAIL PROTECTED]>
 
        * src/phone-kit/moko-network.c: (on_network_registered),

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac       
2007-12-19 11:00:11 UTC (rev 3688)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac       
2007-12-19 12:29:45 UTC (rev 3689)
@@ -9,6 +9,7 @@
 AC_PROG_CC
 AC_STDC_HEADERS
 AC_PROG_LIBTOOL
+AC_GNU_SOURCE
 
 # base deps
 PKG_CHECK_MODULES(DIALER, 
@@ -21,6 +22,7 @@
                   libpulse)
 
 PKG_CHECK_MODULES(JANA, libjana libjana-ecal)
+PKG_CHECK_MODULES(NOTIFY, libnotify)
 
 old_cflags=$CFLAGS
 CFLAGS=$DIALER_CFLAGS

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/Makefile.am
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/Makefile.am
  2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/Makefile.am
  2007-12-19 12:29:45 UTC (rev 3689)
@@ -1,5 +1,5 @@
 AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
-AM_CFLAGS = -Wall @DIALER_CFLAGS@ @JANA_CFLAGS@
+AM_CFLAGS = -Wall @DIALER_CFLAGS@ @JANA_CFLAGS@ @NOTIFY_CFLAGS@
 
 INCLUDES = -I$(top_srcdir)/src/common
 
@@ -17,7 +17,7 @@
        moko-pin.c moko-pin.h \
        moko-mcc-dc.h
 
-phone_kit_LDADD = @DIALER_LIBS@ @JANA_LIBS@ 
$(top_srcdir)/src/common/libdialer-common.a
+phone_kit_LDADD = @DIALER_LIBS@ @JANA_LIBS@ @NOTIFY_LIBS@ 
$(top_srcdir)/src/common/libdialer-common.a
 
 
 %-glue.h: %-dbus.xml

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c
        2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c
        2007-12-19 12:29:45 UTC (rev 3689)
@@ -13,12 +13,18 @@
  *  GNU Lesser Public License for more details.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <gtk/gtk.h>
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
 #include <glib-object.h>
+#include <libnotify/notify.h>
 
 #include "moko-network.h"
 #include "moko-dialer.h"
@@ -64,6 +70,7 @@
   DBusGProxy *proxy;
   GError *error = NULL;
   guint32 ret;
+  char *prog;
 
   /* initialise type system */
   g_type_init ();
@@ -110,6 +117,9 @@
 
   /* Initialize Threading & GTK+ */
   gtk_init (&argc, &argv);
+  
+  /* Initialise libnotify */
+  notify_init (basename (argv[0]));
 
   /* Create the PhoneKit objects */
   network = moko_network_get_default ();

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
        2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
        2007-12-19 12:29:45 UTC (rev 3689)
@@ -811,7 +811,7 @@
   priv->contacts = moko_contacts_get_default ();
 
   /* Load the notification object */
-  priv->notify = moko_notify_new ();
+  priv->notify = moko_notify_get_default ();
 
 
   /* Talking: This is the object that handles interaction with the user */

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c
        2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c
        2007-12-19 12:29:45 UTC (rev 3689)
@@ -42,7 +42,7 @@
 
 struct _MokoNotifyPrivate
 {
-  gboolean    started;
+  int    started;
 
   /* Sound stuff */
   pa_context *pac;
@@ -254,9 +254,9 @@
   g_return_if_fail (MOKO_IS_NOTIFY (notify));
   priv = notify->priv;
 
-  if (priv->started)
+  priv->started ++;
+  if (priv->started != 1)
     return;
-  priv->started = TRUE;
 
   moko_notify_check_brightness ();
   moko_notify_start_vibrate ();
@@ -274,10 +274,12 @@
 
   if (!priv->started)
     return;
-  priv->started = FALSE;
+  priv->started --;
 
-  moko_notify_stop_vibrate ();
-  moko_notify_stop_ringtone (notify);
+  if (!priv->started) {
+    moko_notify_stop_vibrate ();
+    moko_notify_stop_ringtone (notify);
+  }
 }
 
 /* GObject functions */
@@ -313,7 +315,7 @@
 
   priv = notify->priv = MOKO_NOTIFY_GET_PRIVATE (notify);
 
-  priv->started = FALSE;
+  priv->started = 0;
   priv->pac = NULL;
 
   /* Start up pulse audio */
@@ -344,3 +346,13 @@
   return notify;
 }
 
+MokoNotify*
+moko_notify_get_default (void)
+{
+  static MokoNotify *notify = NULL;
+  
+  if (!notify) notify = moko_notify_new ();
+  
+  return notify;
+}
+

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h
        2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h
        2007-12-19 12:29:45 UTC (rev 3689)
@@ -66,6 +66,9 @@
 MokoNotify*        
 moko_notify_new (void);
 
+MokoNotify*
+moko_notify_get_default (void);
+
 void
 moko_notify_start (MokoNotify *notify);
 

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sms.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sms.c
   2007-12-19 11:00:11 UTC (rev 3688)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sms.c
   2007-12-19 12:29:45 UTC (rev 3689)
@@ -26,6 +26,10 @@
 #include <libjana/jana.h>
 #include <libjana-ecal/jana-ecal.h>
 
+#include <libnotify/notification.h>
+
+#include <libmokoui2/moko-stock.h>
+
 #include "moko-sms.h"
 #include "moko-network.h"
 #include "moko-listener.h"
@@ -63,6 +67,9 @@
   JanaStore          *sms_store;
   gboolean           sms_store_open;
   JanaNote           *last_msg;
+  
+  GList              *unread_uids;
+  NotifyNotification *notification;
 };
 
 static void start_handling_sms (MokoSms *sms);
@@ -400,6 +407,100 @@
 }
 
 static void
+update_notification (MokoSms *sms, gboolean show)
+{
+  gchar *body;
+  MokoSmsPrivate *priv = sms->priv;
+  
+  if (!priv->unread_uids) {
+    notify_notification_close (priv->notification, NULL);
+    return;
+  }
+  
+  body = g_strdup_printf ("%d unread message(s)",
+                          g_list_length (priv->unread_uids));
+  g_object_set (G_OBJECT (priv->notification), "body", body, NULL);
+  g_free (body);
+  
+  /* Show notification */
+  if (show) notify_notification_show (priv->notification, NULL);
+}
+
+static void
+note_added_cb (JanaStoreView *store_view, GList *components, MokoSms *sms)
+{
+  MokoSmsPrivate *priv = sms->priv;
+  gboolean update = FALSE;
+  
+  for (; components; components = components->next) {
+    JanaComponent *comp = JANA_COMPONENT (components->data);
+    
+    if (!comp) continue;
+    
+    if (!jana_utils_component_has_category (comp, "Read")) {
+      gchar *uid = jana_component_get_uid (comp);
+      priv->unread_uids = g_list_prepend (priv->unread_uids, uid);
+      update = TRUE;
+    }
+  }
+  
+  /* TODO: Put this in an idle? */
+  if (update) update_notification (sms, TRUE);
+}
+
+static void
+note_modified_cb (JanaStoreView *store_view, GList *components, MokoSms *sms)
+{
+  MokoSmsPrivate *priv = sms->priv;
+  gboolean update = FALSE;
+  
+  for (; components; components = components->next) {
+    gchar *uid;
+    GList *found;
+    JanaComponent *comp = JANA_COMPONENT (components->data);
+    
+    if (!comp) continue;
+    
+    uid = jana_component_get_uid (comp);
+    if ((found = g_list_find_custom (
+         priv->unread_uids, uid, (GCompareFunc)strcmp))) {
+      g_free (uid);
+      if (jana_utils_component_has_category (comp, "Read")) {
+        g_free (found->data);
+        priv->unread_uids = g_list_delete_link (priv->unread_uids, found);
+        update = TRUE;
+      }
+    } else if (!jana_utils_component_has_category (comp, "Read")) {
+      priv->unread_uids = g_list_prepend (priv->unread_uids, uid);
+      update = TRUE;
+    } else {
+      g_free (uid);
+    }
+  }
+  
+  if (update) update_notification (sms, FALSE);
+}
+
+static void
+note_removed_cb (JanaStoreView *store_view, GList *uids, MokoSms *sms)
+{
+  MokoSmsPrivate *priv = sms->priv;
+  gboolean update = FALSE;
+  
+  for (; uids; uids = uids->next) {
+    GList *found = g_list_find_custom (priv->unread_uids, uids->data,
+                                       (GCompareFunc)strcmp);
+    if (found) {
+      g_free (found->data);
+      priv->unread_uids = g_list_delete_link (priv->unread_uids, found);
+      update = TRUE;
+    }
+  }
+  
+  if (update) update_notification (sms, FALSE);
+}
+
+static void
 start_handling_sms (MokoSms *sms)
 {
   MokoSmsPrivate *priv = sms->priv;
@@ -421,9 +522,17 @@
 static void
 sms_store_opened_cb (JanaStore *store, MokoSms *self)
 {
+  JanaStoreView *view;
   MokoSmsPrivate *priv = self->priv;
   priv->sms_store_open = TRUE;
 
+  /* Hook onto added/modified/removed signals for SMS notification */
+  view = jana_store_get_view (store);
+  g_signal_connect (view, "added", G_CALLBACK (note_added_cb), self);
+  g_signal_connect (view, "modified", G_CALLBACK (note_modified_cb), self);
+  g_signal_connect (view, "removed", G_CALLBACK (note_removed_cb), self);
+  jana_store_view_start (view);
+
   if (!priv->handling_sms) start_handling_sms (self);
   if (priv->got_subscriber_number)
     g_signal_emit (self, signals[STATUS_CHANGED], 0, PK_SMS_READY);
@@ -435,6 +544,10 @@
   MokoSmsPrivate *priv;
 
   priv = sms->priv = MOKO_SMS_GET_PRIVATE (sms);
+  priv->notification = notify_notification_new ("New SMS message",
+                                                "",
+                                                MOKO_STOCK_SMS_NEW,
+                                                NULL);
 
   /* Get the SMS note store */
   priv->sms_store = jana_ecal_store_new (JANA_COMPONENT_NOTE);




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-12-19 14:31:04 +0100 (Wed, 19 Dec 2007)
New Revision: 3690

Modified:
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
Log:
cosmetic cleanup


Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
12:29:45 UTC (rev 3689)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
13:31:04 UTC (rev 3690)
@@ -20,7 +20,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/cpu/arm920t/s3c24x0/nand.c
-@@ -0,0 +1,224 @@
+@@ -0,0 +1,227 @@
 +/*
 + * (C) Copyright 2006 OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -168,17 +168,20 @@
 +      NFCONF |= S3C2410_NFCONF_INITECC;
 +}
 +
-+static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char 
*dat, u_char *ecc_code)
++static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
++                                    u_char *ecc_code)
 +{
 +      ecc_code[0] = NFECC0;
 +      ecc_code[1] = NFECC1;
 +      ecc_code[2] = NFECC2;
-+      DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n", mtd 
, ecc_code[0], ecc_code[1], ecc_code[2]);
++      DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
++              mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
 +
 +      return 0;
 +}
 +
-+int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char 
*read_ecc, u_char *calc_ecc)
++static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
++                                   u_char *read_ecc, u_char *calc_ecc)
 +{
 +      if (read_ecc[0] == calc_ecc[0] &&
 +          read_ecc[1] == calc_ecc[1] &&
@@ -383,7 +386,7 @@
  relocate:                             /* relocate U-Boot to RAM           */
        adr     r0, _start              /* r0 <- current position of code   */
        ldr     r1, _TEXT_BASE          /* test if we run from flash or RAM */
-@@ -197,6 +203,93 @@
+@@ -197,6 +203,87 @@
        stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
        cmp     r0, r2                  /* until source end addreee [r2]    */
        ble     copy_loop
@@ -412,11 +415,6 @@
 +      orr     r2, r2, #0x800          @ disable chip
 +      str     r2, [r1, #oNFCONF]
 +
-+#if 0
-+      @ get ready to call C functions (for nand_read())
-+      ldr     sp, DW_STACK_START      @ setup stack pointer
-+      mov     fp, #0                  @ no previous frame, so fp=0
-+#else
 +      ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
 +      sub     r0, r0, #CFG_MALLOC_LEN /* malloc area                      */
 +      sub     r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
@@ -424,7 +422,6 @@
 +      sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
 +#endif
 +      sub     sp, r0, #12             /* leave 3 words for abort-stack    */
-+#endif
 +
 +      @ copy u-boot to RAM
 +      ldr     r0, _TEXT_BASE




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-12-19 14:32:36 +0100 (Wed, 19 Dec 2007)
New Revision: 3691

Modified:
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
Log:
remove unused cmdfunc


Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
13:31:04 UTC (rev 3690)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
13:32:36 UTC (rev 3691)
@@ -20,7 +20,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/cpu/arm920t/s3c24x0/nand.c
-@@ -0,0 +1,227 @@
+@@ -0,0 +1,179 @@
 +/*
 + * (C) Copyright 2006 OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -113,54 +113,6 @@
 +      return (NFSTAT & 0x01);
 +}
 +
-+static void s3c2410_cmdfunc(struct mtd_info *mtd, unsigned cmd,
-+                          int column, int page_addr)
-+{
-+      DEBUGN("cmdfunc(): 0x%02x, col=%d, page=%d\n", cmd, column, page_addr);
-+
-+      switch (cmd) {
-+      case NAND_CMD_READ0:
-+      case NAND_CMD_READ1:
-+      case NAND_CMD_READOOB:
-+              NFCMD = cmd;
-+              NFADDR = column & 0xff;
-+              NFADDR = page_addr & 0xff;
-+              NFADDR = (page_addr >> 8) & 0xff;
-+              NFADDR = (page_addr >> 16) & 0xff;
-+              break;
-+      case NAND_CMD_READID:
-+              NFCMD = cmd;
-+              NFADDR = 0;
-+              break;
-+      case NAND_CMD_PAGEPROG:
-+              NFCMD = cmd;
-+              printf("PAGEPROG not implemented\n");
-+              break;
-+      case NAND_CMD_ERASE1:
-+              NFCMD = cmd;
-+              NFADDR = page_addr & 0xff;
-+              NFADDR = (page_addr >> 8) & 0xff;
-+              NFADDR = (page_addr >> 16) & 0xff;
-+              break;
-+      case NAND_CMD_ERASE2:
-+              NFCMD = cmd;
-+              break;
-+      case NAND_CMD_SEQIN:
-+              printf("SEQIN not implemented\n");
-+              break;
-+      case NAND_CMD_STATUS:
-+              NFCMD = cmd;
-+              break;
-+      case NAND_CMD_RESET:
-+              NFCMD = cmd;
-+              break;
-+      default:
-+              break;
-+      }
-+
-+      while (!s3c2410_dev_ready(mtd));
-+}
-+
 +#ifdef CONFIG_S3C2410_NAND_HWECC
 +void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 +{




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-12-19 15:16:27 +0100 (Wed, 19 Dec 2007)
New Revision: 3692

Added:
   trunk/src/target/u-boot/patches/uboot-s3c24xx-nand-boot.patch
Removed:
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand-led.patch
Modified:
   trunk/src/target/u-boot/patches/series
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
Log:
separate NAND controller and boot-from-nand patches, merge 'led' patch into 
boot-from-nand patch.


Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series      2007-12-19 13:32:36 UTC (rev 
3691)
+++ trunk/src/target/u-boot/patches/series      2007-12-19 14:16:27 UTC (rev 
3692)
@@ -10,7 +10,7 @@
 uboot-arm920t-gd_in_irq.patch
 uboot-arm920_s3c2410_irq_demux.patch
 uboot-s3c2410-nand.patch
-uboot-s3c2410-nand-led.patch
+uboot-s3c24xx-nand-boot.patch
 uboot-cmd_s3c2410.patch
 uboot-s3c2410-mmc.patch
 uboot-s3c24xx_multi_serial.patch

Deleted: trunk/src/target/u-boot/patches/uboot-s3c2410-nand-led.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand-led.patch        
2007-12-19 13:32:36 UTC (rev 3691)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand-led.patch        
2007-12-19 14:16:27 UTC (rev 3692)
@@ -1,23 +0,0 @@
-If we boot from the S3C24xx NAND, then we only have access to the
-first 4kByte of memory.  Thus, te coloured_LED_init and red_LED_on
-functions defined in lib_arm/board.o cannot be referenced at this
-point.
-
-Index: u-boot/cpu/arm920t/start.S
-===================================================================
---- u-boot.orig/cpu/arm920t/start.S
-+++ u-boot/cpu/arm920t/start.S
-@@ -141,8 +141,13 @@
-       orr     r0,r0,#0xd3
-       msr     cpsr,r0
- 
-+      /* in case we run from the s3c24xx NAND stepping stone, the symbols
-+       * for LED support are in lib_arm/board.o, i.e. outside of the
-+       * steppingstone */
-+#ifndef CONFIG_S3C2410_NAND_BOOT
-       bl coloured_LED_init
-       bl red_LED_on
-+#endif
- 
- #if   defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK) || 
defined(CONFIG_AT91RM9200DF)
-       /*

Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
13:32:36 UTC (rev 3691)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch    2007-12-19 
14:16:27 UTC (rev 3692)
@@ -1,5 +1,4 @@
-This patch adds NAND (including boot-from-NAND via steppingstone) support to
-the S3C2410 SoC code in u-boot
+This patch adds NAND support to the S3C24x0 SoC code in u-boot
 
 Signed-off-by: Harald Welte <[EMAIL PROTECTED]>
 
@@ -12,7 +11,7 @@
  
  COBJS = i2c.o interrupts.o serial.o speed.o \
 -        usb.o usb_ohci.o
-+        usb.o usb_ohci.o nand_read.o nand.o
++        usb.o usb_ohci.o nand.o
  
  SRCS  := $(SOBJS:.o=.S) $(COBJS:.o=.c)
  OBJS  := $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -200,278 +199,3 @@
 + #error "U-Boot legacy NAND support not available for S3C2410"
 +#endif
 +#endif
-Index: u-boot/cpu/arm920t/s3c24x0/nand_read.c
-===================================================================
---- /dev/null
-+++ u-boot/cpu/arm920t/s3c24x0/nand_read.c
-@@ -0,0 +1,98 @@
-+/*
-+ * nand_read.c: Simple NAND read functions for booting from NAND
-+ *
-+ * This is used by cpu/arm920/start.S assembler code,
-+ * and the board-specific linker script must make sure this
-+ * file is linked within the first 4kB of NAND flash.
-+ *
-+ * Taken from GPLv2 licensed vivi bootloader,
-+ * Copyright (C) 2002 MIZI Research, Inc.
-+ *
-+ * Author: Hwang, Chideok <[EMAIL PROTECTED]>
-+ * Date  : $Date: 2004/02/04 10:37:37 $
-+ *
-+ * u-boot integration and bad-block skipping (C) 2006 by OpenMoko, Inc.
-+ * Author: Harald Welte <[EMAIL PROTECTED]>
-+ */
-+
-+#include <common.h>
-+
-+#ifdef CONFIG_S3C2410_NAND_BOOT
-+
-+#define __REGb(x)     (*(volatile unsigned char *)(x))
-+#define __REGi(x)     (*(volatile unsigned int *)(x))
-+#define NF_BASE               0x4e000000
-+#define NFCONF                __REGi(NF_BASE + 0x0)
-+#define NFCMD         __REGb(NF_BASE + 0x4)
-+#define NFADDR                __REGb(NF_BASE + 0x8)
-+#define NFDATA                __REGb(NF_BASE + 0xc)
-+#define NFSTAT                __REGb(NF_BASE + 0x10)
-+
-+#define BUSY 1
-+inline void wait_idle(void)
-+{
-+      int i;
-+
-+      while (!(NFSTAT & BUSY))
-+              for (i=0; i<10; i++);
-+}
-+
-+#define NAND_SECTOR_SIZE      512
-+#define NAND_BLOCK_MASK               (NAND_SECTOR_SIZE - 1)
-+#define NAND_PAGE_SIZE                0x4000
-+
-+/* low level nand read function */
-+int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
-+{
-+      int i, j;
-+
-+      if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK))
-+              return -1;      /* invalid alignment */
-+
-+      /* chip Enable */
-+      NFCONF &= ~0x800;
-+      for (i=0; i<10; i++);
-+
-+      for (i=start_addr; i < (start_addr + size);) {
-+#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
-+              if (start_addr % NAND_PAGE_SIZE == 0) {
-+                      unsigned char data;
-+                      NFCMD = 0x50;
-+                      NFADDR = 517&0xf;
-+                      NFADDR = (i >> 9) & 0xff;
-+                      NFADDR = (i >> 17) & 0xff;
-+                      NFADDR = (i >> 25) & 0xff;
-+                      wait_idle();
-+                      data = (NFDATA & 0xff);
-+                      if (data != 0xff) {
-+                              /* Bad block */
-+                              i += NAND_PAGE_SIZE;
-+                              size += NAND_PAGE_SIZE;
-+                              continue;
-+                      }
-+              }
-+#endif
-+              /* READ0 */
-+              NFCMD = 0;
-+
-+              /* Write Address */
-+              NFADDR = i & 0xff;
-+              NFADDR = (i >> 9) & 0xff;
-+              NFADDR = (i >> 17) & 0xff;
-+              NFADDR = (i >> 25) & 0xff;
-+
-+              wait_idle();
-+
-+              for (j=0; j < NAND_SECTOR_SIZE; j++, i++) {
-+                      *buf = (NFDATA & 0xff);
-+                      buf++;
-+              }
-+      }
-+
-+      /* chip Disable */
-+      NFCONF |= 0x800;        /* chip disable */
-+
-+      return 0;
-+}
-+
-+#endif /* CONFIG_S3C2410_NAND_BOOT */
-Index: u-boot/cpu/arm920t/start.S
-===================================================================
---- u-boot.orig/cpu/arm920t/start.S
-+++ u-boot/cpu/arm920t/start.S
-@@ -5,6 +5,10 @@
-  *  Copyright (c) 2002        Alex Z�pke <[EMAIL PROTECTED]>
-  *  Copyright (c) 2002        Gary Jennejohn <[EMAIL PROTECTED]>
-  *
-+ * S3C2410 NAND portions
-+ *  Copyright (c) 2001  MIZI Research, Inc.
-+ *  Copyright (c) 2006  OpenMoko, Inc. (Harald Welte <[EMAIL PROTECTED]>
-+ *
-  * See file CREDITS for list of people who contributed to this
-  * project.
-  *
-@@ -27,6 +31,7 @@
- 
- #include <config.h>
- #include <version.h>
-+#include <s3c2410.h>
- #include <status_led.h>
- 
- /*
-@@ -178,9 +183,10 @@
-       bl      cpu_init_crit
- #endif
- 
--#ifdef        CONFIG_AT91RM9200
-+#if defined(CONFIG_AT91RM9200) || defined(CONFIG_S3C2410)
- 
- #ifndef CONFIG_SKIP_RELOCATE_UBOOT
-+#ifndef CONFIG_S3C2410_NAND_BOOT
- relocate:                             /* relocate U-Boot to RAM           */
-       adr     r0, _start              /* r0 <- current position of code   */
-       ldr     r1, _TEXT_BASE          /* test if we run from flash or RAM */
-@@ -197,6 +203,87 @@
-       stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
-       cmp     r0, r2                  /* until source end addreee [r2]    */
-       ble     copy_loop
-+#else /* NAND_BOOT */
-+relocate:
-+copy_myself:
-+      /* mov  r10, lr */
-+
-+      @ reset NAND
-+      mov     r1, #S3C2410_NAND_BASE
-+      ldr     r2, =0xf842             @ initial value enable 
tacls=3,rph0=6,rph1=0
-+      str     r2, [r1, #oNFCONF]
-+      ldr     r2, [r1, #oNFCONF]
-+      bic     r2, r2, #0x800          @ enable chip
-+      str     r2, [r1, #oNFCONF]
-+      mov     r2, #0xff               @ RESET command
-+      strb    r2, [r1, #oNFCMD]
-+      mov     r3, #0                  @ wait
-+1:    add     r3, r3, #0x1
-+      cmp     r3, #0xa
-+      blt     1b
-+2:    ldr     r2, [r1, #oNFSTAT]      @ wait ready
-+      tst     r2, #0x1
-+      beq     2b
-+      ldr     r2, [r1, #oNFCONF]
-+      orr     r2, r2, #0x800          @ disable chip
-+      str     r2, [r1, #oNFCONF]
-+
-+      ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
-+      sub     r0, r0, #CFG_MALLOC_LEN /* malloc area                      */
-+      sub     r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
-+#ifdef CONFIG_USE_IRQ
-+      sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-+#endif
-+      sub     sp, r0, #12             /* leave 3 words for abort-stack    */
-+
-+      @ copy u-boot to RAM
-+      ldr     r0, _TEXT_BASE
-+      mov     r1, #0x0
-+      mov     r2, #CFG_UBOOT_SIZE
-+      bl      nand_read_ll
-+
-+      tst     r0, #0x0
-+      beq     ok_nand_read
-+#ifdef CONFIG_DEBUG_LL
-+bad_nand_read:
-+      ldr     r0, STR_FAIL
-+      ldr     r1, SerBase
-+      bl      PrintWord
-+1:    b       1b              @ infinite loop
-+#endif
-+
-+ok_nand_read:
-+#ifdef CONFIG_DEBUG_LL
-+      ldr     r0, STR_OK
-+      ldr     r1, SerBase
-+      bl      PrintWord
-+#endif
-+
-+      @ verify
-+      mov     r0, #0
-+      @ldr    r1, =0x33f00000
-+      ldr     r1, _TEXT_BASE
-+      mov     r2, #0x400      @ 4 bytes * 1024 = 4K-bytes
-+go_next:
-+      ldr     r3, [r0], #4
-+      ldr     r4, [r1], #4
-+      teq     r3, r4
-+      bne     notmatch
-+      subs    r2, r2, #4
-+      beq     done_nand_read
-+      bne     go_next
-+notmatch:
-+#ifdef CONFIG_DEBUG_LL
-+      sub     r0, r0, #4
-+      ldr     r1, SerBase
-+      bl      PrintHexWord
-+      ldr     r0, STR_FAIL
-+      ldr     r1, SerBase
-+      bl      PrintWord
-+#endif
-+1:    b       1b
-+done_nand_read:
-+#endif /* NAND_BOOT */
- #endif        /* CONFIG_SKIP_RELOCATE_UBOOT */
- #endif
-       /* Set up the stack                                                 */
-Index: u-boot/include/s3c2410.h
-===================================================================
---- u-boot.orig/include/s3c2410.h
-+++ u-boot/include/s3c2410.h
-@@ -38,12 +38,6 @@
- #define S3C2410_ECCSIZE               512
- #define S3C2410_ECCBYTES      3
- 
--typedef enum {
--      S3C24X0_UART0,
--      S3C24X0_UART1,
--      S3C24X0_UART2
--} S3C24X0_UARTS_NR;
--
- /* S3C2410 device base addresses */
- #define S3C24X0_MEMCTL_BASE           0x48000000
- #define S3C24X0_USB_HOST_BASE         0x49000000
-@@ -65,9 +59,23 @@
- #define S3C2410_SDI_BASE              0x5A000000
- 
- 
-+#define oNFCONF                       0x00
-+#define oNFCMD                        0x04
-+#define oNFADDR                       0x08
-+#define oNFDATA                       0x0C
-+#define oNFSTAT                       0x10
-+#define oNFECC                        0x14
-+
-+#ifndef __ASSEMBLER__
-+
- /* include common stuff */
- #include <s3c24x0.h>
- 
-+typedef enum {
-+      S3C24X0_UART0,
-+      S3C24X0_UART1,
-+      S3C24X0_UART2
-+} S3C24X0_UARTS_NR;
- 
- static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
- {
-@@ -142,6 +150,7 @@
-       return (S3C2410_SDI * const)S3C2410_SDI_BASE;
- }
- 
-+#endif
- 
- /* ISR */
- #define pISR_RESET            (*(unsigned *)(_ISR_STARTADDRESS+0x0))

Added: trunk/src/target/u-boot/patches/uboot-s3c24xx-nand-boot.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c24xx-nand-boot.patch       
2007-12-19 13:32:36 UTC (rev 3691)
+++ trunk/src/target/u-boot/patches/uboot-s3c24xx-nand-boot.patch       
2007-12-19 14:16:27 UTC (rev 3692)
@@ -0,0 +1,306 @@
+Index: u-boot/cpu/arm920t/s3c24x0/nand_read.c
+===================================================================
+--- /dev/null
++++ u-boot/cpu/arm920t/s3c24x0/nand_read.c
+@@ -0,0 +1,98 @@
++/*
++ * nand_read.c: Simple NAND read functions for booting from NAND
++ *
++ * This is used by cpu/arm920/start.S assembler code,
++ * and the board-specific linker script must make sure this
++ * file is linked within the first 4kB of NAND flash.
++ *
++ * Taken from GPLv2 licensed vivi bootloader,
++ * Copyright (C) 2002 MIZI Research, Inc.
++ *
++ * Author: Hwang, Chideok <[EMAIL PROTECTED]>
++ * Date  : $Date: 2004/02/04 10:37:37 $
++ *
++ * u-boot integration and bad-block skipping (C) 2006 by OpenMoko, Inc.
++ * Author: Harald Welte <[EMAIL PROTECTED]>
++ */
++
++#include <common.h>
++
++#ifdef CONFIG_S3C2410_NAND_BOOT
++
++#define __REGb(x)     (*(volatile unsigned char *)(x))
++#define __REGi(x)     (*(volatile unsigned int *)(x))
++#define NF_BASE               0x4e000000
++#define NFCONF                __REGi(NF_BASE + 0x0)
++#define NFCMD         __REGb(NF_BASE + 0x4)
++#define NFADDR                __REGb(NF_BASE + 0x8)
++#define NFDATA                __REGb(NF_BASE + 0xc)
++#define NFSTAT                __REGb(NF_BASE + 0x10)
++
++#define BUSY 1
++inline void wait_idle(void)
++{
++      int i;
++
++      while (!(NFSTAT & BUSY))
++              for (i=0; i<10; i++);
++}
++
++#define NAND_SECTOR_SIZE      512
++#define NAND_BLOCK_MASK               (NAND_SECTOR_SIZE - 1)
++#define NAND_PAGE_SIZE                0x4000
++
++/* low level nand read function */
++int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
++{
++      int i, j;
++
++      if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK))
++              return -1;      /* invalid alignment */
++
++      /* chip Enable */
++      NFCONF &= ~0x800;
++      for (i=0; i<10; i++);
++
++      for (i=start_addr; i < (start_addr + size);) {
++#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
++              if (start_addr % NAND_PAGE_SIZE == 0) {
++                      unsigned char data;
++                      NFCMD = 0x50;
++                      NFADDR = 517&0xf;
++                      NFADDR = (i >> 9) & 0xff;
++                      NFADDR = (i >> 17) & 0xff;
++                      NFADDR = (i >> 25) & 0xff;
++                      wait_idle();
++                      data = (NFDATA & 0xff);
++                      if (data != 0xff) {
++                              /* Bad block */
++                              i += NAND_PAGE_SIZE;
++                              size += NAND_PAGE_SIZE;
++                              continue;
++                      }
++              }
++#endif
++              /* READ0 */
++              NFCMD = 0;
++
++              /* Write Address */
++              NFADDR = i & 0xff;
++              NFADDR = (i >> 9) & 0xff;
++              NFADDR = (i >> 17) & 0xff;
++              NFADDR = (i >> 25) & 0xff;
++
++              wait_idle();
++
++              for (j=0; j < NAND_SECTOR_SIZE; j++, i++) {
++                      *buf = (NFDATA & 0xff);
++                      buf++;
++              }
++      }
++
++      /* chip Disable */
++      NFCONF |= 0x800;        /* chip disable */
++
++      return 0;
++}
++
++#endif /* CONFIG_S3C2410_NAND_BOOT */
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -5,6 +5,10 @@
+  *  Copyright (c) 2002        Alex Z�pke <[EMAIL PROTECTED]>
+  *  Copyright (c) 2002        Gary Jennejohn <[EMAIL PROTECTED]>
+  *
++ * S3C2410 NAND portions
++ *  Copyright (c) 2001  MIZI Research, Inc.
++ *  Copyright (c) 2006  OpenMoko, Inc. (Harald Welte <[EMAIL PROTECTED]>
++ *
+  * See file CREDITS for list of people who contributed to this
+  * project.
+  *
+@@ -27,6 +31,7 @@
+ 
+ #include <config.h>
+ #include <version.h>
++#include <s3c2410.h>
+ #include <status_led.h>
+ 
+ /*
+@@ -178,9 +183,10 @@
+       bl      cpu_init_crit
+ #endif
+ 
+-#ifdef        CONFIG_AT91RM9200
++#if defined(CONFIG_AT91RM9200) || defined(CONFIG_S3C2410)
+ 
+ #ifndef CONFIG_SKIP_RELOCATE_UBOOT
++#ifndef CONFIG_S3C2410_NAND_BOOT
+ relocate:                             /* relocate U-Boot to RAM           */
+       adr     r0, _start              /* r0 <- current position of code   */
+       ldr     r1, _TEXT_BASE          /* test if we run from flash or RAM */
+@@ -197,6 +203,87 @@
+       stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
+       cmp     r0, r2                  /* until source end addreee [r2]    */
+       ble     copy_loop
++#else /* NAND_BOOT */
++relocate:
++copy_myself:
++      /* mov  r10, lr */
++
++      @ reset NAND
++      mov     r1, #S3C2410_NAND_BASE
++      ldr     r2, =0xf842             @ initial value enable 
tacls=3,rph0=6,rph1=0
++      str     r2, [r1, #oNFCONF]
++      ldr     r2, [r1, #oNFCONF]
++      bic     r2, r2, #0x800          @ enable chip
++      str     r2, [r1, #oNFCONF]
++      mov     r2, #0xff               @ RESET command
++      strb    r2, [r1, #oNFCMD]
++      mov     r3, #0                  @ wait
++1:    add     r3, r3, #0x1
++      cmp     r3, #0xa
++      blt     1b
++2:    ldr     r2, [r1, #oNFSTAT]      @ wait ready
++      tst     r2, #0x1
++      beq     2b
++      ldr     r2, [r1, #oNFCONF]
++      orr     r2, r2, #0x800          @ disable chip
++      str     r2, [r1, #oNFCONF]
++
++      ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
++      sub     r0, r0, #CFG_MALLOC_LEN /* malloc area                      */
++      sub     r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
++#ifdef CONFIG_USE_IRQ
++      sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
++#endif
++      sub     sp, r0, #12             /* leave 3 words for abort-stack    */
++
++      @ copy u-boot to RAM
++      ldr     r0, _TEXT_BASE
++      mov     r1, #0x0
++      mov     r2, #CFG_UBOOT_SIZE
++      bl      nand_read_ll
++
++      tst     r0, #0x0
++      beq     ok_nand_read
++#ifdef CONFIG_DEBUG_LL
++bad_nand_read:
++      ldr     r0, STR_FAIL
++      ldr     r1, SerBase
++      bl      PrintWord
++1:    b       1b              @ infinite loop
++#endif
++
++ok_nand_read:
++#ifdef CONFIG_DEBUG_LL
++      ldr     r0, STR_OK
++      ldr     r1, SerBase
++      bl      PrintWord
++#endif
++
++      @ verify
++      mov     r0, #0
++      @ldr    r1, =0x33f00000
++      ldr     r1, _TEXT_BASE
++      mov     r2, #0x400      @ 4 bytes * 1024 = 4K-bytes
++go_next:
++      ldr     r3, [r0], #4
++      ldr     r4, [r1], #4
++      teq     r3, r4
++      bne     notmatch
++      subs    r2, r2, #4
++      beq     done_nand_read
++      bne     go_next
++notmatch:
++#ifdef CONFIG_DEBUG_LL
++      sub     r0, r0, #4
++      ldr     r1, SerBase
++      bl      PrintHexWord
++      ldr     r0, STR_FAIL
++      ldr     r1, SerBase
++      bl      PrintWord
++#endif
++1:    b       1b
++done_nand_read:
++#endif /* NAND_BOOT */
+ #endif        /* CONFIG_SKIP_RELOCATE_UBOOT */
+ #endif
+       /* Set up the stack                                                 */
+Index: u-boot/include/s3c2410.h
+===================================================================
+--- u-boot.orig/include/s3c2410.h
++++ u-boot/include/s3c2410.h
+@@ -38,12 +38,6 @@
+ #define S3C2410_ECCSIZE               512
+ #define S3C2410_ECCBYTES      3
+ 
+-typedef enum {
+-      S3C24X0_UART0,
+-      S3C24X0_UART1,
+-      S3C24X0_UART2
+-} S3C24X0_UARTS_NR;
+-
+ /* S3C2410 device base addresses */
+ #define S3C24X0_MEMCTL_BASE           0x48000000
+ #define S3C24X0_USB_HOST_BASE         0x49000000
+@@ -65,9 +59,23 @@
+ #define S3C2410_SDI_BASE              0x5A000000
+ 
+ 
++#define oNFCONF                       0x00
++#define oNFCMD                        0x04
++#define oNFADDR                       0x08
++#define oNFDATA                       0x0C
++#define oNFSTAT                       0x10
++#define oNFECC                        0x14
++
++#ifndef __ASSEMBLER__
++
+ /* include common stuff */
+ #include <s3c24x0.h>
+ 
++typedef enum {
++      S3C24X0_UART0,
++      S3C24X0_UART1,
++      S3C24X0_UART2
++} S3C24X0_UARTS_NR;
+ 
+ static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
+ {
+@@ -142,6 +150,7 @@
+       return (S3C2410_SDI * const)S3C2410_SDI_BASE;
+ }
+ 
++#endif
+ 
+ /* ISR */
+ #define pISR_RESET            (*(unsigned *)(_ISR_STARTADDRESS+0x0))
+Index: u-boot/cpu/arm920t/s3c24x0/Makefile
+===================================================================
+--- u-boot.orig/cpu/arm920t/s3c24x0/Makefile
++++ u-boot/cpu/arm920t/s3c24x0/Makefile
+@@ -26,7 +26,7 @@
+ LIB   = $(obj)lib$(SOC).a
+ 
+ COBJS = i2c.o interrupts.o serial.o speed.o \
+-        usb.o usb_ohci.o nand.o
++        usb.o usb_ohci.o nand_read.o nand.o
+ 
+ SRCS  := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+ OBJS  := $(addprefix $(obj),$(SOBJS) $(COBJS))
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -141,8 +141,13 @@
+       orr     r0,r0,#0xd3
+       msr     cpsr,r0
+ 
++      /* in case we run from the s3c24xx NAND stepping stone, the symbols
++       * for LED support are in lib_arm/board.o, i.e. outside of the
++       * steppingstone */
++#ifndef CONFIG_S3C2410_NAND_BOOT
+       bl coloured_LED_init
+       bl red_LED_on
++#endif
+ 
+ #if   defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK) || 
defined(CONFIG_AT91RM9200DF)
+       /*




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to