brcmfmac: use consistent function names in bcmsdh.c
Functions in bcmsdh.c that are called with struct brcmf_sdio_dev instance are renamed consistently with brcmf_sdiod_ prefix. Also removing brcmf_sdioh_attach/detach() functions and merge it with brcmf_sdiod_probe/remove(). Reviewed-by: Franky Lin <frankyl@broadcom.com> Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
6043033c31
commit
a39be27b49
|
@ -57,7 +57,7 @@
|
||||||
#define SDIO_WAIT_F2RDY 3000
|
#define SDIO_WAIT_F2RDY 3000
|
||||||
|
|
||||||
|
|
||||||
static irqreturn_t brcmf_sdio_oob_irqhandler(int irq, void *dev_id)
|
static irqreturn_t brcmf_sdiod_oob_irqhandler(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct brcmf_bus *bus_if = dev_get_drvdata(dev_id);
|
struct brcmf_bus *bus_if = dev_get_drvdata(dev_id);
|
||||||
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
||||||
|
@ -77,7 +77,7 @@ static irqreturn_t brcmf_sdio_oob_irqhandler(int irq, void *dev_id)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void brcmf_sdio_ib_irqhandler(struct sdio_func *func)
|
static void brcmf_sdiod_ib_irqhandler(struct sdio_func *func)
|
||||||
{
|
{
|
||||||
struct brcmf_bus *bus_if = dev_get_drvdata(&func->dev);
|
struct brcmf_bus *bus_if = dev_get_drvdata(&func->dev);
|
||||||
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
||||||
|
@ -88,11 +88,11 @@ static void brcmf_sdio_ib_irqhandler(struct sdio_func *func)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dummy handler for SDIO function 2 interrupt */
|
/* dummy handler for SDIO function 2 interrupt */
|
||||||
static void brcmf_sdio_dummy_irqhandler(struct sdio_func *func)
|
static void brcmf_sdiod_dummy_irqhandler(struct sdio_func *func)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
|
static bool brcmf_sdiod_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
|
||||||
{
|
{
|
||||||
bool is_err = false;
|
bool is_err = false;
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
@ -101,8 +101,8 @@ static bool brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
|
||||||
return is_err;
|
return is_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev,
|
static void brcmf_sdiod_pm_resume_wait(struct brcmf_sdio_dev *sdiodev,
|
||||||
wait_queue_head_t *wq)
|
wait_queue_head_t *wq)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
|
@ -111,7 +111,7 @@ static void brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
|
int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u8 data;
|
u8 data;
|
||||||
|
@ -121,7 +121,7 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
|
||||||
brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
|
brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n",
|
||||||
sdiodev->pdata->oob_irq_nr);
|
sdiodev->pdata->oob_irq_nr);
|
||||||
ret = request_irq(sdiodev->pdata->oob_irq_nr,
|
ret = request_irq(sdiodev->pdata->oob_irq_nr,
|
||||||
brcmf_sdio_oob_irqhandler,
|
brcmf_sdiod_oob_irqhandler,
|
||||||
sdiodev->pdata->oob_irq_flags,
|
sdiodev->pdata->oob_irq_flags,
|
||||||
"brcmf_oob_intr",
|
"brcmf_oob_intr",
|
||||||
&sdiodev->func[1]->dev);
|
&sdiodev->func[1]->dev);
|
||||||
|
@ -145,36 +145,36 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
|
||||||
sdio_claim_host(sdiodev->func[1]);
|
sdio_claim_host(sdiodev->func[1]);
|
||||||
|
|
||||||
/* must configure SDIO_CCCR_IENx to enable irq */
|
/* must configure SDIO_CCCR_IENx to enable irq */
|
||||||
data = brcmf_sdio_regrb(sdiodev, SDIO_CCCR_IENx, &ret);
|
data = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_IENx, &ret);
|
||||||
data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1;
|
data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1;
|
||||||
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret);
|
brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret);
|
||||||
|
|
||||||
/* redirect, configure and enable io for interrupt signal */
|
/* redirect, configure and enable io for interrupt signal */
|
||||||
data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
|
data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
|
||||||
if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
|
if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH)
|
||||||
data |= SDIO_SEPINT_ACT_HI;
|
data |= SDIO_SEPINT_ACT_HI;
|
||||||
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
|
brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
|
||||||
|
|
||||||
sdio_release_host(sdiodev->func[1]);
|
sdio_release_host(sdiodev->func[1]);
|
||||||
} else {
|
} else {
|
||||||
brcmf_dbg(SDIO, "Entering\n");
|
brcmf_dbg(SDIO, "Entering\n");
|
||||||
sdio_claim_host(sdiodev->func[1]);
|
sdio_claim_host(sdiodev->func[1]);
|
||||||
sdio_claim_irq(sdiodev->func[1], brcmf_sdio_ib_irqhandler);
|
sdio_claim_irq(sdiodev->func[1], brcmf_sdiod_ib_irqhandler);
|
||||||
sdio_claim_irq(sdiodev->func[2], brcmf_sdio_dummy_irqhandler);
|
sdio_claim_irq(sdiodev->func[2], brcmf_sdiod_dummy_irqhandler);
|
||||||
sdio_release_host(sdiodev->func[1]);
|
sdio_release_host(sdiodev->func[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev)
|
int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
|
||||||
{
|
{
|
||||||
brcmf_dbg(SDIO, "Entering\n");
|
brcmf_dbg(SDIO, "Entering\n");
|
||||||
|
|
||||||
if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
|
if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) {
|
||||||
sdio_claim_host(sdiodev->func[1]);
|
sdio_claim_host(sdiodev->func[1]);
|
||||||
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
|
brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL);
|
||||||
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
|
brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL);
|
||||||
sdio_release_host(sdiodev->func[1]);
|
sdio_release_host(sdiodev->func[1]);
|
||||||
|
|
||||||
if (sdiodev->oob_irq_requested) {
|
if (sdiodev->oob_irq_requested) {
|
||||||
|
@ -197,7 +197,7 @@ int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
|
static inline int brcmf_sdiod_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
|
||||||
uint regaddr, u8 *byte)
|
uint regaddr, u8 *byte)
|
||||||
{
|
{
|
||||||
struct sdio_func *sdfunc = sdiodev->func[0];
|
struct sdio_func *sdfunc = sdiodev->func[0];
|
||||||
|
@ -227,20 +227,20 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
|
||||||
return err_ret;
|
return err_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
|
static int brcmf_sdiod_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
|
||||||
uint func, uint regaddr, u8 *byte)
|
uint func, uint regaddr, u8 *byte)
|
||||||
{
|
{
|
||||||
int err_ret;
|
int err_ret;
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr);
|
brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr);
|
||||||
|
|
||||||
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait);
|
brcmf_sdiod_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait);
|
||||||
if (brcmf_pm_resume_error(sdiodev))
|
if (brcmf_sdiod_pm_resume_error(sdiodev))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (rw && func == 0) {
|
if (rw && func == 0) {
|
||||||
/* handle F0 separately */
|
/* handle F0 separately */
|
||||||
err_ret = brcmf_sdioh_f0_write_byte(sdiodev, regaddr, byte);
|
err_ret = brcmf_sdiod_f0_write_byte(sdiodev, regaddr, byte);
|
||||||
} else {
|
} else {
|
||||||
if (rw) /* CMD52 Write */
|
if (rw) /* CMD52 Write */
|
||||||
sdio_writeb(sdiodev->func[func], *byte, regaddr,
|
sdio_writeb(sdiodev->func[func], *byte, regaddr,
|
||||||
|
@ -272,7 +272,7 @@ static int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
|
||||||
return err_ret;
|
return err_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint rw,
|
static int brcmf_sdiod_request_word(struct brcmf_sdio_dev *sdiodev, uint rw,
|
||||||
uint func, uint addr, u32 *word,
|
uint func, uint addr, u32 *word,
|
||||||
uint nbytes)
|
uint nbytes)
|
||||||
{
|
{
|
||||||
|
@ -286,8 +286,8 @@ static int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint rw,
|
||||||
brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
|
brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
|
||||||
rw, func, addr, nbytes);
|
rw, func, addr, nbytes);
|
||||||
|
|
||||||
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_word_wait);
|
brcmf_sdiod_pm_resume_wait(sdiodev, &sdiodev->request_word_wait);
|
||||||
if (brcmf_pm_resume_error(sdiodev))
|
if (brcmf_sdiod_pm_resume_error(sdiodev))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (rw) { /* CMD52 Write */
|
if (rw) { /* CMD52 Write */
|
||||||
|
@ -317,7 +317,7 @@ static int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint rw,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
|
brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
|
||||||
{
|
{
|
||||||
int err = 0, i;
|
int err = 0, i;
|
||||||
u8 addr[3];
|
u8 addr[3];
|
||||||
|
@ -332,7 +332,7 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
|
||||||
do {
|
do {
|
||||||
if (retry)
|
if (retry)
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
err = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE,
|
err = brcmf_sdiod_request_byte(sdiodev, SDIOH_WRITE,
|
||||||
SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW + i,
|
SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW + i,
|
||||||
&addr[i]);
|
&addr[i]);
|
||||||
} while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
|
} while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
|
||||||
|
@ -348,13 +348,13 @@ brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
brcmf_sdio_addrprep(struct brcmf_sdio_dev *sdiodev, uint width, u32 *addr)
|
brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, uint width, u32 *addr)
|
||||||
{
|
{
|
||||||
uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK;
|
uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (bar0 != sdiodev->sbwad) {
|
if (bar0 != sdiodev->sbwad) {
|
||||||
err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0);
|
err = brcmf_sdiod_set_sbaddr_window(sdiodev, bar0);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -369,8 +369,8 @@ brcmf_sdio_addrprep(struct brcmf_sdio_dev *sdiodev, uint width, u32 *addr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||||
void *data, bool write)
|
void *data, bool write)
|
||||||
{
|
{
|
||||||
u8 func_num, reg_size;
|
u8 func_num, reg_size;
|
||||||
s32 retry = 0;
|
s32 retry = 0;
|
||||||
|
@ -392,7 +392,7 @@ static int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||||
func_num = SDIO_FUNC_1;
|
func_num = SDIO_FUNC_1;
|
||||||
reg_size = 4;
|
reg_size = 4;
|
||||||
|
|
||||||
ret = brcmf_sdio_addrprep(sdiodev, reg_size, &addr);
|
ret = brcmf_sdiod_addrprep(sdiodev, reg_size, &addr);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -403,10 +403,10 @@ static int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||||
if (retry) /* wait for 1 ms till bus get settled down */
|
if (retry) /* wait for 1 ms till bus get settled down */
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
if (reg_size == 1)
|
if (reg_size == 1)
|
||||||
ret = brcmf_sdioh_request_byte(sdiodev, write,
|
ret = brcmf_sdiod_request_byte(sdiodev, write,
|
||||||
func_num, addr, data);
|
func_num, addr, data);
|
||||||
else
|
else
|
||||||
ret = brcmf_sdioh_request_word(sdiodev, write,
|
ret = brcmf_sdiod_request_word(sdiodev, write,
|
||||||
func_num, addr, data, 4);
|
func_num, addr, data, 4);
|
||||||
} while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
|
} while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
|
||||||
|
|
||||||
|
@ -417,13 +417,13 @@ done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
||||||
{
|
{
|
||||||
u8 data;
|
u8 data;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
|
brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
|
||||||
retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, false);
|
retval = brcmf_sdiod_regrw_helper(sdiodev, addr, &data, false);
|
||||||
brcmf_dbg(SDIO, "data:0x%02x\n", data);
|
brcmf_dbg(SDIO, "data:0x%02x\n", data);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -432,13 +432,13 @@ u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
||||||
{
|
{
|
||||||
u32 data;
|
u32 data;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
|
brcmf_dbg(SDIO, "addr:0x%08x\n", addr);
|
||||||
retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, false);
|
retval = brcmf_sdiod_regrw_helper(sdiodev, addr, &data, false);
|
||||||
brcmf_dbg(SDIO, "data:0x%08x\n", data);
|
brcmf_dbg(SDIO, "data:0x%08x\n", data);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -447,37 +447,37 @@ u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
void brcmf_sdiod_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||||
u8 data, int *ret)
|
u8 data, int *ret)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data);
|
brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data);
|
||||||
retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, true);
|
retval = brcmf_sdiod_regrw_helper(sdiodev, addr, &data, true);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = retval;
|
*ret = retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr,
|
||||||
u32 data, int *ret)
|
u32 data, int *ret)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data);
|
brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data);
|
||||||
retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, true);
|
retval = brcmf_sdiod_regrw_helper(sdiodev, addr, &data, true);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = retval;
|
*ret = retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
static int brcmf_sdiod_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||||
bool write, u32 addr, struct sk_buff *pkt)
|
bool write, u32 addr, struct sk_buff *pkt)
|
||||||
{
|
{
|
||||||
unsigned int req_sz;
|
unsigned int req_sz;
|
||||||
|
|
||||||
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
|
brcmf_sdiod_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
|
||||||
if (brcmf_pm_resume_error(sdiodev))
|
if (brcmf_sdiod_pm_resume_error(sdiodev))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
/* Single skb use the standard mmc interface */
|
/* Single skb use the standard mmc interface */
|
||||||
|
@ -500,7 +500,7 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* brcmf_sdio_sglist_rw - SDIO interface function for block data access
|
* brcmf_sdiod_sglist_rw - SDIO interface function for block data access
|
||||||
* @sdiodev: brcmfmac sdio device
|
* @sdiodev: brcmfmac sdio device
|
||||||
* @fn: SDIO function number
|
* @fn: SDIO function number
|
||||||
* @write: direction flag
|
* @write: direction flag
|
||||||
|
@ -511,9 +511,9 @@ static int brcmf_sdio_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||||
* stack for block data access. It assumes that the skb passed down by the
|
* stack for block data access. It assumes that the skb passed down by the
|
||||||
* caller has already been padded and aligned.
|
* caller has already been padded and aligned.
|
||||||
*/
|
*/
|
||||||
static int brcmf_sdio_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||||
bool write, u32 addr,
|
bool write, u32 addr,
|
||||||
struct sk_buff_head *pktlist)
|
struct sk_buff_head *pktlist)
|
||||||
{
|
{
|
||||||
unsigned int req_sz, func_blk_sz, sg_cnt, sg_data_sz, pkt_offset;
|
unsigned int req_sz, func_blk_sz, sg_cnt, sg_data_sz, pkt_offset;
|
||||||
unsigned int max_req_sz, orig_offset, dst_offset;
|
unsigned int max_req_sz, orig_offset, dst_offset;
|
||||||
|
@ -531,8 +531,8 @@ static int brcmf_sdio_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn,
|
||||||
if (!pktlist->qlen)
|
if (!pktlist->qlen)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
brcmf_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
|
brcmf_sdiod_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
|
||||||
if (brcmf_pm_resume_error(sdiodev))
|
if (brcmf_sdiod_pm_resume_error(sdiodev))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
target_list = pktlist;
|
target_list = pktlist;
|
||||||
|
@ -680,8 +680,8 @@ exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, u8 *buf, uint nbytes)
|
uint flags, u8 *buf, uint nbytes)
|
||||||
{
|
{
|
||||||
struct sk_buff *mypkt;
|
struct sk_buff *mypkt;
|
||||||
int err;
|
int err;
|
||||||
|
@ -693,7 +693,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = brcmf_sdcard_recv_pkt(sdiodev, addr, fn, flags, mypkt);
|
err = brcmf_sdiod_recv_pkt(sdiodev, addr, fn, flags, mypkt);
|
||||||
if (!err)
|
if (!err)
|
||||||
memcpy(buf, mypkt->data, nbytes);
|
memcpy(buf, mypkt->data, nbytes);
|
||||||
|
|
||||||
|
@ -702,8 +702,8 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff *pkt)
|
uint flags, struct sk_buff *pkt)
|
||||||
{
|
{
|
||||||
uint width;
|
uint width;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
@ -712,18 +712,18 @@ brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
fn, addr, pkt->len);
|
fn, addr, pkt->len);
|
||||||
|
|
||||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, pkt);
|
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, pkt);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff_head *pktq, uint totlen)
|
uint flags, struct sk_buff_head *pktq, uint totlen)
|
||||||
{
|
{
|
||||||
struct sk_buff *glom_skb;
|
struct sk_buff *glom_skb;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
@ -734,17 +734,17 @@ int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
fn, addr, pktq->qlen);
|
fn, addr, pktq->qlen);
|
||||||
|
|
||||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (pktq->qlen == 1)
|
if (pktq->qlen == 1)
|
||||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, pktq->next);
|
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, pktq->next);
|
||||||
else if (!sdiodev->sg_support) {
|
else if (!sdiodev->sg_support) {
|
||||||
glom_skb = brcmu_pkt_buf_get_skb(totlen);
|
glom_skb = brcmu_pkt_buf_get_skb(totlen);
|
||||||
if (!glom_skb)
|
if (!glom_skb)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
err = brcmf_sdio_buffrw(sdiodev, fn, false, addr, glom_skb);
|
err = brcmf_sdiod_buffrw(sdiodev, fn, false, addr, glom_skb);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -753,15 +753,15 @@ int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
skb_pull(glom_skb, skb->len);
|
skb_pull(glom_skb, skb->len);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
err = brcmf_sdio_sglist_rw(sdiodev, fn, false, addr, pktq);
|
err = brcmf_sdiod_sglist_rw(sdiodev, fn, false, addr, pktq);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, u8 *buf, uint nbytes)
|
uint flags, u8 *buf, uint nbytes)
|
||||||
{
|
{
|
||||||
struct sk_buff *mypkt;
|
struct sk_buff *mypkt;
|
||||||
uint width;
|
uint width;
|
||||||
|
@ -777,10 +777,10 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
memcpy(mypkt->data, buf, nbytes);
|
memcpy(mypkt->data, buf, nbytes);
|
||||||
|
|
||||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, mypkt);
|
err = brcmf_sdiod_buffrw(sdiodev, fn, true, addr, mypkt);
|
||||||
|
|
||||||
brcmu_pkt_buf_free_skb(mypkt);
|
brcmu_pkt_buf_free_skb(mypkt);
|
||||||
return err;
|
return err;
|
||||||
|
@ -788,8 +788,8 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff_head *pktq)
|
uint flags, struct sk_buff_head *pktq)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
uint width;
|
uint width;
|
||||||
|
@ -799,25 +799,25 @@ brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
fn, addr, pktq->qlen);
|
fn, addr, pktq->qlen);
|
||||||
|
|
||||||
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
|
||||||
err = brcmf_sdio_addrprep(sdiodev, width, &addr);
|
err = brcmf_sdiod_addrprep(sdiodev, width, &addr);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (pktq->qlen == 1 || !sdiodev->sg_support)
|
if (pktq->qlen == 1 || !sdiodev->sg_support)
|
||||||
skb_queue_walk(pktq, skb) {
|
skb_queue_walk(pktq, skb) {
|
||||||
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, skb);
|
err = brcmf_sdiod_buffrw(sdiodev, fn, true, addr, skb);
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = brcmf_sdio_sglist_rw(sdiodev, fn, true, addr, pktq);
|
err = brcmf_sdiod_sglist_rw(sdiodev, fn, true, addr, pktq);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
u8 *data, uint size)
|
u8 *data, uint size)
|
||||||
{
|
{
|
||||||
int bcmerror = 0;
|
int bcmerror = 0;
|
||||||
struct sk_buff *pkt;
|
struct sk_buff *pkt;
|
||||||
|
@ -844,7 +844,7 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
/* Do the transfer(s) */
|
/* Do the transfer(s) */
|
||||||
while (size) {
|
while (size) {
|
||||||
/* Set the backplane window to include the start address */
|
/* Set the backplane window to include the start address */
|
||||||
bcmerror = brcmf_sdcard_set_sbaddr_window(sdiodev, address);
|
bcmerror = brcmf_sdiod_set_sbaddr_window(sdiodev, address);
|
||||||
if (bcmerror)
|
if (bcmerror)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -858,8 +858,8 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
skb_put(pkt, dsize);
|
skb_put(pkt, dsize);
|
||||||
if (write)
|
if (write)
|
||||||
memcpy(pkt->data, data, dsize);
|
memcpy(pkt->data, data, dsize);
|
||||||
bcmerror = brcmf_sdio_buffrw(sdiodev, SDIO_FUNC_1, write,
|
bcmerror = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_1, write,
|
||||||
sdaddr, pkt);
|
sdaddr, pkt);
|
||||||
if (bcmerror) {
|
if (bcmerror) {
|
||||||
brcmf_err("membytes transfer failed\n");
|
brcmf_err("membytes transfer failed\n");
|
||||||
break;
|
break;
|
||||||
|
@ -881,7 +881,7 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
dev_kfree_skb(pkt);
|
dev_kfree_skb(pkt);
|
||||||
|
|
||||||
/* Return the window to backplane enumeration space for core access */
|
/* Return the window to backplane enumeration space for core access */
|
||||||
if (brcmf_sdcard_set_sbaddr_window(sdiodev, sdiodev->sbwad))
|
if (brcmf_sdiod_set_sbaddr_window(sdiodev, sdiodev->sbwad))
|
||||||
brcmf_err("FAILED to set window back to 0x%x\n",
|
brcmf_err("FAILED to set window back to 0x%x\n",
|
||||||
sdiodev->sbwad);
|
sdiodev->sbwad);
|
||||||
|
|
||||||
|
@ -890,41 +890,64 @@ brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
return bcmerror;
|
return bcmerror;
|
||||||
}
|
}
|
||||||
|
|
||||||
int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
|
int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
|
||||||
{
|
{
|
||||||
char t_func = (char)fn;
|
char t_func = (char)fn;
|
||||||
brcmf_dbg(SDIO, "Enter\n");
|
brcmf_dbg(SDIO, "Enter\n");
|
||||||
|
|
||||||
/* issue abort cmd52 command through F0 */
|
/* issue abort cmd52 command through F0 */
|
||||||
brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0,
|
brcmf_sdiod_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0,
|
||||||
SDIO_CCCR_ABORT, &t_func);
|
SDIO_CCCR_ABORT, &t_func);
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "Exit\n");
|
brcmf_dbg(SDIO, "Exit\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
|
static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
|
||||||
{
|
{
|
||||||
int err_ret = 0;
|
sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
||||||
struct mmc_host *host;
|
|
||||||
struct sdio_func *func;
|
|
||||||
uint max_blocks;
|
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "\n");
|
if (sdiodev->bus) {
|
||||||
|
brcmf_sdbrcm_disconnect(sdiodev->bus);
|
||||||
|
sdiodev->bus = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable Function 2 */
|
||||||
|
sdio_claim_host(sdiodev->func[2]);
|
||||||
|
sdio_disable_func(sdiodev->func[2]);
|
||||||
|
sdio_release_host(sdiodev->func[2]);
|
||||||
|
|
||||||
|
/* Disable Function 1 */
|
||||||
|
sdio_claim_host(sdiodev->func[1]);
|
||||||
|
sdio_disable_func(sdiodev->func[1]);
|
||||||
|
sdio_release_host(sdiodev->func[1]);
|
||||||
|
|
||||||
|
sdiodev->sbwad = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
|
||||||
|
{
|
||||||
|
struct sdio_func *func;
|
||||||
|
struct mmc_host *host;
|
||||||
|
uint max_blocks;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
sdiodev->num_funcs = 2;
|
sdiodev->num_funcs = 2;
|
||||||
|
|
||||||
sdio_claim_host(sdiodev->func[1]);
|
sdio_claim_host(sdiodev->func[1]);
|
||||||
|
|
||||||
err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE);
|
ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE);
|
||||||
if (err_ret) {
|
if (ret) {
|
||||||
brcmf_err("Failed to set F1 blocksize\n");
|
brcmf_err("Failed to set F1 blocksize\n");
|
||||||
|
sdio_release_host(sdiodev->func[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE);
|
||||||
err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE);
|
if (ret) {
|
||||||
if (err_ret) {
|
|
||||||
brcmf_err("Failed to set F2 blocksize\n");
|
brcmf_err("Failed to set F2 blocksize\n");
|
||||||
|
sdio_release_host(sdiodev->func[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,14 +955,15 @@ static int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
|
||||||
sdiodev->func[2]->enable_timeout = SDIO_WAIT_F2RDY;
|
sdiodev->func[2]->enable_timeout = SDIO_WAIT_F2RDY;
|
||||||
|
|
||||||
/* Enable Function 1 */
|
/* Enable Function 1 */
|
||||||
err_ret = sdio_enable_func(sdiodev->func[1]);
|
ret = sdio_enable_func(sdiodev->func[1]);
|
||||||
if (err_ret) {
|
sdio_release_host(sdiodev->func[1]);
|
||||||
brcmf_err("Failed to enable F1 Err: 0x%08x\n", err_ret);
|
if (ret) {
|
||||||
|
brcmf_err("Failed to enable F1: err=%d\n", ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* determine host related variables after brcmf_sdio_probe()
|
* determine host related variables after brcmf_sdiod_probe()
|
||||||
* as func->cur_blksize is properly set and F2 init has been
|
* as func->cur_blksize is properly set and F2 init has been
|
||||||
* completed successfully.
|
* completed successfully.
|
||||||
*/
|
*/
|
||||||
|
@ -952,63 +976,17 @@ static int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
|
||||||
sdiodev->max_segment_count = min_t(uint, host->max_segs,
|
sdiodev->max_segment_count = min_t(uint, host->max_segs,
|
||||||
SG_MAX_SINGLE_ALLOC);
|
SG_MAX_SINGLE_ALLOC);
|
||||||
sdiodev->max_segment_size = host->max_seg_size;
|
sdiodev->max_segment_size = host->max_seg_size;
|
||||||
out:
|
|
||||||
sdio_release_host(sdiodev->func[1]);
|
|
||||||
brcmf_dbg(SDIO, "Done\n");
|
|
||||||
return err_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)
|
|
||||||
{
|
|
||||||
brcmf_dbg(SDIO, "\n");
|
|
||||||
|
|
||||||
/* Disable Function 2 */
|
|
||||||
sdio_claim_host(sdiodev->func[2]);
|
|
||||||
sdio_disable_func(sdiodev->func[2]);
|
|
||||||
sdio_release_host(sdiodev->func[2]);
|
|
||||||
|
|
||||||
/* Disable Function 1 */
|
|
||||||
sdio_claim_host(sdiodev->func[1]);
|
|
||||||
sdio_disable_func(sdiodev->func[1]);
|
|
||||||
sdio_release_host(sdiodev->func[1]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
|
|
||||||
{
|
|
||||||
sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
|
||||||
|
|
||||||
if (sdiodev->bus) {
|
|
||||||
brcmf_sdbrcm_disconnect(sdiodev->bus);
|
|
||||||
sdiodev->bus = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
brcmf_sdioh_detach(sdiodev);
|
|
||||||
|
|
||||||
sdiodev->sbwad = 0;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = brcmf_sdioh_attach(sdiodev);
|
|
||||||
if (ret)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* try to attach to the target device */
|
/* try to attach to the target device */
|
||||||
sdiodev->bus = brcmf_sdbrcm_probe(sdiodev);
|
sdiodev->bus = brcmf_sdbrcm_probe(sdiodev);
|
||||||
if (!sdiodev->bus) {
|
if (!sdiodev->bus) {
|
||||||
brcmf_err("device attach failed\n");
|
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret)
|
if (ret)
|
||||||
brcmf_sdio_remove(sdiodev);
|
brcmf_sdiod_remove(sdiodev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1075,8 +1053,8 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
|
||||||
init_waitqueue_head(&sdiodev->request_word_wait);
|
init_waitqueue_head(&sdiodev->request_word_wait);
|
||||||
init_waitqueue_head(&sdiodev->request_buffer_wait);
|
init_waitqueue_head(&sdiodev->request_buffer_wait);
|
||||||
|
|
||||||
brcmf_dbg(SDIO, "F2 found, calling brcmf_sdio_probe...\n");
|
brcmf_dbg(SDIO, "F2 found, calling brcmf_sdiod_probe...\n");
|
||||||
err = brcmf_sdio_probe(sdiodev);
|
err = brcmf_sdiod_probe(sdiodev);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("F2 error, probe failed %d...\n", err);
|
brcmf_err("F2 error, probe failed %d...\n", err);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1109,7 +1087,7 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func)
|
||||||
bus_if = dev_get_drvdata(&func->dev);
|
bus_if = dev_get_drvdata(&func->dev);
|
||||||
if (bus_if) {
|
if (bus_if) {
|
||||||
sdiodev = bus_if->bus_priv.sdio;
|
sdiodev = bus_if->bus_priv.sdio;
|
||||||
brcmf_sdio_remove(sdiodev);
|
brcmf_sdiod_remove(sdiodev);
|
||||||
|
|
||||||
dev_set_drvdata(&sdiodev->func[1]->dev, NULL);
|
dev_set_drvdata(&sdiodev->func[1]->dev, NULL);
|
||||||
dev_set_drvdata(&sdiodev->func[2]->dev, NULL);
|
dev_set_drvdata(&sdiodev->func[2]->dev, NULL);
|
||||||
|
@ -1122,7 +1100,7 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int brcmf_sdio_suspend(struct device *dev)
|
static int brcmf_ops_sdio_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
mmc_pm_flag_t sdio_flags;
|
mmc_pm_flag_t sdio_flags;
|
||||||
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
|
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
|
||||||
|
@ -1150,7 +1128,7 @@ static int brcmf_sdio_suspend(struct device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcmf_sdio_resume(struct device *dev)
|
static int brcmf_ops_sdio_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
|
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
|
||||||
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
|
||||||
|
@ -1161,8 +1139,8 @@ static int brcmf_sdio_resume(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dev_pm_ops brcmf_sdio_pm_ops = {
|
static const struct dev_pm_ops brcmf_sdio_pm_ops = {
|
||||||
.suspend = brcmf_sdio_suspend,
|
.suspend = brcmf_ops_sdio_suspend,
|
||||||
.resume = brcmf_sdio_resume,
|
.resume = brcmf_ops_sdio_resume,
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_PM_SLEEP */
|
#endif /* CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
|
|
|
@ -621,8 +621,8 @@ r_sdreg32(struct brcmf_sdio *bus, u32 *regvar, u32 offset)
|
||||||
u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV);
|
u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
*regvar = brcmf_sdio_regrl(bus->sdiodev,
|
*regvar = brcmf_sdiod_regrl(bus->sdiodev,
|
||||||
bus->ci->c_inf[idx].base + offset, &ret);
|
bus->ci->c_inf[idx].base + offset, &ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -633,9 +633,9 @@ w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset)
|
||||||
u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV);
|
u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
brcmf_sdio_regwl(bus->sdiodev,
|
brcmf_sdiod_regwl(bus->sdiodev,
|
||||||
bus->ci->c_inf[idx].base + reg_offset,
|
bus->ci->c_inf[idx].base + reg_offset,
|
||||||
regval, &ret);
|
regval, &ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -651,8 +651,8 @@ brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on)
|
||||||
|
|
||||||
wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
|
wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
|
||||||
/* 1st KSO write goes to AOS wake up core if device is asleep */
|
/* 1st KSO write goes to AOS wake up core if device is asleep */
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
||||||
wr_val, &err);
|
wr_val, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("SDIO_AOS KSO write error: %d\n", err);
|
brcmf_err("SDIO_AOS KSO write error: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -682,15 +682,15 @@ brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on)
|
||||||
* just one write attempt may fail,
|
* just one write attempt may fail,
|
||||||
* read it back until it matches written value
|
* read it back until it matches written value
|
||||||
*/
|
*/
|
||||||
rd_val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
||||||
&err);
|
&err);
|
||||||
if (((rd_val & bmask) == cmp_val) && !err)
|
if (((rd_val & bmask) == cmp_val) && !err)
|
||||||
break;
|
break;
|
||||||
brcmf_dbg(SDIO, "KSO wr/rd retry:%d (max: %d) ERR:%x\n",
|
brcmf_dbg(SDIO, "KSO wr/rd retry:%d (max: %d) ERR:%x\n",
|
||||||
try_cnt, MAX_KSO_ATTEMPTS, err);
|
try_cnt, MAX_KSO_ATTEMPTS, err);
|
||||||
udelay(KSO_WAIT_US);
|
udelay(KSO_WAIT_US);
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
||||||
wr_val, &err);
|
wr_val, &err);
|
||||||
} while (try_cnt++ < MAX_KSO_ATTEMPTS);
|
} while (try_cnt++ < MAX_KSO_ATTEMPTS);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -721,16 +721,16 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
|
||||||
clkreq =
|
clkreq =
|
||||||
bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ;
|
bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ;
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
clkreq, &err);
|
clkreq, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("HT Avail request error: %d\n", err);
|
brcmf_err("HT Avail request error: %d\n", err);
|
||||||
return -EBADE;
|
return -EBADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check current status */
|
/* Check current status */
|
||||||
clkctl = brcmf_sdio_regrb(bus->sdiodev,
|
clkctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("HT Avail read error: %d\n", err);
|
brcmf_err("HT Avail read error: %d\n", err);
|
||||||
return -EBADE;
|
return -EBADE;
|
||||||
|
@ -739,8 +739,8 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
|
||||||
/* Go to pending and await interrupt if appropriate */
|
/* Go to pending and await interrupt if appropriate */
|
||||||
if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
|
if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) {
|
||||||
/* Allow only clock-available interrupt */
|
/* Allow only clock-available interrupt */
|
||||||
devctl = brcmf_sdio_regrb(bus->sdiodev,
|
devctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_DEVICE_CTL, &err);
|
SBSDIO_DEVICE_CTL, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("Devctl error setting CA: %d\n",
|
brcmf_err("Devctl error setting CA: %d\n",
|
||||||
err);
|
err);
|
||||||
|
@ -748,28 +748,28 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
|
||||||
}
|
}
|
||||||
|
|
||||||
devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
|
devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
||||||
devctl, &err);
|
devctl, &err);
|
||||||
brcmf_dbg(SDIO, "CLKCTL: set PENDING\n");
|
brcmf_dbg(SDIO, "CLKCTL: set PENDING\n");
|
||||||
bus->clkstate = CLK_PENDING;
|
bus->clkstate = CLK_PENDING;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (bus->clkstate == CLK_PENDING) {
|
} else if (bus->clkstate == CLK_PENDING) {
|
||||||
/* Cancel CA-only interrupt filter */
|
/* Cancel CA-only interrupt filter */
|
||||||
devctl = brcmf_sdio_regrb(bus->sdiodev,
|
devctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_DEVICE_CTL, &err);
|
SBSDIO_DEVICE_CTL, &err);
|
||||||
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
||||||
devctl, &err);
|
devctl, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, wait here (polling) for HT Avail */
|
/* Otherwise, wait here (polling) for HT Avail */
|
||||||
timeout = jiffies +
|
timeout = jiffies +
|
||||||
msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000);
|
msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000);
|
||||||
while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
|
while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
|
||||||
clkctl = brcmf_sdio_regrb(bus->sdiodev,
|
clkctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR,
|
SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
&err);
|
&err);
|
||||||
if (time_after(jiffies, timeout))
|
if (time_after(jiffies, timeout))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
@ -802,16 +802,16 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
|
||||||
|
|
||||||
if (bus->clkstate == CLK_PENDING) {
|
if (bus->clkstate == CLK_PENDING) {
|
||||||
/* Cancel CA-only interrupt filter */
|
/* Cancel CA-only interrupt filter */
|
||||||
devctl = brcmf_sdio_regrb(bus->sdiodev,
|
devctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_DEVICE_CTL, &err);
|
SBSDIO_DEVICE_CTL, &err);
|
||||||
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
||||||
devctl, &err);
|
devctl, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
bus->clkstate = CLK_SDONLY;
|
bus->clkstate = CLK_SDONLY;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
clkreq, &err);
|
clkreq, &err);
|
||||||
brcmf_dbg(SDIO, "CLKCTL: turned OFF\n");
|
brcmf_dbg(SDIO, "CLKCTL: turned OFF\n");
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("Failed access turning clock off: %d\n",
|
brcmf_err("Failed access turning clock off: %d\n",
|
||||||
|
@ -1037,18 +1037,18 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx)
|
||||||
rtx ? ", send NAK" : "");
|
rtx ? ", send NAK" : "");
|
||||||
|
|
||||||
if (abort)
|
if (abort)
|
||||||
brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
|
brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2);
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
||||||
SFC_RF_TERM, &err);
|
SFC_RF_TERM, &err);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
|
|
||||||
/* Wait until the packet has been flushed (device/FIFO stable) */
|
/* Wait until the packet has been flushed (device/FIFO stable) */
|
||||||
for (lastrbc = retries = 0xffff; retries > 0; retries--) {
|
for (lastrbc = retries = 0xffff; retries > 0; retries--) {
|
||||||
hi = brcmf_sdio_regrb(bus->sdiodev,
|
hi = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_RFRAMEBCHI, &err);
|
SBSDIO_FUNC1_RFRAMEBCHI, &err);
|
||||||
lo = brcmf_sdio_regrb(bus->sdiodev,
|
lo = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_RFRAMEBCLO, &err);
|
SBSDIO_FUNC1_RFRAMEBCLO, &err);
|
||||||
bus->sdcnt.f1regdata += 2;
|
bus->sdcnt.f1regdata += 2;
|
||||||
|
|
||||||
if ((hi == 0) && (lo == 0))
|
if ((hi == 0) && (lo == 0))
|
||||||
|
@ -1418,9 +1418,10 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
|
||||||
* packet and and copy into the chain.
|
* packet and and copy into the chain.
|
||||||
*/
|
*/
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
errcode = brcmf_sdcard_recv_chain(bus->sdiodev,
|
errcode = brcmf_sdiod_recv_chain(bus->sdiodev,
|
||||||
bus->sdiodev->sbwad,
|
bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC, &bus->glom, dlen);
|
SDIO_FUNC_2, F2SYNC,
|
||||||
|
&bus->glom, dlen);
|
||||||
sdio_release_host(bus->sdiodev->func[1]);
|
sdio_release_host(bus->sdiodev->func[1]);
|
||||||
bus->sdcnt.f2rxdata++;
|
bus->sdcnt.f2rxdata++;
|
||||||
|
|
||||||
|
@ -1614,10 +1615,8 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read remain of frame body */
|
/* Read remain of frame body */
|
||||||
sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
|
sdret = brcmf_sdiod_recv_buf(bus->sdiodev, bus->sdiodev->sbwad,
|
||||||
bus->sdiodev->sbwad,
|
SDIO_FUNC_2, F2SYNC, rbuf, rdlen);
|
||||||
SDIO_FUNC_2,
|
|
||||||
F2SYNC, rbuf, rdlen);
|
|
||||||
bus->sdcnt.f2rxdata++;
|
bus->sdcnt.f2rxdata++;
|
||||||
|
|
||||||
/* Control frame failures need retransmission */
|
/* Control frame failures need retransmission */
|
||||||
|
@ -1702,11 +1701,10 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
|
||||||
/* read header first for unknow frame length */
|
/* read header first for unknow frame length */
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
if (!rd->len) {
|
if (!rd->len) {
|
||||||
ret = brcmf_sdcard_recv_buf(bus->sdiodev,
|
ret = brcmf_sdiod_recv_buf(bus->sdiodev,
|
||||||
bus->sdiodev->sbwad,
|
bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC,
|
SDIO_FUNC_2, F2SYNC,
|
||||||
bus->rxhdr,
|
bus->rxhdr, BRCMF_FIRSTREAD);
|
||||||
BRCMF_FIRSTREAD);
|
|
||||||
bus->sdcnt.f2rxhdrs++;
|
bus->sdcnt.f2rxhdrs++;
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
brcmf_err("RXHEADER FAILED: %d\n",
|
brcmf_err("RXHEADER FAILED: %d\n",
|
||||||
|
@ -1762,8 +1760,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
|
||||||
skb_pull(pkt, head_read);
|
skb_pull(pkt, head_read);
|
||||||
pkt_align(pkt, rd->len_left, bus->head_align);
|
pkt_align(pkt, rd->len_left, bus->head_align);
|
||||||
|
|
||||||
ret = brcmf_sdcard_recv_pkt(bus->sdiodev, bus->sdiodev->sbwad,
|
ret = brcmf_sdiod_recv_pkt(bus->sdiodev, bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC, pkt);
|
SDIO_FUNC_2, F2SYNC, pkt);
|
||||||
bus->sdcnt.f2rxdata++;
|
bus->sdcnt.f2rxdata++;
|
||||||
sdio_release_host(bus->sdiodev->func[1]);
|
sdio_release_host(bus->sdiodev->func[1]);
|
||||||
|
|
||||||
|
@ -2118,8 +2116,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
ret = brcmf_sdcard_send_pkt(bus->sdiodev, bus->sdiodev->sbwad,
|
ret = brcmf_sdiod_send_pkt(bus->sdiodev, bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC, pktq);
|
SDIO_FUNC_2, F2SYNC, pktq);
|
||||||
bus->sdcnt.f2txdata++;
|
bus->sdcnt.f2txdata++;
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -2128,17 +2126,17 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq,
|
||||||
ret);
|
ret);
|
||||||
bus->sdcnt.tx_sderrs++;
|
bus->sdcnt.tx_sderrs++;
|
||||||
|
|
||||||
brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
|
brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2);
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
||||||
SFC_WF_TERM, NULL);
|
SFC_WF_TERM, NULL);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
u8 hi, lo;
|
u8 hi, lo;
|
||||||
hi = brcmf_sdio_regrb(bus->sdiodev,
|
hi = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCHI, NULL);
|
SBSDIO_FUNC1_WFRAMEBCHI, NULL);
|
||||||
lo = brcmf_sdio_regrb(bus->sdiodev,
|
lo = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCLO, NULL);
|
SBSDIO_FUNC1_WFRAMEBCLO, NULL);
|
||||||
bus->sdcnt.f1regdata += 2;
|
bus->sdcnt.f1regdata += 2;
|
||||||
if ((hi == 0) && (lo == 0))
|
if ((hi == 0) && (lo == 0))
|
||||||
break;
|
break;
|
||||||
|
@ -2251,11 +2249,11 @@ static void brcmf_sdbrcm_bus_stop(struct device *dev)
|
||||||
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
||||||
|
|
||||||
/* Force clocks on backplane to be sure F2 interrupt propagates */
|
/* Force clocks on backplane to be sure F2 interrupt propagates */
|
||||||
saveclk = brcmf_sdio_regrb(bus->sdiodev,
|
saveclk = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
(saveclk | SBSDIO_FORCE_HT), &err);
|
(saveclk | SBSDIO_FORCE_HT), &err);
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
brcmf_err("Failed to force clock for F2: err %d\n", err);
|
brcmf_err("Failed to force clock for F2: err %d\n", err);
|
||||||
|
@ -2316,7 +2314,7 @@ static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
|
||||||
addr = bus->ci->c_inf[idx].base +
|
addr = bus->ci->c_inf[idx].base +
|
||||||
offsetof(struct sdpcmd_regs, intstatus);
|
offsetof(struct sdpcmd_regs, intstatus);
|
||||||
|
|
||||||
val = brcmf_sdio_regrl(bus->sdiodev, addr, &ret);
|
val = brcmf_sdiod_regrl(bus->sdiodev, addr, &ret);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
val = 0;
|
val = 0;
|
||||||
|
@ -2326,7 +2324,7 @@ static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
/* Clear interrupts */
|
/* Clear interrupts */
|
||||||
if (val) {
|
if (val) {
|
||||||
brcmf_sdio_regwl(bus->sdiodev, addr, val, &ret);
|
brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2359,8 +2357,8 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* Check for inconsistent device control */
|
/* Check for inconsistent device control */
|
||||||
devctl = brcmf_sdio_regrb(bus->sdiodev,
|
devctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_DEVICE_CTL, &err);
|
SBSDIO_DEVICE_CTL, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error reading DEVCTL: %d\n", err);
|
brcmf_err("error reading DEVCTL: %d\n", err);
|
||||||
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
||||||
|
@ -2368,8 +2366,8 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
/* Read CSR, if clock on switch to AVAIL, else ignore */
|
/* Read CSR, if clock on switch to AVAIL, else ignore */
|
||||||
clkctl = brcmf_sdio_regrb(bus->sdiodev,
|
clkctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error reading CSR: %d\n",
|
brcmf_err("error reading CSR: %d\n",
|
||||||
err);
|
err);
|
||||||
|
@ -2380,16 +2378,16 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
|
||||||
devctl, clkctl);
|
devctl, clkctl);
|
||||||
|
|
||||||
if (SBSDIO_HTAV(clkctl)) {
|
if (SBSDIO_HTAV(clkctl)) {
|
||||||
devctl = brcmf_sdio_regrb(bus->sdiodev,
|
devctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_DEVICE_CTL, &err);
|
SBSDIO_DEVICE_CTL, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error reading DEVCTL: %d\n",
|
brcmf_err("error reading DEVCTL: %d\n",
|
||||||
err);
|
err);
|
||||||
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
|
||||||
}
|
}
|
||||||
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL,
|
||||||
devctl, &err);
|
devctl, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing DEVCTL: %d\n",
|
brcmf_err("error writing DEVCTL: %d\n",
|
||||||
err);
|
err);
|
||||||
|
@ -2483,9 +2481,10 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
err = brcmf_sdcard_send_buf(bus->sdiodev, bus->sdiodev->sbwad,
|
err = brcmf_sdiod_send_buf(bus->sdiodev, bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC, bus->ctrl_frame_buf,
|
SDIO_FUNC_2, F2SYNC,
|
||||||
(u32) bus->ctrl_frame_len);
|
bus->ctrl_frame_buf,
|
||||||
|
(u32)bus->ctrl_frame_len);
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
/* On failure, abort the command and
|
/* On failure, abort the command and
|
||||||
|
@ -2494,20 +2493,20 @@ static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
|
||||||
err);
|
err);
|
||||||
bus->sdcnt.tx_sderrs++;
|
bus->sdcnt.tx_sderrs++;
|
||||||
|
|
||||||
brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
|
brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2);
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
||||||
SFC_WF_TERM, &err);
|
SFC_WF_TERM, &err);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
u8 hi, lo;
|
u8 hi, lo;
|
||||||
hi = brcmf_sdio_regrb(bus->sdiodev,
|
hi = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCHI,
|
SBSDIO_FUNC1_WFRAMEBCHI,
|
||||||
&err);
|
&err);
|
||||||
lo = brcmf_sdio_regrb(bus->sdiodev,
|
lo = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCLO,
|
SBSDIO_FUNC1_WFRAMEBCLO,
|
||||||
&err);
|
&err);
|
||||||
bus->sdcnt.f1regdata += 2;
|
bus->sdcnt.f1regdata += 2;
|
||||||
if ((hi == 0) && (lo == 0))
|
if ((hi == 0) && (lo == 0))
|
||||||
break;
|
break;
|
||||||
|
@ -2631,8 +2630,8 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
/* Read console log struct */
|
/* Read console log struct */
|
||||||
addr = bus->console_addr + offsetof(struct rte_console, log_le);
|
addr = bus->console_addr + offsetof(struct rte_console, log_le);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, (u8 *)&c->log_le,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&c->log_le,
|
||||||
sizeof(c->log_le));
|
sizeof(c->log_le));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
@ -2657,7 +2656,7 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
/* Read the console buffer */
|
/* Read the console buffer */
|
||||||
addr = le32_to_cpu(c->log_le.buf);
|
addr = le32_to_cpu(c->log_le.buf);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, c->buf, c->bufsize);
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, c->buf, c->bufsize);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
@ -2701,8 +2700,8 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
bus->ctrl_frame_stat = false;
|
bus->ctrl_frame_stat = false;
|
||||||
ret = brcmf_sdcard_send_buf(bus->sdiodev, bus->sdiodev->sbwad,
|
ret = brcmf_sdiod_send_buf(bus->sdiodev, bus->sdiodev->sbwad,
|
||||||
SDIO_FUNC_2, F2SYNC, frame, len);
|
SDIO_FUNC_2, F2SYNC, frame, len);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* On failure, abort the command and terminate the frame */
|
/* On failure, abort the command and terminate the frame */
|
||||||
|
@ -2710,18 +2709,18 @@ static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
|
||||||
ret);
|
ret);
|
||||||
bus->sdcnt.tx_sderrs++;
|
bus->sdcnt.tx_sderrs++;
|
||||||
|
|
||||||
brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
|
brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2);
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL,
|
||||||
SFC_WF_TERM, NULL);
|
SFC_WF_TERM, NULL);
|
||||||
bus->sdcnt.f1regdata++;
|
bus->sdcnt.f1regdata++;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
u8 hi, lo;
|
u8 hi, lo;
|
||||||
hi = brcmf_sdio_regrb(bus->sdiodev,
|
hi = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCHI, NULL);
|
SBSDIO_FUNC1_WFRAMEBCHI, NULL);
|
||||||
lo = brcmf_sdio_regrb(bus->sdiodev,
|
lo = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_WFRAMEBCLO, NULL);
|
SBSDIO_FUNC1_WFRAMEBCLO, NULL);
|
||||||
bus->sdcnt.f1regdata += 2;
|
bus->sdcnt.f1regdata += 2;
|
||||||
if (hi == 0 && lo == 0)
|
if (hi == 0 && lo == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -2868,7 +2867,7 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
|
||||||
*/
|
*/
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
brcmf_sdbrcm_bus_sleep(bus, false, false);
|
brcmf_sdbrcm_bus_sleep(bus, false, false);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
|
||||||
sdio_release_host(bus->sdiodev->func[1]);
|
sdio_release_host(bus->sdiodev->func[1]);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -2888,8 +2887,8 @@ static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read hndrte_shared structure */
|
/* Read hndrte_shared structure */
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
|
||||||
sizeof(struct sdpcm_shared_le));
|
sizeof(struct sdpcm_shared_le));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
@ -2925,22 +2924,22 @@ static int brcmf_sdio_dump_console(struct brcmf_sdio *bus,
|
||||||
|
|
||||||
/* obtain console information from device memory */
|
/* obtain console information from device memory */
|
||||||
addr = sh->console_addr + offsetof(struct rte_console, log_le);
|
addr = sh->console_addr + offsetof(struct rte_console, log_le);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr,
|
||||||
(u8 *)&sh_val, sizeof(u32));
|
(u8 *)&sh_val, sizeof(u32));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
console_ptr = le32_to_cpu(sh_val);
|
console_ptr = le32_to_cpu(sh_val);
|
||||||
|
|
||||||
addr = sh->console_addr + offsetof(struct rte_console, log_le.buf_size);
|
addr = sh->console_addr + offsetof(struct rte_console, log_le.buf_size);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr,
|
||||||
(u8 *)&sh_val, sizeof(u32));
|
(u8 *)&sh_val, sizeof(u32));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
console_size = le32_to_cpu(sh_val);
|
console_size = le32_to_cpu(sh_val);
|
||||||
|
|
||||||
addr = sh->console_addr + offsetof(struct rte_console, log_le.idx);
|
addr = sh->console_addr + offsetof(struct rte_console, log_le.idx);
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr,
|
||||||
(u8 *)&sh_val, sizeof(u32));
|
(u8 *)&sh_val, sizeof(u32));
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
console_index = le32_to_cpu(sh_val);
|
console_index = le32_to_cpu(sh_val);
|
||||||
|
@ -2954,8 +2953,8 @@ static int brcmf_sdio_dump_console(struct brcmf_sdio *bus,
|
||||||
|
|
||||||
/* obtain the console data from device */
|
/* obtain the console data from device */
|
||||||
conbuf[console_size] = '\0';
|
conbuf[console_size] = '\0';
|
||||||
rv = brcmf_sdio_ramrw(bus->sdiodev, false, console_ptr, (u8 *)conbuf,
|
rv = brcmf_sdiod_ramrw(bus->sdiodev, false, console_ptr, (u8 *)conbuf,
|
||||||
console_size);
|
console_size);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -2992,8 +2991,8 @@ static int brcmf_sdio_trap_info(struct brcmf_sdio *bus, struct sdpcm_shared *sh,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = brcmf_sdio_ramrw(bus->sdiodev, false, sh->trap_addr, (u8 *)&tr,
|
error = brcmf_sdiod_ramrw(bus->sdiodev, false, sh->trap_addr, (u8 *)&tr,
|
||||||
sizeof(struct brcmf_trap_info));
|
sizeof(struct brcmf_trap_info));
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -3036,14 +3035,14 @@ static int brcmf_sdio_assert_info(struct brcmf_sdio *bus,
|
||||||
|
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
if (sh->assert_file_addr != 0) {
|
if (sh->assert_file_addr != 0) {
|
||||||
error = brcmf_sdio_ramrw(bus->sdiodev, false,
|
error = brcmf_sdiod_ramrw(bus->sdiodev, false,
|
||||||
sh->assert_file_addr, (u8 *)file, 80);
|
sh->assert_file_addr, (u8 *)file, 80);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (sh->assert_exp_addr != 0) {
|
if (sh->assert_exp_addr != 0) {
|
||||||
error = brcmf_sdio_ramrw(bus->sdiodev, false,
|
error = brcmf_sdiod_ramrw(bus->sdiodev, false,
|
||||||
sh->assert_exp_addr, (u8 *)expr, 80);
|
sh->assert_exp_addr, (u8 *)expr, 80);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -3248,8 +3247,8 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus)
|
||||||
while (offset < fw->size) {
|
while (offset < fw->size) {
|
||||||
len = ((offset + MEMBLOCK) < fw->size) ? MEMBLOCK :
|
len = ((offset + MEMBLOCK) < fw->size) ? MEMBLOCK :
|
||||||
fw->size - offset;
|
fw->size - offset;
|
||||||
err = brcmf_sdio_ramrw(bus->sdiodev, true, address,
|
err = brcmf_sdiod_ramrw(bus->sdiodev, true, address,
|
||||||
(u8 *)&fw->data[offset], len);
|
(u8 *)&fw->data[offset], len);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error %d on writing %d membytes at 0x%08x\n",
|
brcmf_err("error %d on writing %d membytes at 0x%08x\n",
|
||||||
err, len, address);
|
err, len, address);
|
||||||
|
@ -3399,9 +3398,9 @@ static bool brcmf_sdbrcm_sr_capable(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
/* read PMU chipcontrol register 3*/
|
/* read PMU chipcontrol register 3*/
|
||||||
addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_addr);
|
addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_addr);
|
||||||
brcmf_sdio_regwl(bus->sdiodev, addr, 3, NULL);
|
brcmf_sdiod_regwl(bus->sdiodev, addr, 3, NULL);
|
||||||
addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_data);
|
addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_data);
|
||||||
reg = brcmf_sdio_regrl(bus->sdiodev, addr, NULL);
|
reg = brcmf_sdiod_regrl(bus->sdiodev, addr, NULL);
|
||||||
|
|
||||||
return (bool)reg;
|
return (bool)reg;
|
||||||
}
|
}
|
||||||
|
@ -3413,33 +3412,31 @@ static void brcmf_sdbrcm_sr_init(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
brcmf_dbg(TRACE, "Enter\n");
|
brcmf_dbg(TRACE, "Enter\n");
|
||||||
|
|
||||||
val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL,
|
val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err);
|
||||||
&err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n");
|
brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT;
|
val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT;
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err);
|
||||||
val, &err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n");
|
brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add CMD14 Support */
|
/* Add CMD14 Support */
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP,
|
brcmf_sdiod_regwb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP,
|
||||||
(SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
|
(SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT |
|
||||||
SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT),
|
SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT),
|
||||||
&err);
|
&err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n");
|
brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
SBSDIO_FORCE_HT, &err);
|
SBSDIO_FORCE_HT, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n");
|
brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n");
|
||||||
return;
|
return;
|
||||||
|
@ -3462,8 +3459,7 @@ static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus)
|
||||||
if (bus->ci->c_inf[1].rev < 12)
|
if (bus->ci->c_inf[1].rev < 12)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, &err);
|
||||||
&err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error reading SBSDIO_FUNC1_SLEEPCSR\n");
|
brcmf_err("error reading SBSDIO_FUNC1_SLEEPCSR\n");
|
||||||
return err;
|
return err;
|
||||||
|
@ -3472,8 +3468,8 @@ static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus)
|
||||||
if (!(val & SBSDIO_FUNC1_SLEEPCSR_KSO_MASK)) {
|
if (!(val & SBSDIO_FUNC1_SLEEPCSR_KSO_MASK)) {
|
||||||
val |= (SBSDIO_FUNC1_SLEEPCSR_KSO_EN <<
|
val |= (SBSDIO_FUNC1_SLEEPCSR_KSO_EN <<
|
||||||
SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
|
SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT);
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR,
|
||||||
val, &err);
|
val, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing SBSDIO_FUNC1_SLEEPCSR\n");
|
brcmf_err("error writing SBSDIO_FUNC1_SLEEPCSR\n");
|
||||||
return err;
|
return err;
|
||||||
|
@ -3592,11 +3588,11 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
/* Force clocks on backplane to be sure F2 interrupt propagates */
|
/* Force clocks on backplane to be sure F2 interrupt propagates */
|
||||||
saveclk = brcmf_sdio_regrb(bus->sdiodev,
|
saveclk = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
(saveclk | SBSDIO_FORCE_HT), &err);
|
(saveclk | SBSDIO_FORCE_HT), &err);
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("Failed to force clock for F2: err %d\n", err);
|
brcmf_err("Failed to force clock for F2: err %d\n", err);
|
||||||
|
@ -3618,7 +3614,7 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
|
||||||
w_sdreg32(bus, bus->hostintmask,
|
w_sdreg32(bus, bus->hostintmask,
|
||||||
offsetof(struct sdpcmd_regs, hostintmask));
|
offsetof(struct sdpcmd_regs, hostintmask));
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_WATERMARK, 8, &err);
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_WATERMARK, 8, &err);
|
||||||
} else {
|
} else {
|
||||||
/* Disable F2 again */
|
/* Disable F2 again */
|
||||||
sdio_disable_func(bus->sdiodev->func[SDIO_FUNC_2]);
|
sdio_disable_func(bus->sdiodev->func[SDIO_FUNC_2]);
|
||||||
|
@ -3629,12 +3625,12 @@ static int brcmf_sdbrcm_bus_init(struct device *dev)
|
||||||
brcmf_sdbrcm_sr_init(bus);
|
brcmf_sdbrcm_sr_init(bus);
|
||||||
} else {
|
} else {
|
||||||
/* Restore previous clock setting */
|
/* Restore previous clock setting */
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
saveclk, &err);
|
saveclk, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = brcmf_sdio_intr_register(bus->sdiodev);
|
ret = brcmf_sdiod_intr_register(bus->sdiodev);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
brcmf_err("intr register failed:%d\n", ret);
|
brcmf_err("intr register failed:%d\n", ret);
|
||||||
}
|
}
|
||||||
|
@ -3704,9 +3700,9 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
|
||||||
u8 devpend;
|
u8 devpend;
|
||||||
|
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
devpend = brcmf_sdio_regrb(bus->sdiodev,
|
devpend = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SDIO_CCCR_INTx,
|
SDIO_CCCR_INTx,
|
||||||
NULL);
|
NULL);
|
||||||
sdio_release_host(bus->sdiodev->func[1]);
|
sdio_release_host(bus->sdiodev->func[1]);
|
||||||
intstatus =
|
intstatus =
|
||||||
devpend & (INTR_STATUS_FUNC1 |
|
devpend & (INTR_STATUS_FUNC1 |
|
||||||
|
@ -3814,18 +3810,18 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus)
|
||||||
sdio_claim_host(bus->sdiodev->func[1]);
|
sdio_claim_host(bus->sdiodev->func[1]);
|
||||||
|
|
||||||
pr_debug("F1 signature read @0x18000000=0x%4x\n",
|
pr_debug("F1 signature read @0x18000000=0x%4x\n",
|
||||||
brcmf_sdio_regrl(bus->sdiodev, SI_ENUM_BASE, NULL));
|
brcmf_sdiod_regrl(bus->sdiodev, SI_ENUM_BASE, NULL));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Force PLL off until brcmf_sdio_chip_attach()
|
* Force PLL off until brcmf_sdio_chip_attach()
|
||||||
* programs PLL control regs
|
* programs PLL control regs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR,
|
||||||
BRCMF_INIT_CLKCTL1, &err);
|
BRCMF_INIT_CLKCTL1, &err);
|
||||||
if (!err)
|
if (!err)
|
||||||
clkctl = brcmf_sdio_regrb(bus->sdiodev,
|
clkctl = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
SBSDIO_FUNC1_CHIPCLKCSR, &err);
|
||||||
|
|
||||||
if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
|
if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) {
|
||||||
brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n",
|
brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n",
|
||||||
|
@ -3857,33 +3853,33 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set card control so an SDIO card reset does a WLAN backplane reset */
|
/* Set card control so an SDIO card reset does a WLAN backplane reset */
|
||||||
reg_val = brcmf_sdio_regrb(bus->sdiodev,
|
reg_val = brcmf_sdiod_regrb(bus->sdiodev,
|
||||||
SDIO_CCCR_BRCM_CARDCTRL, &err);
|
SDIO_CCCR_BRCM_CARDCTRL, &err);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET;
|
reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET;
|
||||||
|
|
||||||
brcmf_sdio_regwb(bus->sdiodev,
|
brcmf_sdiod_regwb(bus->sdiodev,
|
||||||
SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
|
SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* set PMUControl so a backplane reset does PMU state reload */
|
/* set PMUControl so a backplane reset does PMU state reload */
|
||||||
reg_addr = CORE_CC_REG(bus->ci->c_inf[0].base,
|
reg_addr = CORE_CC_REG(bus->ci->c_inf[0].base,
|
||||||
pmucontrol);
|
pmucontrol);
|
||||||
reg_val = brcmf_sdio_regrl(bus->sdiodev,
|
reg_val = brcmf_sdiod_regrl(bus->sdiodev,
|
||||||
reg_addr,
|
reg_addr,
|
||||||
&err);
|
&err);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT);
|
reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT);
|
||||||
|
|
||||||
brcmf_sdio_regwl(bus->sdiodev,
|
brcmf_sdiod_regwl(bus->sdiodev,
|
||||||
reg_addr,
|
reg_addr,
|
||||||
reg_val,
|
reg_val,
|
||||||
&err);
|
&err);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -3926,7 +3922,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus)
|
||||||
bus->rxflow = false;
|
bus->rxflow = false;
|
||||||
|
|
||||||
/* Done with backplane-dependent accesses, can drop clock... */
|
/* Done with backplane-dependent accesses, can drop clock... */
|
||||||
brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
|
brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL);
|
||||||
|
|
||||||
sdio_release_host(bus->sdiodev->func[1]);
|
sdio_release_host(bus->sdiodev->func[1]);
|
||||||
|
|
||||||
|
@ -4005,7 +4001,7 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus)
|
||||||
|
|
||||||
if (bus) {
|
if (bus) {
|
||||||
/* De-register interrupt handler */
|
/* De-register interrupt handler */
|
||||||
brcmf_sdio_intr_unregister(bus->sdiodev);
|
brcmf_sdiod_intr_unregister(bus->sdiodev);
|
||||||
|
|
||||||
cancel_work_sync(&bus->datawork);
|
cancel_work_sync(&bus->datawork);
|
||||||
if (bus->brcmf_wq)
|
if (bus->brcmf_wq)
|
||||||
|
|
|
@ -112,9 +112,9 @@ brcmf_sdio_sb_corerev(struct brcmf_sdio_dev *sdiodev,
|
||||||
|
|
||||||
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
|
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbidhigh),
|
CORE_SB(ci->c_inf[idx].base, sbidhigh),
|
||||||
NULL);
|
NULL);
|
||||||
return SBCOREREV(regdata);
|
return SBCOREREV(regdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +140,9 @@ brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev,
|
||||||
if (idx == BRCMF_MAX_CORENUM)
|
if (idx == BRCMF_MAX_CORENUM)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
NULL);
|
NULL);
|
||||||
regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT |
|
regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT |
|
||||||
SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK);
|
SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK);
|
||||||
return (SSB_TMSLOW_CLOCK == regdata);
|
return (SSB_TMSLOW_CLOCK == regdata);
|
||||||
|
@ -160,13 +160,13 @@ brcmf_sdio_ai_iscoreup(struct brcmf_sdio_dev *sdiodev,
|
||||||
if (idx == BRCMF_MAX_CORENUM)
|
if (idx == BRCMF_MAX_CORENUM)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
regdata = brcmf_sdiod_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
NULL);
|
NULL);
|
||||||
ret = (regdata & (BCMA_IOCTL_FGC | BCMA_IOCTL_CLK)) == BCMA_IOCTL_CLK;
|
ret = (regdata & (BCMA_IOCTL_FGC | BCMA_IOCTL_CLK)) == BCMA_IOCTL_CLK;
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
||||||
NULL);
|
NULL);
|
||||||
ret = ret && ((regdata & BCMA_RESET_CTL_RESET) == 0);
|
ret = ret && ((regdata & BCMA_RESET_CTL_RESET) == 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -182,79 +182,79 @@ brcmf_sdio_sb_coredisable(struct brcmf_sdio_dev *sdiodev,
|
||||||
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
|
idx = brcmf_sdio_chip_getinfidx(ci, coreid);
|
||||||
base = ci->c_inf[idx].base;
|
base = ci->c_inf[idx].base;
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL);
|
regdata = brcmf_sdiod_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL);
|
||||||
if (regdata & SSB_TMSLOW_RESET)
|
if (regdata & SSB_TMSLOW_RESET)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL);
|
regdata = brcmf_sdiod_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL);
|
||||||
if ((regdata & SSB_TMSLOW_CLOCK) != 0) {
|
if ((regdata & SSB_TMSLOW_CLOCK) != 0) {
|
||||||
/*
|
/*
|
||||||
* set target reject and spin until busy is clear
|
* set target reject and spin until busy is clear
|
||||||
* (preserve core-specific bits)
|
* (preserve core-specific bits)
|
||||||
*/
|
*/
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow),
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
NULL);
|
CORE_SB(base, sbtmstatelow), NULL);
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
||||||
regdata | SSB_TMSLOW_REJECT, NULL);
|
regdata | SSB_TMSLOW_REJECT, NULL);
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow),
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
NULL);
|
CORE_SB(base, sbtmstatelow), NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
SPINWAIT((brcmf_sdio_regrl(sdiodev,
|
SPINWAIT((brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbtmstatehigh),
|
CORE_SB(base, sbtmstatehigh),
|
||||||
NULL) &
|
NULL) &
|
||||||
SSB_TMSHIGH_BUSY), 100000);
|
SSB_TMSHIGH_BUSY), 100000);
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbtmstatehigh),
|
CORE_SB(base, sbtmstatehigh),
|
||||||
NULL);
|
NULL);
|
||||||
if (regdata & SSB_TMSHIGH_BUSY)
|
if (regdata & SSB_TMSHIGH_BUSY)
|
||||||
brcmf_err("core state still busy\n");
|
brcmf_err("core state still busy\n");
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow),
|
regdata = brcmf_sdiod_regrl(sdiodev, CORE_SB(base, sbidlow),
|
||||||
NULL);
|
NULL);
|
||||||
if (regdata & SSB_IDLOW_INITIATOR) {
|
if (regdata & SSB_IDLOW_INITIATOR) {
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbimstate),
|
CORE_SB(base, sbimstate),
|
||||||
NULL);
|
NULL);
|
||||||
regdata |= SSB_IMSTATE_REJECT;
|
regdata |= SSB_IMSTATE_REJECT;
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbimstate),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(base, sbimstate),
|
||||||
regdata, NULL);
|
regdata, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbimstate),
|
CORE_SB(base, sbimstate),
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
SPINWAIT((brcmf_sdio_regrl(sdiodev,
|
SPINWAIT((brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbimstate),
|
CORE_SB(base, sbimstate),
|
||||||
NULL) &
|
NULL) &
|
||||||
SSB_IMSTATE_BUSY), 100000);
|
SSB_IMSTATE_BUSY), 100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set reset and reject while enabling the clocks */
|
/* set reset and reject while enabling the clocks */
|
||||||
regdata = SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK |
|
regdata = SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK |
|
||||||
SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET;
|
SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET;
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
||||||
regdata, NULL);
|
regdata, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow),
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
NULL);
|
CORE_SB(base, sbtmstatelow), NULL);
|
||||||
udelay(10);
|
udelay(10);
|
||||||
|
|
||||||
/* clear the initiator reject bit */
|
/* clear the initiator reject bit */
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow),
|
regdata = brcmf_sdiod_regrl(sdiodev, CORE_SB(base, sbidlow),
|
||||||
NULL);
|
NULL);
|
||||||
if (regdata & SSB_IDLOW_INITIATOR) {
|
if (regdata & SSB_IDLOW_INITIATOR) {
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(base, sbimstate),
|
CORE_SB(base, sbimstate),
|
||||||
NULL);
|
NULL);
|
||||||
regdata &= ~SSB_IMSTATE_REJECT;
|
regdata &= ~SSB_IMSTATE_REJECT;
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbimstate),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(base, sbimstate),
|
||||||
regdata, NULL);
|
regdata, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* leave reset and reject asserted */
|
/* leave reset and reject asserted */
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(base, sbtmstatelow),
|
||||||
(SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET), NULL);
|
(SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET), NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,9 +270,9 @@ brcmf_sdio_ai_coredisable(struct brcmf_sdio_dev *sdiodev,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* if core is already in reset, just return */
|
/* if core is already in reset, just return */
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
||||||
NULL);
|
NULL);
|
||||||
if ((regdata & BCMA_RESET_CTL_RESET) != 0)
|
if ((regdata & BCMA_RESET_CTL_RESET) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -281,24 +281,24 @@ brcmf_sdio_ai_coredisable(struct brcmf_sdio_dev *sdiodev,
|
||||||
* extra 10ms is taken into account for firmware load stage
|
* extra 10ms is taken into account for firmware load stage
|
||||||
* after 10300us carry on disabling the core anyway
|
* after 10300us carry on disabling the core anyway
|
||||||
*/
|
*/
|
||||||
SPINWAIT(brcmf_sdio_regrl(sdiodev,
|
SPINWAIT(brcmf_sdiod_regrl(sdiodev,
|
||||||
ci->c_inf[idx].wrapbase+BCMA_RESET_ST,
|
|
||||||
NULL), 10300);
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
|
||||||
ci->c_inf[idx].wrapbase+BCMA_RESET_ST,
|
ci->c_inf[idx].wrapbase+BCMA_RESET_ST,
|
||||||
NULL);
|
NULL), 10300);
|
||||||
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
|
ci->c_inf[idx].wrapbase+BCMA_RESET_ST,
|
||||||
|
NULL);
|
||||||
if (regdata)
|
if (regdata)
|
||||||
brcmf_err("disabling core 0x%x with reset status %x\n",
|
brcmf_err("disabling core 0x%x with reset status %x\n",
|
||||||
coreid, regdata);
|
coreid, regdata);
|
||||||
|
|
||||||
brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
brcmf_sdiod_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
||||||
BCMA_RESET_CTL_RESET, NULL);
|
BCMA_RESET_CTL_RESET, NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
brcmf_sdiod_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
core_bits, NULL);
|
core_bits, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
regdata = brcmf_sdiod_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
NULL);
|
NULL);
|
||||||
usleep_range(10, 20);
|
usleep_range(10, 20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -325,47 +325,47 @@ brcmf_sdio_sb_resetcore(struct brcmf_sdio_dev *sdiodev,
|
||||||
* set reset while enabling the clock and
|
* set reset while enabling the clock and
|
||||||
* forcing them on throughout the core
|
* forcing them on throughout the core
|
||||||
*/
|
*/
|
||||||
brcmf_sdio_regwl(sdiodev,
|
brcmf_sdiod_regwl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET,
|
SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET,
|
||||||
NULL);
|
NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
/* clear any serror */
|
/* clear any serror */
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatehigh),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatehigh),
|
||||||
NULL);
|
NULL);
|
||||||
if (regdata & SSB_TMSHIGH_SERR)
|
if (regdata & SSB_TMSHIGH_SERR)
|
||||||
brcmf_sdio_regwl(sdiodev,
|
brcmf_sdiod_regwl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatehigh),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatehigh),
|
||||||
0, NULL);
|
0, NULL);
|
||||||
|
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbimstate),
|
CORE_SB(ci->c_inf[idx].base, sbimstate),
|
||||||
NULL);
|
NULL);
|
||||||
if (regdata & (SSB_IMSTATE_IBE | SSB_IMSTATE_TO))
|
if (regdata & (SSB_IMSTATE_IBE | SSB_IMSTATE_TO))
|
||||||
brcmf_sdio_regwl(sdiodev,
|
brcmf_sdiod_regwl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbimstate),
|
CORE_SB(ci->c_inf[idx].base, sbimstate),
|
||||||
regdata & ~(SSB_IMSTATE_IBE | SSB_IMSTATE_TO),
|
regdata & ~(SSB_IMSTATE_IBE | SSB_IMSTATE_TO),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* clear reset and allow it to propagate throughout the core */
|
/* clear reset and allow it to propagate throughout the core */
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK, NULL);
|
SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
/* leave clock enabled */
|
/* leave clock enabled */
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
brcmf_sdiod_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
SSB_TMSLOW_CLOCK, NULL);
|
SSB_TMSLOW_CLOCK, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
CORE_SB(ci->c_inf[idx].base, sbtmstatelow),
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,21 +384,21 @@ brcmf_sdio_ai_resetcore(struct brcmf_sdio_dev *sdiodev,
|
||||||
brcmf_sdio_ai_coredisable(sdiodev, ci, coreid, core_bits);
|
brcmf_sdio_ai_coredisable(sdiodev, ci, coreid, core_bits);
|
||||||
|
|
||||||
/* now do initialization sequence */
|
/* now do initialization sequence */
|
||||||
brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
brcmf_sdiod_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
core_bits | BCMA_IOCTL_FGC | BCMA_IOCTL_CLK, NULL);
|
core_bits | BCMA_IOCTL_FGC | BCMA_IOCTL_CLK, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
regdata = brcmf_sdiod_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
NULL);
|
NULL);
|
||||||
brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
brcmf_sdiod_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
||||||
0, NULL);
|
0, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
ci->c_inf[idx].wrapbase+BCMA_RESET_CTL,
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
|
|
||||||
brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
brcmf_sdiod_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
core_bits | BCMA_IOCTL_CLK, NULL);
|
core_bits | BCMA_IOCTL_CLK, NULL);
|
||||||
regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
regdata = brcmf_sdiod_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL,
|
||||||
NULL);
|
NULL);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,9 +450,9 @@ static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev,
|
||||||
*/
|
*/
|
||||||
ci->c_inf[0].id = BCMA_CORE_CHIPCOMMON;
|
ci->c_inf[0].id = BCMA_CORE_CHIPCOMMON;
|
||||||
ci->c_inf[0].base = SI_ENUM_BASE;
|
ci->c_inf[0].base = SI_ENUM_BASE;
|
||||||
regdata = brcmf_sdio_regrl(sdiodev,
|
regdata = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_CC_REG(ci->c_inf[0].base, chipid),
|
CORE_CC_REG(ci->c_inf[0].base, chipid),
|
||||||
NULL);
|
NULL);
|
||||||
ci->chip = regdata & CID_ID_MASK;
|
ci->chip = regdata & CID_ID_MASK;
|
||||||
ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT;
|
ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT;
|
||||||
if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 &&
|
if (sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 &&
|
||||||
|
@ -607,7 +607,7 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
|
||||||
|
|
||||||
/* Try forcing SDIO core to do ALPAvail request only */
|
/* Try forcing SDIO core to do ALPAvail request only */
|
||||||
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
|
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ;
|
||||||
brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
|
brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error writing for HT off\n");
|
brcmf_err("error writing for HT off\n");
|
||||||
return err;
|
return err;
|
||||||
|
@ -615,8 +615,8 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
|
||||||
|
|
||||||
/* If register supported, wait for ALPAvail and then force ALP */
|
/* If register supported, wait for ALPAvail and then force ALP */
|
||||||
/* This may take up to 15 milliseconds */
|
/* This may take up to 15 milliseconds */
|
||||||
clkval = brcmf_sdio_regrb(sdiodev,
|
clkval = brcmf_sdiod_regrb(sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, NULL);
|
SBSDIO_FUNC1_CHIPCLKCSR, NULL);
|
||||||
|
|
||||||
if ((clkval & ~SBSDIO_AVBITS) != clkset) {
|
if ((clkval & ~SBSDIO_AVBITS) != clkset) {
|
||||||
brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n",
|
brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n",
|
||||||
|
@ -624,8 +624,8 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPINWAIT(((clkval = brcmf_sdio_regrb(sdiodev,
|
SPINWAIT(((clkval = brcmf_sdiod_regrb(sdiodev,
|
||||||
SBSDIO_FUNC1_CHIPCLKCSR, NULL)),
|
SBSDIO_FUNC1_CHIPCLKCSR, NULL)),
|
||||||
!SBSDIO_ALPAV(clkval)),
|
!SBSDIO_ALPAV(clkval)),
|
||||||
PMU_MAX_TRANSITION_DLY);
|
PMU_MAX_TRANSITION_DLY);
|
||||||
if (!SBSDIO_ALPAV(clkval)) {
|
if (!SBSDIO_ALPAV(clkval)) {
|
||||||
|
@ -635,11 +635,11 @@ brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev)
|
||||||
}
|
}
|
||||||
|
|
||||||
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP;
|
clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP;
|
||||||
brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
|
brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err);
|
||||||
udelay(65);
|
udelay(65);
|
||||||
|
|
||||||
/* Also, disable the extra SDIO pull-ups */
|
/* Also, disable the extra SDIO pull-ups */
|
||||||
brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
|
brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -654,16 +654,16 @@ brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev,
|
||||||
ci->c_inf[0].rev = ci->corerev(sdiodev, ci, ci->c_inf[0].id);
|
ci->c_inf[0].rev = ci->corerev(sdiodev, ci, ci->c_inf[0].id);
|
||||||
|
|
||||||
/* get chipcommon capabilites */
|
/* get chipcommon capabilites */
|
||||||
ci->c_inf[0].caps = brcmf_sdio_regrl(sdiodev,
|
ci->c_inf[0].caps = brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_CC_REG(base, capabilities),
|
CORE_CC_REG(base, capabilities),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* get pmu caps & rev */
|
/* get pmu caps & rev */
|
||||||
if (ci->c_inf[0].caps & CC_CAP_PMU) {
|
if (ci->c_inf[0].caps & CC_CAP_PMU) {
|
||||||
ci->pmucaps =
|
ci->pmucaps =
|
||||||
brcmf_sdio_regrl(sdiodev,
|
brcmf_sdiod_regrl(sdiodev,
|
||||||
CORE_CC_REG(base, pmucapabilities),
|
CORE_CC_REG(base, pmucapabilities),
|
||||||
NULL);
|
NULL);
|
||||||
ci->pmurev = ci->pmucaps & PCAP_REV_MASK;
|
ci->pmurev = ci->pmucaps & PCAP_REV_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,10 +703,10 @@ int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev,
|
||||||
|
|
||||||
brcmf_sdio_chip_buscoresetup(sdiodev, ci);
|
brcmf_sdio_chip_buscoresetup(sdiodev, ci);
|
||||||
|
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopullup),
|
brcmf_sdiod_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopullup),
|
||||||
0, NULL);
|
0, NULL);
|
||||||
brcmf_sdio_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopulldown),
|
brcmf_sdiod_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopulldown),
|
||||||
0, NULL);
|
0, NULL);
|
||||||
|
|
||||||
*ci_ptr = ci;
|
*ci_ptr = ci;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -784,12 +784,12 @@ brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addr = CORE_CC_REG(base, chipcontrol_addr);
|
addr = CORE_CC_REG(base, chipcontrol_addr);
|
||||||
brcmf_sdio_regwl(sdiodev, addr, 1, NULL);
|
brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
|
||||||
cc_data_temp = brcmf_sdio_regrl(sdiodev, addr, NULL);
|
cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
|
||||||
cc_data_temp &= ~str_mask;
|
cc_data_temp &= ~str_mask;
|
||||||
drivestrength_sel <<= str_shift;
|
drivestrength_sel <<= str_shift;
|
||||||
cc_data_temp |= drivestrength_sel;
|
cc_data_temp |= drivestrength_sel;
|
||||||
brcmf_sdio_regwl(sdiodev, addr, cc_data_temp, NULL);
|
brcmf_sdiod_regwl(sdiodev, addr, cc_data_temp, NULL);
|
||||||
|
|
||||||
brcmf_dbg(INFO, "SDIO: %d mA (req=%d mA) drive strength selected, set to 0x%08x\n",
|
brcmf_dbg(INFO, "SDIO: %d mA (req=%d mA) drive strength selected, set to 0x%08x\n",
|
||||||
str_tab[i].strength, drivestrength, cc_data_temp);
|
str_tab[i].strength, drivestrength, cc_data_temp);
|
||||||
|
@ -816,8 +816,8 @@ brcmf_sdio_chip_verifynvram(struct brcmf_sdio_dev *sdiodev, u32 nvram_addr,
|
||||||
memset(nvram_ularray, 0xaa, nvram_sz);
|
memset(nvram_ularray, 0xaa, nvram_sz);
|
||||||
|
|
||||||
/* Read the vars list to temp buffer for comparison */
|
/* Read the vars list to temp buffer for comparison */
|
||||||
err = brcmf_sdio_ramrw(sdiodev, false, nvram_addr, nvram_ularray,
|
err = brcmf_sdiod_ramrw(sdiodev, false, nvram_addr, nvram_ularray,
|
||||||
nvram_sz);
|
nvram_sz);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error %d on reading %d nvram bytes at 0x%08x\n",
|
brcmf_err("error %d on reading %d nvram bytes at 0x%08x\n",
|
||||||
err, nvram_sz, nvram_addr);
|
err, nvram_sz, nvram_addr);
|
||||||
|
@ -850,7 +850,7 @@ static bool brcmf_sdio_chip_writenvram(struct brcmf_sdio_dev *sdiodev,
|
||||||
nvram_addr = (ci->ramsize - 4) - nvram_sz + ci->rambase;
|
nvram_addr = (ci->ramsize - 4) - nvram_sz + ci->rambase;
|
||||||
|
|
||||||
/* Write the vars list */
|
/* Write the vars list */
|
||||||
err = brcmf_sdio_ramrw(sdiodev, true, nvram_addr, nvram_dat, nvram_sz);
|
err = brcmf_sdiod_ramrw(sdiodev, true, nvram_addr, nvram_dat, nvram_sz);
|
||||||
if (err) {
|
if (err) {
|
||||||
brcmf_err("error %d on writing %d nvram bytes at 0x%08x\n",
|
brcmf_err("error %d on writing %d nvram bytes at 0x%08x\n",
|
||||||
err, nvram_sz, nvram_addr);
|
err, nvram_sz, nvram_addr);
|
||||||
|
@ -874,8 +874,8 @@ static bool brcmf_sdio_chip_writenvram(struct brcmf_sdio_dev *sdiodev,
|
||||||
nvram_addr, nvram_sz, token);
|
nvram_addr, nvram_sz, token);
|
||||||
|
|
||||||
/* Write the length token to the last word */
|
/* Write the length token to the last word */
|
||||||
if (brcmf_sdio_ramrw(sdiodev, true, (ci->ramsize - 4 + ci->rambase),
|
if (brcmf_sdiod_ramrw(sdiodev, true, (ci->ramsize - 4 + ci->rambase),
|
||||||
(u8 *)&token_le, 4))
|
(u8 *)&token_le, 4))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -891,7 +891,7 @@ brcmf_sdio_chip_cm3_enterdl(struct brcmf_sdio_dev *sdiodev,
|
||||||
ci->resetcore(sdiodev, ci, BCMA_CORE_INTERNAL_MEM, 0);
|
ci->resetcore(sdiodev, ci, BCMA_CORE_INTERNAL_MEM, 0);
|
||||||
|
|
||||||
/* clear length token */
|
/* clear length token */
|
||||||
brcmf_sdio_ramrw(sdiodev, true, ci->ramsize - 4, (u8 *)&zeros, 4);
|
brcmf_sdiod_ramrw(sdiodev, true, ci->ramsize - 4, (u8 *)&zeros, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -913,7 +913,7 @@ brcmf_sdio_chip_cm3_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci,
|
||||||
core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV);
|
core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV);
|
||||||
reg_addr = ci->c_inf[core_idx].base;
|
reg_addr = ci->c_inf[core_idx].base;
|
||||||
reg_addr += offsetof(struct sdpcmd_regs, intstatus);
|
reg_addr += offsetof(struct sdpcmd_regs, intstatus);
|
||||||
brcmf_sdio_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL);
|
brcmf_sdiod_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL);
|
||||||
|
|
||||||
ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CM3, 0);
|
ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CM3, 0);
|
||||||
|
|
||||||
|
@ -942,11 +942,11 @@ brcmf_sdio_chip_cr4_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci,
|
||||||
core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV);
|
core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV);
|
||||||
reg_addr = ci->c_inf[core_idx].base;
|
reg_addr = ci->c_inf[core_idx].base;
|
||||||
reg_addr += offsetof(struct sdpcmd_regs, intstatus);
|
reg_addr += offsetof(struct sdpcmd_regs, intstatus);
|
||||||
brcmf_sdio_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL);
|
brcmf_sdiod_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL);
|
||||||
|
|
||||||
/* Write reset vector to address 0 */
|
/* Write reset vector to address 0 */
|
||||||
brcmf_sdio_ramrw(sdiodev, true, 0, (void *)&ci->rst_vec,
|
brcmf_sdiod_ramrw(sdiodev, true, 0, (void *)&ci->rst_vec,
|
||||||
sizeof(ci->rst_vec));
|
sizeof(ci->rst_vec));
|
||||||
|
|
||||||
/* restore ARM */
|
/* restore ARM */
|
||||||
ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CR4, 0);
|
ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CR4, 0);
|
||||||
|
|
|
@ -184,16 +184,16 @@ struct brcmf_sdio_dev {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Register/deregister interrupt handler. */
|
/* Register/deregister interrupt handler. */
|
||||||
int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev);
|
int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev);
|
||||||
int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev);
|
int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev);
|
||||||
|
|
||||||
/* sdio device register access interface */
|
/* sdio device register access interface */
|
||||||
u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);
|
u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);
|
||||||
u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);
|
u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret);
|
||||||
void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, u8 data,
|
void brcmf_sdiod_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, u8 data,
|
||||||
int *ret);
|
int *ret);
|
||||||
void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
|
void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
|
||||||
int *ret);
|
int *ret);
|
||||||
|
|
||||||
/* Buffer transfer to/from device (client) core via cmd53.
|
/* Buffer transfer to/from device (client) core via cmd53.
|
||||||
* fn: function number
|
* fn: function number
|
||||||
|
@ -207,17 +207,17 @@ void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data,
|
||||||
* Returns 0 or error code.
|
* Returns 0 or error code.
|
||||||
* NOTE: Async operation is not currently supported.
|
* NOTE: Async operation is not currently supported.
|
||||||
*/
|
*/
|
||||||
int brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff_head *pktq);
|
uint flags, struct sk_buff_head *pktq);
|
||||||
int brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, u8 *buf, uint nbytes);
|
uint flags, u8 *buf, uint nbytes);
|
||||||
|
|
||||||
int brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff *pkt);
|
uint flags, struct sk_buff *pkt);
|
||||||
int brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, u8 *buf, uint nbytes);
|
uint flags, u8 *buf, uint nbytes);
|
||||||
int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
uint flags, struct sk_buff_head *pktq, uint totlen);
|
uint flags, struct sk_buff_head *pktq, uint totlen);
|
||||||
|
|
||||||
/* Flags bits */
|
/* Flags bits */
|
||||||
|
|
||||||
|
@ -233,11 +233,11 @@ int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
|
||||||
* nbytes: number of bytes to transfer to/from buf
|
* nbytes: number of bytes to transfer to/from buf
|
||||||
* Returns 0 or error code.
|
* Returns 0 or error code.
|
||||||
*/
|
*/
|
||||||
int brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
int brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address,
|
||||||
u8 *data, uint size);
|
u8 *data, uint size);
|
||||||
|
|
||||||
/* Issue an abort to the specified function */
|
/* Issue an abort to the specified function */
|
||||||
int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
|
int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
|
||||||
|
|
||||||
struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev);
|
struct brcmf_sdio *brcmf_sdbrcm_probe(struct brcmf_sdio_dev *sdiodev);
|
||||||
void brcmf_sdbrcm_disconnect(struct brcmf_sdio *bus);
|
void brcmf_sdbrcm_disconnect(struct brcmf_sdio *bus);
|
||||||
|
|
Loading…
Reference in New Issue