1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12#include <stdint.h> 13#include <utils/attribute.h> 14#include <platsupport/mux.h> 15#include "../../services.h" 16 17struct omap3_mux_regs { 18 int dummy; 19}; 20 21static struct omap3_mux { 22 volatile struct omap3_mux_regs* mux; 23} _mux; 24 25static inline struct omap3_mux* get_mux_priv(mux_sys_t* mux) { 26 return (struct omap3_mux*)mux->priv; 27} 28 29static inline void set_mux_priv(mux_sys_t* mux, struct omap3_mux* omap3_mux) 30{ 31 assert(mux != NULL); 32 assert(omap3_mux != NULL); 33 mux->priv = omap3_mux; 34} 35 36static int 37omap3_mux_feature_enable(mux_sys_t* mux, mux_feature_t mux_feature, UNUSED enum mux_gpio_dir mgd) 38{ 39 struct omap3_mux* m; 40 if (mux == NULL || mux->priv == NULL) { 41 return -1; 42 } 43 m = get_mux_priv(mux); 44 45 switch (mux_feature) { 46 default: 47 (void)m; 48 return -1; 49 } 50} 51 52static int 53omap3_mux_init_common(mux_sys_t* mux) 54{ 55 set_mux_priv(mux, &_mux); 56 mux->feature_enable = &omap3_mux_feature_enable; 57 return 0; 58} 59 60int 61omap3_mux_init(void* bank1, 62 mux_sys_t* mux) 63{ 64 (void)bank1; 65 return omap3_mux_init_common(mux); 66} 67 68int 69mux_sys_init(ps_io_ops_t* io_ops, UNUSED void *dependencies, mux_sys_t* mux) 70{ 71 (void)io_ops; 72 return omap3_mux_init_common(mux); 73} 74