Date: Thu, 7 Jun 2007 21:22:52 +0200 (CEST) From: =?iso-8859-1?Q?Bj=F6rn_K=F6nig?= <bkoenig@alpha-tierchen.de> To: ticso@cicely.de Cc: arm@freebsd.org Subject: Re: 4-bit SD Card mode Message-ID: <49754.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181244172.squirrel@webmail.alpha-tierchen.de> In-Reply-To: <20070607180946.GK16463@cicely12.cicely.de> References: <54244.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181211368.squirrel@webmail.alpha-tierchen.de> <20070607105306.GH16463@cicely12.cicely.de> <64329.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181214774.squirrel@webmail.alpha-tierchen.de> <20070607.093710.-1297711916.imp@bsdimp.com> <50392.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181235257.squirrel@webmail.alpha-tierchen.de> <20070607180946.GK16463@cicely12.cicely.de>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_20070607212252_63505 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Bernd schrieb: > We should at least split it into a processor specific and board > specific _machdep.d file. > So far the kb920x_machdep file has become more or less a processor > specific file as it is used for many different boards. I agree. I always felt uncomfortable when editing kb920x_machdep.c since my board has nothing to do with kb920x. > But I still think that the loader should take care about HW-setup. > The loader need to setup the HW anyway in may points, why not do it > completely then? However, what would you do if the boot loader doesn't set up? In this case you have at least one reason to use another loader, but probably you can't for some reason or you just don't want to. Using a chain of loaders may be a workaround, but in my opinion the easiest and most comfortable way is to let the kernel do this instead of making assumptions about the state of hardware. While thinking about this I got the idea that at91_mci_init in src/sys/arm/at91/at91_mci.c might be a better place for configuring the PIO controller accordingly, because this makes the initialisation dependent from "device at91_mci" in the kernel configuration file. Björn ------=_20070607212252_63505 Content-Type: text/x-diff; name="at91_mci.c.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="at91_mci.c.diff" --- src/sys/arm/at91/at91_mci.c Fri Feb 23 12:18:27 2007 +++ src/sys/arm/at91/at91_mci.c Thu Jun 7 21:05:46 2007 @@ -55,6 +55,8 @@ #include <arm/at91/at91var.h> #include <arm/at91/at91_mcireg.h> #include <arm/at91/at91_pdcreg.h> +#include <arm/at91/at91_piovar.h> +#include <arm/at91/at91_pio_rm9200.h> #include <dev/mmc/bridge.h> #include <dev/mmc/mmcreg.h> #include <dev/mmc/mmcbrvar.h> @@ -132,6 +134,11 @@ at91_mci_init(device_t dev) { struct at91_mci_softc *sc = device_get_softc(dev); + + at91_pio_use_gpio(AT91RM92_PIOB_BASE, AT91C_PIO_PB7); + at91_pio_gpio_output(AT91RM92_PIOB_BASE, AT91C_PIO_PB7, 0); + at91_pio_use_periph_a(AT91RM92_PIOA_BASE, AT91C_PA28_MCCDA | AT91C_PA29_MCDA0 | AT91C_PA27_MCCK, 0); + at91_pio_use_periph_b(AT91RM92_PIOB_BASE, AT91C_PB3_MCDA1 | AT91C_PB4_MCDA2 | AT91C_PB5_MCDA3, 0); WR4(sc, MCI_CR, MCI_CR_MCIEN); /* Enable controller */ WR4(sc, MCI_IDR, 0xffffffff); /* Turn off interrupts */ ------=_20070607212252_63505--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49754.2001:6f8:101e:0:20e:cff:fe6d:6adb.1181244172.squirrel>