2 * Copyright (c) 2017 Ilya Bakulin
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include <sys/ioctl.h>
33 #include <sys/stdint.h>
34 #include <sys/types.h>
36 #include <sys/endian.h>
53 #include <cam/cam_debug.h>
54 #include <cam/cam_ccb.h>
55 #include <cam/mmc/mmc_all.h>
61 uint16_t max_block_size;
64 int sdio_rw_direct(struct cam_device *dev,
71 sdio_rw_extended(struct cam_device *dev,
75 caddr_t data, size_t datalen,
78 uint8_t sdio_read_1(struct cam_device *dev, uint8_t func_number, uint32_t addr, int *ret);
79 int sdio_write_1(struct cam_device *dev, uint8_t func_number, uint32_t addr, uint8_t val);
80 uint16_t sdio_read_2(struct cam_device *dev, uint8_t func_number, uint32_t addr, int *ret);
81 int sdio_write_2(struct cam_device *dev, uint8_t func_number, uint32_t addr, uint16_t val);
82 uint32_t sdio_read_4(struct cam_device *dev, uint8_t func_number, uint32_t addr, int *ret);
83 int sdio_write_4(struct cam_device *dev, uint8_t func_number, uint32_t addr, uint32_t val);
84 int sdio_read_bool_for_func(struct cam_device *dev, uint32_t addr, uint8_t func_number, uint8_t *is_enab);
85 int sdio_set_bool_for_func(struct cam_device *dev, uint32_t addr, uint8_t func_number, int enable);
86 int sdio_is_func_ready(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab);
87 int sdio_is_func_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab);
88 int sdio_func_enable(struct cam_device *dev, uint8_t func_number, int enable);
89 int sdio_is_func_intr_enabled(struct cam_device *dev, uint8_t func_number, uint8_t *is_enab);
90 int sdio_func_intr_enable(struct cam_device *dev, uint8_t func_number, int enable);
91 void sdio_card_reset(struct cam_device *dev);
92 uint32_t sdio_get_common_cis_addr(struct cam_device *dev);
93 int sdio_func_read_cis(struct cam_device *dev, uint8_t func_number,
94 uint32_t cis_addr, struct cis_info *info);
95 int sdio_card_set_bus_width(struct cam_device *dev, enum mmc_bus_width bw);