Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73e12b34 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "slimbus: Add snapshot of slimbus driver"

parents 96fb63ca 375c1eca
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -99,6 +99,12 @@ config OF_RESERVED_MEM_CHECK
config OF_RESOLVE
	bool

config OF_SLIMBUS
	def_tristate SLIMBUS
	depends on SLIMBUS
	help
	  OpenFirmware SLIMBUS accessors

config OF_OVERLAY
	bool "Device Tree overlays"
	select OF_DYNAMIC
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ obj-$(CONFIG_OF_UNITTEST) += unittest.o
obj-$(CONFIG_OF_MDIO)	+= of_mdio.o
obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
obj-$(CONFIG_OF_RESOLVE)  += resolver.o
obj-$(CONFIG_OF_SLIMBUS) += of_slimbus.o
obj-$(CONFIG_OF_OVERLAY) += overlay.o
obj-$(CONFIG_OF_NUMA) += of_numa.o

+85 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 */

/* OF helpers for SLIMbus */
#include <linux/slimbus/slimbus.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_slimbus.h>

int of_register_slim_devices(struct slim_controller *ctrl)
{
	struct device_node *node;
	struct slim_boardinfo *binfo = NULL;
	struct slim_boardinfo *temp;
	int n = 0;
	int ret = 0;

	if (!ctrl->dev.of_node)
		return -EINVAL;

	for_each_available_child_of_node(ctrl->dev.of_node, node) {
		struct property *prop;
		struct slim_device *slim;
		char *name;

		prop = of_find_property(node, "elemental-addr", NULL);
		if (!prop || prop->length != 6) {
			dev_err(&ctrl->dev, "of_slim: invalid E-addr\n");
			continue;
		}
		name = kzalloc(SLIMBUS_NAME_SIZE, GFP_KERNEL);
		if (!name) {
			ret = -ENOMEM;
			of_node_put(node);
			goto of_slim_err;
		}
		if (of_modalias_node(node, name, SLIMBUS_NAME_SIZE) < 0) {
			dev_err(&ctrl->dev, "of_slim: modalias failure on %s\n",
				node->full_name);
			kfree(name);
			continue;
		}
		slim = kzalloc(sizeof(struct slim_device), GFP_KERNEL);
		if (!slim) {
			ret = -ENOMEM;
			kfree(name);
			of_node_put(node);
			goto of_slim_err;
		}
		memcpy(slim->e_addr, prop->value, 6);

		temp = krealloc(binfo, (n + 1) * sizeof(struct slim_boardinfo),
					GFP_KERNEL);
		if (!temp) {
			kfree(name);
			kfree(slim);
			ret = -ENOMEM;
			of_node_put(node);
			goto of_slim_err;
		}
		binfo = temp;

		slim->dev.of_node = of_node_get(node);
		slim->name = (const char *)name;
		binfo[n].bus_num = ctrl->nr;
		binfo[n].slim_slave = slim;
		n++;
	}
	ret = slim_register_board_info(binfo, n);
	if (!ret)
		goto of_slim_ret;
of_slim_err:
	while (n-- > 0) {
		kfree(binfo[n].slim_slave->name);
		kfree(binfo[n].slim_slave);
	}
of_slim_ret:
	kfree(binfo);
	return ret;
}
EXPORT_SYMBOL(of_register_slim_devices);
+23 −5
Original line number Diff line number Diff line
@@ -3,12 +3,12 @@
# SLIMbus driver configuration
#
menuconfig SLIMBUS
	tristate "SLIMbus support"
	bool "SLIMbus support"
	depends on HAS_IOMEM
	help
	  SLIMbus is standard interface between System-on-Chip and audio codec,
	  and other peripheral components in typical embedded systems.

	  If unsure, choose N.
	  Slimbus is standard interface between baseband and
	  application processors and peripheral components in mobile
	  terminals.

if SLIMBUS

@@ -32,4 +32,22 @@ config SLIM_QCOM_NGD_CTRL
	  communicating with slave HW directly over the bus using messaging
	  interface, and communicating with master component residing on ADSP
	  for bandwidth and data-channel management.

config SLIMBUS_MSM_CTRL
	tristate "QTI SLIMbus Master Component"
	help
	  Select driver for Qualcomm Technologies, Inc. (QTI) Slimbus
	  Master Component. This driver is responsible for configuring
	  SLIMbus and performing bus administration, administration of
	  components on the bus and dynamic channel allocation.

config SLIMBUS_MSM_NGD
	tristate "QTI Slimbus Satellite Component"
	help
	  Select driver for Qualcomm Technologies, Inc. (QTI) Slimbus
	  Satellite Component. This is light-weight slimbus controller
	  driver responsible for communicating with slave HW directly over
	  the bus using messaging interface, and communicating with master
	  component residing on ADSP for bandwidth and data-channel
	  management.
endif
+4 −8
Original line number Diff line number Diff line
@@ -3,11 +3,7 @@
# Makefile for kernel SLIMbus framework.
#
obj-$(CONFIG_SLIMBUS)			+= slimbus.o
slimbus-y				:= core.o messaging.o sched.o stream.o

#Controllers
obj-$(CONFIG_SLIM_QCOM_CTRL)		+= slim-qcom-ctrl.o
slim-qcom-ctrl-y			:= qcom-ctrl.o

obj-$(CONFIG_SLIM_QCOM_NGD_CTRL)	+= slim-qcom-ngd-ctrl.o
slim-qcom-ngd-ctrl-y			:= qcom-ngd-ctrl.o
obj-$(CONFIG_SLIMBUS_MSM_CTRL)		+= slim-msm.o
slim-msm-y				:= slim-msm-ctrl.o
obj-$(CONFIG_SLIMBUS_MSM_NGD)		+= slim-msm.o
slim-msm-y				:= slim-msm-ngd.o
Loading