public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 02/10] split mpc8xx hooks from cmd_ide.c
Date: Sun, 7 Oct 2012 20:09:08 +0200	[thread overview]
Message-ID: <201210072009.08283.marex@denx.de> (raw)
In-Reply-To: <1349625374-12391-3-git-send-email-morpheus.ibis@gmail.com>

Dear Pavel Herrmann,

> move most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly
> created ide_init_postreset() (invoked after calling ide_reset after
> ide_preinit), some cleanup to make checkpatch happy, enable IDE init hooks
> in configs of affected boards.
> Confusingly, these hooks are used by more than just mpc8xx-based boards,
> and therefore are placed in arch/ppc/lib/
> 
> note: checkpatch still emits warnings about using volatile
[...]

> +
> +

Too many spaces -- one space too much.

> +int ide_preinit(void)
> +{
> +	int i;
> +	/* Initialize PIO timing tables */
> +	for (i = 0; i <= IDE_MAX_PIO_MODE; ++i) {
> +		pio_config_clk[i].t_setup =
> +			PCMCIA_MK_CLKS(pio_config_ns[i].t_setup, gd->bus_clk);
> +		pio_config_clk[i].t_length =
> +			PCMCIA_MK_CLKS(pio_config_ns[i].t_length, gd->bus_clk);
> +		pio_config_clk[i].t_hold =
> +			PCMCIA_MK_CLKS(pio_config_ns[i].t_hold, gd->bus_clk);
> +		debug("PIO Mode %d: setup=%2d ns/%d clk" "  len=%3d ns/%d clk"
> +			"  hold=%2d ns/%d clk\n", i, pio_config_ns[i].t_setup,
> +			pio_config_clk[i].t_setup, pio_config_ns[i].t_length,
> +			pio_config_clk[i].t_length, pio_config_ns[i].t_hold,
> +			pio_config_clk[i].t_hold);
> +	}
> +
> +	return 0;
> +}
> +
> +int ide_init_postreset(void)
> +{
> +	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
> +	volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
> +
> +	/* PCMCIA / IDE initialization for common mem space */
> +	pcmp->pcmc_pgcrb = 0;
> +
> +	/* start in PIO mode 0 - most relaxed timings */
> +	pio_mode = 0;
> +	set_pcmcia_timing(pio_mode);
> +	return 0;
> +}
> +#endif /* CONFIG_IDE_8xx_DIRECT */
> +
> +
> +

DTTO

> +#ifdef CONFIG_IDE_8xx_PCCARD
> +
> +int ide_preinit(void)
> +{
> +	ide_devices_found = 0;
> +	/* initialize the PCMCIA IDE adapter card */
> +	pcmcia_on();
> +	if (!ide_devices_found)
> +		return 1;
> +	udelay(1000000);/* 1 s */
> +	return 0;
> +}
> +#endif
> +
> +

Trailing newlines

> diff --git a/arch/powerpc/lib/ide.h b/arch/powerpc/lib/ide.h
> new file mode 100644
> index 0000000..9e80702
> --- /dev/null
> +++ b/arch/powerpc/lib/ide.h
> @@ -0,0 +1,31 @@
> +/*
> + * (C) Copyright 2012
> + * Pavel Herrmann <morpheus.ibis@gmail.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef _MPC8XX_IDE_H_
> +#define _MPC8XX_IDE_H_ 1
> +
> +#ifdef CONFIG_IDE_8xx_PCCARD
> +int pcmcia_on(void);
> +extern int ide_devices_found;

Why is this needed? Where was this before ? Is include/pcmcia.h not good?

> +#endif
> +#endif

[...]

> diff --git a/include/configs/ICU862.h b/include/configs/ICU862.h
> index 81f219c..b58b6f6 100644
> --- a/include/configs/ICU862.h
> +++ b/include/configs/ICU862.h
> @@ -349,6 +349,7 @@
>   *-----------------------------------------------------------------------
>   */
> 
> +#define CONFIG_IDE_PREINIT	1	/* Use preinit IDE hook */

Do you need this defined to a particular value or is having this defined enough?

>  #define	CONFIG_IDE_8xx_PCCARD	1	/* Use IDE with PC Card	Adapter	

[...]

> diff --git a/include/ide.h b/include/ide.h
> index 8ecc9dd..3bae40d 100644
> --- a/include/ide.h
> +++ b/include/ide.h
> @@ -54,6 +54,14 @@ void ide_init(void);
>  ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
>  ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, const void
> *buffer);
> 
> +#ifdef CONFIG_IDE_PREINIT
> +int ide_preinit(void);
> +#endif
> +
> +#ifdef CONFIG_IDE_INIT_POSTRESET
> +int ide_init_postreset(void);
> +#endif
> +
>  #if defined(CONFIG_OF_IDE_FIXUP)
>  int ide_device_present(int dev);
>  #endif

  reply	other threads:[~2012-10-07 18:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07 15:56 [U-Boot] [PATCH 00/10] IDE code cleanup Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 01/10] remove CONFIG_SC3 from cmd_ide.c Pavel Herrmann
2012-10-17 15:02   ` [U-Boot] [U-Boot,01/10] " Tom Rini
2012-10-07 15:56 ` [U-Boot] [PATCH 02/10] split mpc8xx hooks " Pavel Herrmann
2012-10-07 18:09   ` Marek Vasut [this message]
2012-10-07 18:09   ` Marek Vasut
2012-10-09 17:01   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 03/10] split IVM power " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 04/10] change all versions of input_data() and output_data() to global weak aliases Pavel Herrmann
2012-10-07 18:14   ` Marek Vasut
2012-10-09 13:42     ` Pavel Herrmann
2012-10-09 17:13       ` Marek Vasut
2012-10-09 17:04   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 05/10] split CPC45 board-specific IDE functions from cmd_ide.c Pavel Herrmann
2012-10-07 18:20   ` Marek Vasut
2012-10-09 13:38     ` Pavel Herrmann
2012-10-09 17:13       ` Marek Vasut
2012-10-07 15:56 ` [U-Boot] [PATCH 06/10] make ide_led() a weak alias Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 07/10] move CPC45 ide_led to the same file as other IDE hooks Pavel Herrmann
2012-10-07 18:21   ` Marek Vasut
2012-10-09 17:06   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 08/10] split AU1X00 specific code from cmd_ide.c Pavel Herrmann
2012-10-08 23:38   ` Tom Rini
2012-10-09 13:35     ` Pavel Herrmann
2012-10-09 17:10   ` [U-Boot] [PATCH v2 " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 09/10] split PCS440EP " Pavel Herrmann
2012-10-07 15:56 ` [U-Boot] [PATCH 10/10] remove unnecessary includes " Pavel Herrmann
2012-10-07 18:23 ` [U-Boot] [PATCH 00/10] IDE code cleanup Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201210072009.08283.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox