Normalize drivers between stage1 and 2

This commit is contained in:
TuxSH 2018-05-06 15:02:13 +02:00
parent 306555e522
commit 1aa6b92bc4
6 changed files with 46 additions and 30 deletions

View file

@ -0,0 +1,7 @@
#ifndef FUSEE_DRIVER_UTILS_H
#define FUSEE_DRIVER_UTILS_H
#include "vsprintf.h"
#include "printk.h"
#endif

View file

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#include <errno.h> #include <errno.h>
#include "lib/driver_utils.h"
#include "sdmmc.h" #include "sdmmc.h"
#include "car.h" #include "car.h"
#include "pinmux.h" #include "pinmux.h"
@ -16,7 +17,6 @@
#include "supplies.h" #include "supplies.h"
#include "pmc.h" #include "pmc.h"
#include "pad_control.h" #include "pad_control.h"
#include "lib/printk.h"
#define TEGRA_SDMMC_BASE (0x700B0000) #define TEGRA_SDMMC_BASE (0x700B0000)
#define TEGRA_SDMMC_SIZE (0x200) #define TEGRA_SDMMC_SIZE (0x200)

View file

@ -3,8 +3,8 @@
* ~ktemkin * ~ktemkin
*/ */
#include "lib/driver_utils.h"
#include "supplies.h" #include "supplies.h"
#include "lib/printk.h"
// FIXME: replace hwinit with our own code // FIXME: replace hwinit with our own code
#include "hwinit/max7762x.h" #include "hwinit/max7762x.h"

View file

@ -0,0 +1,10 @@
#ifndef FUSEE_DRIVER_UTILS_H
#define FUSEE_DRIVER_UTILS_H
#include <stdio.h>
#include <stdarg.h>
#define vprintk vprintf
#define printk printf
#endif

View file

@ -2,12 +2,11 @@
* Fusée SD/MMC driver for the Switch * Fusée SD/MMC driver for the Switch
* ~ktemkin * ~ktemkin
*/ */
#include <stdio.h>
#include <stdarg.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <errno.h> #include <errno.h>
#include "lib/driver_utils.h"
#include "sdmmc.h" #include "sdmmc.h"
#include "car.h" #include "car.h"
#include "pinmux.h" #include "pinmux.h"
@ -427,9 +426,9 @@ static void mmc_vprint(struct mmc *mmc, char *fmt, int required_loglevel, va_lis
if (sdmmc_loglevel < required_loglevel) if (sdmmc_loglevel < required_loglevel)
return; return;
printf("%s: ", mmc->name); printk("%s: ", mmc->name);
vprintf(fmt, list); vprintk(fmt, list);
printf("\n"); printk("\n");
} }
@ -732,7 +731,7 @@ static int sdmmc_set_up_clocking_parameters(struct mmc *mmc)
break; break;
default: default:
printf("ERROR: initialization not yet writen for SDMMC%d", mmc->controller); printk("ERROR: initialization not yet writen for SDMMC%d", mmc->controller);
return ENODEV; return ENODEV;
} }
@ -1480,7 +1479,7 @@ static uint32_t sdmmc_extract_csd_bits(uint32_t *csd, int start, int width)
// Sanity check our span. // Sanity check our span.
if ((start + width) > 128) { if ((start + width) > 128) {
printf("MMC ERROR: invalid CSD slice!\n"); printk("MMC ERROR: invalid CSD slice!\n");
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
@ -2205,7 +2204,7 @@ static void sdmmc_initialize_defaults(struct mmc *mmc)
break; break;
default: default:
printf("ERROR: initialization not yet writen for SDMMC%d", mmc->controller); printk("ERROR: initialization not yet writen for SDMMC%d", mmc->controller);
break; break;
} }
} }

View file

@ -3,7 +3,7 @@
* ~ktemkin * ~ktemkin
*/ */
#include <stdio.h> #include "lib/driver_utils.h"
#include "supplies.h" #include "supplies.h"
// FIXME: replace hwinit with our own code // FIXME: replace hwinit with our own code
@ -23,7 +23,7 @@ void supply_enable(enum switch_power_supply supply)
return; return;
default: default:
printf("ERROR: could not enable unknown supply %d!\n", supply); printk("ERROR: could not enable unknown supply %d!\n", supply);
return; return;
} }
} }