Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint/sandpoint Fix nor-flash bus space: extent...
details: https://anonhg.NetBSD.org/src/rev/fc6637a957d3
branches: trunk
changeset: 340480:fc6637a957d3
user: phx <phx%NetBSD.org@localhost>
date: Mon Sep 07 23:00:08 2015 +0000
description:
Fix nor-flash bus space: extent limit should not be zero and bus space is
definitely big-endian. Reading the flash via /dev/flash0 works now.
Writing is untested.
diffstat:
sys/arch/sandpoint/sandpoint/flash_cfi.c | 21 +++++++++++----------
sys/arch/sandpoint/sandpoint/machdep.c | 8 ++++----
sys/arch/sandpoint/sandpoint/mainbus.c | 5 ++---
3 files changed, 17 insertions(+), 17 deletions(-)
diffs (142 lines):
diff -r 2c893885e26d -r fc6637a957d3 sys/arch/sandpoint/sandpoint/flash_cfi.c
--- a/sys/arch/sandpoint/sandpoint/flash_cfi.c Mon Sep 07 20:00:49 2015 +0000
+++ b/sys/arch/sandpoint/sandpoint/flash_cfi.c Mon Sep 07 23:00:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: flash_cfi.c,v 1.3 2012/01/30 15:47:01 phx Exp $ */
+/* $NetBSD: flash_cfi.c,v 1.4 2015/09/07 23:00:08 phx Exp $ */
/*-
* Copyright (c) 2011 Frank Wille.
@@ -32,7 +32,7 @@
* NOR CFI driver support for sandpoint
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: flash_cfi.c,v 1.3 2012/01/30 15:47:01 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_cfi.c,v 1.4 2015/09/07 23:00:08 phx Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -63,7 +63,7 @@
{
extern struct cfdriver cfi_cd;
struct mainbus_attach_args *ma = aux;
- const bus_size_t tmpsize = CFI_QRY_MIN_MAP_SIZE;
+ const bus_size_t qrysize = CFI_QRY_MIN_MAP_SIZE;
struct cfi cfi;
int error, rv;
@@ -74,11 +74,12 @@
cfi.cfi_bst = ma->ma_bst;
- error = bus_space_map(cfi.cfi_bst, ma->ma_addr, tmpsize, 0,
+ /* flash should be at least 2 MiB in size at 0xffe00000 */
+ error = bus_space_map(cfi.cfi_bst, 0xffe00000, qrysize, 0,
&cfi.cfi_bsh);
if (error != 0) {
aprint_error("%s: cannot map %d at offset %#x, error %d\n",
- __func__, tmpsize, ma->ma_addr, error);
+ __func__, qrysize, ma->ma_addr, error);
return 0;
}
@@ -90,7 +91,7 @@
} else
rv = 1;
- bus_space_unmap(cfi.cfi_bst, cfi.cfi_bsh, tmpsize);
+ bus_space_unmap(cfi.cfi_bst, cfi.cfi_bsh, qrysize);
return rv;
}
@@ -99,7 +100,7 @@
{
struct mainbus_attach_args *ma = aux;
struct sandpointcfi_softc *sc;
- const bus_size_t tmpsize = CFI_QRY_MIN_MAP_SIZE;
+ const bus_size_t qrysize = CFI_QRY_MIN_MAP_SIZE;
bus_addr_t addr;
bool found;
int error;
@@ -112,7 +113,7 @@
sc->sc_cfi.cfi_bst = ma->ma_bst;
/* map enough to identify, remap later when size is known */
- error = bus_space_map(sc->sc_cfi.cfi_bst, ma->ma_addr, tmpsize, 0,
+ error = bus_space_map(sc->sc_cfi.cfi_bst, 0xffe00000, qrysize, 0,
&sc->sc_cfi.cfi_bsh);
if (error != 0) {
aprint_error_dev(self, "could not map error %d\n", error);
@@ -122,7 +123,7 @@
/* identify the NOR flash */
found = cfi_identify(&sc->sc_cfi);
- bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, tmpsize);
+ bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, qrysize);
if (!found) {
/* should not happen, we already probed OK in match */
aprint_error_dev(self, "could not map error %d\n", error);
@@ -132,7 +133,7 @@
/* get size of flash in bytes */
sc->sc_size = 1 << sc->sc_cfi.cfi_qry_data.device_size;
- /* real base address */
+ /* determine real base address */
addr = (0xffffffff - sc->sc_size) + 1;
sc->sc_nor_if = nor_interface_cfi;
diff -r 2c893885e26d -r fc6637a957d3 sys/arch/sandpoint/sandpoint/machdep.c
--- a/sys/arch/sandpoint/sandpoint/machdep.c Mon Sep 07 20:00:49 2015 +0000
+++ b/sys/arch/sandpoint/sandpoint/machdep.c Mon Sep 07 23:00:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.63 2013/04/21 15:42:12 kiyohara Exp $ */
+/* $NetBSD: machdep.c,v 1.64 2015/09/07 23:00:08 phx Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.63 2013/04/21 15:42:12 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.64 2015/09/07 23:00:08 phx Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@@ -450,8 +450,8 @@
0xfc000000, 0x00000000, 0x00100000,
};
struct powerpc_bus_space sandpoint_flash_space_tag = {
- _BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE,
- 0x00000000, 0xff000000, 0x00000000,
+ _BUS_SPACE_BIG_ENDIAN|_BUS_SPACE_MEM_TYPE,
+ 0x00000000, 0xff000000, 0xffffffff,
};
struct powerpc_bus_space sandpoint_nhgpio_space_tag = {
_BUS_SPACE_BIG_ENDIAN|_BUS_SPACE_MEM_TYPE,
diff -r 2c893885e26d -r fc6637a957d3 sys/arch/sandpoint/sandpoint/mainbus.c
--- a/sys/arch/sandpoint/sandpoint/mainbus.c Mon Sep 07 20:00:49 2015 +0000
+++ b/sys/arch/sandpoint/sandpoint/mainbus.c Mon Sep 07 23:00:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.29 2012/01/31 21:12:03 phx Exp $ */
+/* $NetBSD: mainbus.c,v 1.30 2015/09/07 23:00:08 phx Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.29 2012/01/31 21:12:03 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2015/09/07 23:00:08 phx Exp $");
#include "opt_pci.h"
#include "pci.h"
@@ -103,7 +103,6 @@
mba.ma_name = "cfi";
mba.ma_bst = &sandpoint_flash_space_tag;
- mba.ma_addr = 0xffe00000; /* smallest flash is 2 MiB */
config_found_ia(self, "mainbus", &mba, mainbus_print);
/*
Home |
Main Index |
Thread Index |
Old Index