Unverified Commit bbd5669c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!792 LoongArch: add ls2k500 bmc support

Merge Pull Request from: @Hongchen_Zhang 
 
Add ls2k500 bmc support:
- add ls2k500sfb driver for ls2k500 bmc
- add ls2k500 bmc ipmi support
- enable CONFIG_FB_LS2K500 by default 
 
Link:https://gitee.com/openeuler/kernel/pulls/792

 

Reviewed-by: default avatarGuo Dongtai <guodongtai@kylinos.cn>
Reviewed-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents c5fa8d99 0c4e4596
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -867,6 +867,7 @@ CONFIG_DRM_QXL=m
CONFIG_DRM_VIRTIO_GPU=m
CONFIG_FB_EFI=y
CONFIG_FB_RADEON=y
CONFIG_FB_LS2K500=m
# CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ ifdef CONFIG_PARISC
ipmi_si-y += ipmi_si_parisc.o
endif

ifdef CONFIG_LOONGARCH
ipmi_si-y += ipmi_si_ls2k500.o
endif

obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
obj-$(CONFIG_IPMI_SI) += ipmi_si.o
+88 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __BTLOCK_H__
#define __BTLOCK_H__

#include <linux/delay.h>
#include <asm/timex.h>

union btlock {
	char b[2];
	unsigned int u;
};

/*
 *wait delay us if lock failed.
 *lock fail if another one get lock or both try get lock.
 *c must compile b with byte access.
 */
static inline int btlock_lock(volatile union btlock *p, int n, unsigned char delay)
{
	union btlock t, t1;
	unsigned long flags;

	if (n > 1)
		return -1;
	delay |= 0x80;
	t1.u = 0;
	t1.b[n] = delay;

	while (1) {
		local_irq_save(flags);
		p->b[n] = delay;
		t.u = p->u;
		if (t.u == t1.u) {
			wmb(); /* flush write out immediately */
			local_irq_restore(flags);
			return 0;
		}
		p->b[n] = 0;
		t.u = p->u;
		wmb(); /* flush write out immediately */
		local_irq_restore(flags);
		ndelay(((t.b[1 - n] & 0x7f) + (get_cycles() & 1)) * 100);
	}
	return 0;
}

static inline int btlock_trylock(volatile union btlock *p, int n, unsigned char delay)
{
	union btlock t, t1;
	unsigned long flags;

	if (n > 1)
		return -1;
	delay |= 0x80;
	t1.u = 0;
	t1.b[n] = delay;

	local_irq_save(flags);
	p->b[n] = delay;
	t.u = p->u;
	if (t.u == t1.u) {
		wmb(); /* flush write out immediately */
		local_irq_restore(flags);
		return 0;
	}
	p->b[n] = 0;
	t.u = p->u;
	wmb(); /* flush write out immediately */
	local_irq_restore(flags);
	ndelay(((t.b[1 - n] & 0x7f) + (get_cycles() & 1)) * 100);
	return -1;
}

static inline int btlock_unlock(volatile union btlock *p, int n)
{
		p->b[n] = 0;
		wmb(); /* flush write out immediately */
		return p->u;
}

static inline int btlock_islocked(volatile union btlock *p, int n)
{
	union btlock t;

	t.u = p->u;
	return t.b[n] && !t.b[1 - n];
}
#endif
+8 −0
Original line number Diff line number Diff line
@@ -99,6 +99,14 @@ static inline void ipmi_si_parisc_init(void) { }
static inline void ipmi_si_parisc_shutdown(void) { }
#endif

#ifdef CONFIG_LOONGARCH
int ipmi_si_ls2k500_init(void);
void ipmi_si_ls2k500_shutdown(void);
#else
static inline void ipmi_si_ls2k500_init(void) { }
static inline void ipmi_si_ls2k500_shutdown(void) { }
#endif

int ipmi_si_port_setup(struct si_sm_io *io);
int ipmi_si_mem_setup(struct si_sm_io *io);

+4 −0
Original line number Diff line number Diff line
@@ -2106,6 +2106,8 @@ static int __init init_ipmi_si(void)

	ipmi_si_platform_init();

	ipmi_si_ls2k500_init();

	ipmi_si_pci_init();

	ipmi_si_parisc_init();
@@ -2291,6 +2293,8 @@ static void cleanup_ipmi_si(void)

	ipmi_si_parisc_shutdown();

	ipmi_si_ls2k500_shutdown();

	ipmi_si_platform_shutdown();

	mutex_lock(&smi_infos_lock);
Loading