diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-22 07:43:42 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-22 07:43:42 -0400 |
commit | d51639c91c2aca7db6df8150ab438b6cbf62227a (patch) | |
tree | e203a99dd75820a0276b3c6b4961fed0ed673cba | |
parent | b3dd947ffd8b1b8c54313a848c203cbe3afeec94 (diff) |
Don't crash due to gpmc failure on desktop
-rw-r--r-- | bus.c | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -183,19 +183,21 @@ static void gpmc_setup(int chipselect, int accesscycles, int size, bool enablecs gpmc_mapregisters(); - // disable before playing with the registers.. - *(registers + displacement + GPMC_CONFIG7) = 0x0; - - *(registers + displacement + GPMC_CONFIG1) = 0x0; - *(registers + displacement + GPMC_CONFIG2) = (accesscycles << CSWROFFTIME) | (accesscycles << CSRDOFFTIME); - *(registers + displacement + GPMC_CONFIG3) = 0x0; // not using ADV so we can ignore this guy - *(registers + displacement + GPMC_CONFIG4) = (accesscycles << OEOFFTIME); - *(registers + displacement + GPMC_CONFIG5) = (accesscycles << RDACCESSTIME) | (accesscycles << WRCYCLETIME) - | (accesscycles << RDCYCLETIME); - *(registers + displacement + GPMC_CONFIG6) = (accesscycles << WRACCESSTIME); - *(registers + displacement + GPMC_CONFIG7) = size << 8 | (enablecs ? 1 << 6 : 0) | baseaddress; - - gpmc_unmapregisters(); + if (registers != MAP_FAILED) { + // disable before playing with the registers.. + *(registers + displacement + GPMC_CONFIG7) = 0x0; + + *(registers + displacement + GPMC_CONFIG1) = 0x0; + *(registers + displacement + GPMC_CONFIG2) = (accesscycles << CSWROFFTIME) | (accesscycles << CSRDOFFTIME); + *(registers + displacement + GPMC_CONFIG3) = 0x0; // not using ADV so we can ignore this guy + *(registers + displacement + GPMC_CONFIG4) = (accesscycles << OEOFFTIME); + *(registers + displacement + GPMC_CONFIG5) = (accesscycles << RDACCESSTIME) | (accesscycles << WRCYCLETIME) + | (accesscycles << RDCYCLETIME); + *(registers + displacement + GPMC_CONFIG6) = (accesscycles << WRACCESSTIME); + *(registers + displacement + GPMC_CONFIG7) = size << 8 | (enablecs ? 1 << 6 : 0) | baseaddress; + + gpmc_unmapregisters(); + } } /* |