1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2025-04-21 12:27:27 +03:00

libubb/mmcclk.c (mmcclk_first): add flags to relax clock selection constraints

This commit is contained in:
Werner Almesberger
2013-01-28 20:49:17 -03:00
parent 14b7a9cdee
commit 591bb6427b
2 changed files with 30 additions and 4 deletions

View File

@@ -19,15 +19,34 @@
#define BEN_PLL_CLK_HZ 336000000
/*
* By default (flags = 0), only clocks that can be used with any mode of
* operation will be generated. The following flags also include clocks ...
*/
#define MMCCLK_FLAG_RD_ONLY (1 << 0) /* not suitable for writing */
#define MMCCLK_FLAG_WR_ONLY (1 << 1) /* not suitable for reading */
#define MMCCLK_FLAG_INTERNAL (1 << 2) /* not suitable for bus use */
#define MMCCLK_FLAG_UNSAFE (1 << 3) /* that may hang the MSC */
#define MMCCLK_FLAG_ALL (1 << 4) /* that will hang the MSC */
/*
* For now, only MMCCLK_FLAG_UNSAFE and MMCCLK_FLAG_ALL are implemented, but
* further research may also reveal limits that depend on the type of
* operation.
*/
struct mmcclk {
int sys_clk_hz; /* system clock speed in Hz */
double bus_clk_hz; /* MMC bus clock in Hz */
uint32_t clkdiv; /* MSC controller clock */
uint32_t clkrt; /* bus clock divider */
unsigned flags;
};
void mmcclk_first(struct mmcclk *dsc, int sys_clk_hz);
void mmcclk_first(struct mmcclk *dsc, int sys_clk_hz, unsigned flags);
int mmcclk_next(struct mmcclk *dsc);
void mmcclk_start(struct mmcclk *dsc);