lc823450 smp improvement
* arch/arm/src/common: Apply irq_spin APIs to modifyregXX
Replace enter_critical_section with spin_lock_irqsave.
Replace leave_critical_section with spin_unlock_irqrestore.
Please see 6150299f54
as well.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* arch/arm/src/lc823450: Do not use modifyreg32() to enable Mutex.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* arch/arm/src/lc823450: Modify IRQ control for i2s
Interrupt will be handled on CPU0 with this change.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* arch/arm/src/lc823450: Apply irq_spin APIs to dma/syscontrol/usbdev.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* configs/lc823450-xgevk: Assign CPU1 to lpwork
This change will improve load balancing for networking with RNDIS.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* drivers/audio/wm8776.c: Improve stability in SMP mode
Apply irq_spin APIs to improbe performance.
Repeat to process a message to avoid deadlock.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* configs/lc823450-xgevk: Enable SPINLOCK_IRQ and NXPLAYER in rndis
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
201 lines
5.9 KiB
C
201 lines
5.9 KiB
C
/****************************************************************************
|
|
* arch/arm/src/lc823450/lc823450_syscontrol.c
|
|
*
|
|
* Copyright (C) 2014-2017 Sony Corporation. All rights reserved.
|
|
* Author: Masatoshi Tateishi <Masatoshi.Tateishi@jp.sony.com>
|
|
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
|
* Author: Nobutaka Toyoshima <Nobutaka.Toyoshima@jp.sony.com>
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
* used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
#include <nuttx/irq.h>
|
|
#include <nuttx/arch.h>
|
|
#include <stdint.h>
|
|
#include <debug.h>
|
|
|
|
#include <arch/board/board.h>
|
|
|
|
#include "chip.h"
|
|
#include "up_arch.h"
|
|
#include "up_internal.h"
|
|
|
|
#include "lc823450_gpio.h"
|
|
#include "lc823450_syscontrol.h"
|
|
#include <arch/chip/clk.h>
|
|
|
|
/****************************************************************************
|
|
* Private Data
|
|
****************************************************************************/
|
|
|
|
static struct clk_st lc823450_clocks[] = LC823450_CLOCKS;
|
|
|
|
/****************************************************************************
|
|
* Public Data
|
|
****************************************************************************/
|
|
|
|
uint8_t cpu_ver;
|
|
|
|
/****************************************************************************
|
|
* Public Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: get_cpu_ver
|
|
****************************************************************************/
|
|
|
|
uint32_t get_cpu_ver(void)
|
|
{
|
|
uint32_t ret = 0;
|
|
uint32_t reg = getreg32(MODEM) & MODEM_MAV_MASK;
|
|
|
|
switch (reg)
|
|
{
|
|
case MODEM_MAV_ES1:
|
|
sinfo("ES1 \n");
|
|
break;
|
|
|
|
case MODEM_MAV_ES2:
|
|
sinfo("ES2 \n");
|
|
ret = 1;
|
|
break;
|
|
|
|
default:
|
|
sinfo("??? \n");
|
|
break;
|
|
}
|
|
cpu_ver = ret;
|
|
return ret;
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Name: mod_stby_regs
|
|
*
|
|
* Input parameters:
|
|
* enabits : specify regions to be enabled
|
|
* disbits : specify regions to be disabled
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifdef CONFIG_LC823450_LSISTBY
|
|
void mod_stby_regs(uint32_t enabits, uint32_t disbits)
|
|
{
|
|
/* TODO : need to lock */
|
|
|
|
/* isolate first if needed */
|
|
|
|
modifyreg32(ISOCNT, disbits, 0);
|
|
|
|
/* then modify LSTSTBY register */
|
|
|
|
modifyreg32(LSISTBY, enabits, disbits);
|
|
|
|
if (enabits)
|
|
{
|
|
/* stand-by to active case */
|
|
/* assumption: the specified blocks are already isolated */
|
|
|
|
up_udelay(100); /* need to wait 100us */
|
|
|
|
/* then disable isolation for the region */
|
|
|
|
modifyreg32(ISOCNT, 0, enabits);
|
|
}
|
|
|
|
/* sinfo("ISOCNT=0x%x, LSISTBY=0x%x \n", getreg32(ISOCNT), getreg32(LSISTBY)); */
|
|
}
|
|
#endif /* CONFIG_LC823450_LSISTBY */
|
|
|
|
/****************************************************************************
|
|
* Name: up_enable_clk
|
|
****************************************************************************/
|
|
|
|
void up_enable_clk(enum clock_e clk)
|
|
{
|
|
irqstate_t flags;
|
|
flags = spin_lock_irqsave();
|
|
|
|
ASSERT(clk < LC823450_CLOCK_NUM);
|
|
|
|
if (lc823450_clocks[clk].count++ == 0)
|
|
{
|
|
modifyreg32(lc823450_clocks[clk].regaddr,
|
|
0, lc823450_clocks[clk].regmask);
|
|
}
|
|
|
|
spin_unlock_irqrestore(flags);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Name: up_disable_clk
|
|
****************************************************************************/
|
|
|
|
void up_disable_clk(enum clock_e clk)
|
|
{
|
|
irqstate_t flags;
|
|
flags = spin_lock_irqsave();
|
|
|
|
ASSERT(clk < LC823450_CLOCK_NUM);
|
|
|
|
if (--lc823450_clocks[clk].count == 0)
|
|
{
|
|
modifyreg32(lc823450_clocks[clk].regaddr,
|
|
lc823450_clocks[clk].regmask, 0);
|
|
}
|
|
|
|
/* ASSERT(lc823450_clocks[clk].count >= 0); */
|
|
|
|
if (lc823450_clocks[clk].count < 0)
|
|
{
|
|
lc823450_clocks[clk].count = 0;
|
|
}
|
|
|
|
spin_unlock_irqrestore(flags);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Name: lc823450_clock_dump
|
|
****************************************************************************/
|
|
|
|
void lc823450_clock_dump(void)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < LC823450_CLOCK_NUM; i++)
|
|
{
|
|
sinfo("%s:%d\n", lc823450_clocks[i].name,
|
|
lc823450_clocks[i].count);
|
|
}
|
|
}
|