From patchwork Mon Sep 7 00:06:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Damien Dusha X-Patchwork-Id: 33062 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 8E2F7B7B7F for ; Mon, 7 Sep 2009 10:38:20 +1000 (EST) Received: by ozlabs.org (Postfix) id 82C56DDD0B; Mon, 7 Sep 2009 10:38:20 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 810AEDDD04 for ; Mon, 7 Sep 2009 10:38:20 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 94F4EB7E1C for ; Mon, 7 Sep 2009 10:38:04 +1000 (EST) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id CF732B7B63 for ; Mon, 7 Sep 2009 10:37:57 +1000 (EST) Received: by ozlabs.org (Postfix) id BB41BDDD01; Mon, 7 Sep 2009 10:37:57 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 1493 seconds by postgrey-1.31 at ozlabs; Mon, 07 Sep 2009 10:37:57 EST Received: from mail-yx0-f178.google.com (mail-yx0-f178.google.com [209.85.210.178]) by ozlabs.org (Postfix) with ESMTP id 3075BDDD0B for ; Mon, 7 Sep 2009 10:37:55 +1000 (EST) Received: by yxe8 with SMTP id 8so3001563yxe.17 for ; Sun, 06 Sep 2009 17:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=VPjlAUDv1FFtLU+tzrOhENRP+AR9gVhmRbZQ5VjCQfs=; b=hW/C0gOMYzSiW63Sq3N3/dl0qICTxcEANNAAM/uiZN7QWGVemEzrmYrZx08JvQ6WiI 1KSkKCAgFCddTYijLACw1zEjiziKgPh88fXkt6nVKo6AmvX0+g4isDRloqv09zfjzB4V wXkdvW1Ahg2LNC6BO+sQC6WKv1H6F8oIZpcqQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=nPPdPY7lbkWIgg/JFgo8KihPd6DxkJvISZ/0ylz1XC7fBUJtG/mZaVqsY1Pb5gOycN 7yxc2k0iTMUEMmTSUdbpHye1hQ+Fi71SqjyxO9E7CFUMyeEeSwaZqbLvbHNdu+N4rk2i IIeQvfvDrxOS3gB6eL/0uXr92cJ+vf5Mmrp5M= MIME-Version: 1.0 Received: by 10.91.122.11 with SMTP id z11mr10655085agm.111.1252281961916; Sun, 06 Sep 2009 17:06:01 -0700 (PDT) Date: Mon, 7 Sep 2009 10:06:01 +1000 Message-ID: Subject: [PATCH] mpc512x: Reset module From: Damien Dusha To: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Dear all, I have written a small patch to get the software reset working on the mpc5121.  It is similar to the reset driver found in arch/powerpc/platforms/83xx/misc.c except it has been modified to look for the reset node in the device tree before writing to the reset module. Comments are welcome. It's my first patch to the mailing list, so I'll apologise in advance for any problems with the submission procedure. Damien. diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c index a8976b4..16ca250 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads.c @@ -70,4 +70,5 @@ define_machine(mpc5121_ads) { .init_IRQ = mpc5121_ads_init_IRQ, .get_irq = ipic_get_irq, .calibrate_decr = generic_calibrate_decr, + .restart = mpc512x_restart, }; diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h index f4db8a7..d77f0ab 100644 --- a/arch/powerpc/platforms/512x/mpc512x.h +++ b/arch/powerpc/platforms/512x/mpc512x.h @@ -14,5 +14,6 @@ extern unsigned long mpc512x_find_ips_freq(struct device_node *node); extern void __init mpc512x_init_IRQ(void); extern void __init mpc512x_init_i2c(void); +extern void mpc512x_restart(char *cmd); void __init mpc512x_declare_of_platform_devices(void); #endif /* __MPC512X_H__ */ diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c index 135fd6b..deddafc 100644 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c @@ -22,6 +22,7 @@ #include #include +#include #include "mpc512x.h" unsigned long @@ -89,6 +90,33 @@ void __init mpc512x_init_i2c(void) } } +void mpc512x_restart(char *cmd) +{ + struct device_node *np; + struct mpc512x_reset_module *rm; + + local_irq_disable(); + + np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset"); + + if (np) { + + rm = of_iomap(np, 0); + if (rm) { + + /* Enable software reset "RSTE" (in hex) */ + out_be32( &(rm->rpr) , 0x52535445); + + /* Set the software hard reset */ + out_be32( &(rm->rcr), 0x2); + } + } + + printk (KERN_EMERG "Error: Unable to map reset module, spinning forever!\n"); + for(;;); +} + + /* * Nodes to do bus probe on, soc and localbus */