summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi.h73
-rw-r--r--include/common.h5
-rw-r--r--include/console.h5
-rw-r--r--include/driver.h4
-rw-r--r--include/efi.h42
-rw-r--r--include/efi/efi-device.h12
-rw-r--r--include/gpio.h6
-rw-r--r--include/linux/mod_devicetable.h1
-rw-r--r--include/linux/mtd/spi-nor.h2
-rw-r--r--include/linux/pci.h34
-rw-r--r--include/linux/remoteproc.h1
-rw-r--r--include/of.h83
-rw-r--r--include/reset_source.h5
-rw-r--r--include/soc/fsl/fsl_fman.h3
14 files changed, 240 insertions, 36 deletions
diff --git a/include/acpi.h b/include/acpi.h
new file mode 100644
index 0000000000..2d5fd3086a
--- /dev/null
+++ b/include/acpi.h
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 Ahmad Fatoum
+ */
+
+#ifndef __ACPI_H_
+#define __ACPI_H_
+
+#include <linux/types.h>
+#include <driver.h>
+
+typedef char acpi_sig_t[4];
+
+struct __packed acpi_rsdp { /* root system description pointer */
+ char signature[8];
+ u8 checksum;
+ u8 oem_id[6];
+ u8 revision;
+ u32 rsdt_addr;
+};
+
+struct __packed acpi2_rsdp { /* root system description */
+ struct acpi_rsdp acpi1;
+ u32 length;
+ u64 xsdt_addr;
+ u8 extended_checksum;
+ u8 reserved[3];
+};
+
+struct __packed acpi_sdt { /* system description table header */
+ acpi_sig_t signature;
+ u32 len;
+ u8 revision;
+ u8 checksum;
+ char oem_id[6];
+ char oem_table_id[8];
+ u32 oem_revision;
+ u32 creator_id;
+ u32 creator_revision;
+};
+
+struct __packed acpi_rsdt { /* system description table header */
+ struct acpi_sdt sdt;
+ struct acpi_sdt * __aligned(8) entries[];
+};
+
+struct acpi_driver {
+ struct driver_d driver;
+ acpi_sig_t signature;
+};
+
+extern struct bus_type acpi_bus;
+
+static inline struct acpi_driver *to_acpi_driver(struct driver_d *drv)
+{
+ return container_of(drv, struct acpi_driver, driver);
+}
+
+#define device_acpi_driver(drv) \
+ register_driver_macro(device, acpi, drv)
+
+static inline int acpi_driver_register(struct acpi_driver *acpidrv)
+{
+ acpidrv->driver.bus = &acpi_bus;
+ return register_driver(&acpidrv->driver);
+}
+
+static inline int acpi_sigcmp(const acpi_sig_t sig_a, const acpi_sig_t sig_b)
+{
+ return memcmp(sig_a, sig_b, sizeof(acpi_sig_t));
+}
+
+#endif
diff --git a/include/common.h b/include/common.h
index 6563068467..c6eb50420f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -68,7 +68,12 @@ long get_ram_size (volatile long *, long);
/* common/console.c */
int ctrlc(void);
int arch_ctrlc(void);
+
+#ifdef CONFIG_CONSOLE_FULL
void ctrlc_handled(void);
+#else
+static inline void ctrlc_handled(void) { }
+#endif
#ifdef CONFIG_ARCH_HAS_STACK_DUMP
void dump_stack(void);
diff --git a/include/console.h b/include/console.h
index 7afe59e93a..537ac97ab3 100644
--- a/include/console.h
+++ b/include/console.h
@@ -207,7 +207,12 @@ static inline void pbl_set_putc(void (*putcf)(void *ctx, int c), void *ctx) {}
bool console_allow_color(void);
+#ifdef CONFIG_CONSOLE_FULL
void console_ctrlc_allow(void);
void console_ctrlc_forbid(void);
+#else
+static inline void console_ctrlc_allow(void) { }
+static inline void console_ctrlc_forbid(void) { }
+#endif
#endif
diff --git a/include/driver.h b/include/driver.h
index 300603fa32..ad59ce90c3 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -155,12 +155,12 @@ int unregister_device(struct device_d *);
/* Iterate over a devices children
*/
#define device_for_each_child(dev, child) \
- list_for_each_entry(child, &dev->children, sibling)
+ list_for_each_entry(child, &(dev)->children, sibling)
/* Iterate over a devices children - Safe against removal version
*/
#define device_for_each_child_safe(dev, tmpdev, child) \
- list_for_each_entry_safe(child, tmpdev, &dev->children, sibling)
+ list_for_each_entry_safe(child, tmpdev, &(dev)->children, sibling)
/* Iterate through the devices of a given type. if last is NULL, the
* first device of this type is returned. Put this pointer in as
diff --git a/include/efi.h b/include/efi.h
index 166803a58f..43c0593951 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -91,21 +91,23 @@ typedef struct {
*/
/* Memory types: */
-#define EFI_RESERVED_TYPE 0
-#define EFI_LOADER_CODE 1
-#define EFI_LOADER_DATA 2
-#define EFI_BOOT_SERVICES_CODE 3
-#define EFI_BOOT_SERVICES_DATA 4
-#define EFI_RUNTIME_SERVICES_CODE 5
-#define EFI_RUNTIME_SERVICES_DATA 6
-#define EFI_CONVENTIONAL_MEMORY 7
-#define EFI_UNUSABLE_MEMORY 8
-#define EFI_ACPI_RECLAIM_MEMORY 9
-#define EFI_ACPI_MEMORY_NVS 10
-#define EFI_MEMORY_MAPPED_IO 11
-#define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12
-#define EFI_PAL_CODE 13
-#define EFI_MAX_MEMORY_TYPE 14
+enum efi_memory_type {
+ EFI_RESERVED_TYPE,
+ EFI_LOADER_CODE,
+ EFI_LOADER_DATA,
+ EFI_BOOT_SERVICES_CODE,
+ EFI_BOOT_SERVICES_DATA,
+ EFI_RUNTIME_SERVICES_CODE,
+ EFI_RUNTIME_SERVICES_DATA,
+ EFI_CONVENTIONAL_MEMORY,
+ EFI_UNUSABLE_MEMORY,
+ EFI_ACPI_RECLAIM_MEMORY,
+ EFI_ACPI_MEMORY_NVS,
+ EFI_MEMORY_MAPPED_IO,
+ EFI_MEMORY_MAPPED_IO_PORT_SPACE,
+ EFI_PAL_CODE,
+ EFI_MAX_MEMORY_TYPE
+};
/* Attribute values: */
#define EFI_MEMORY_UC ((u64)0x0000000000000001ULL) /* uncached */
@@ -124,10 +126,12 @@ typedef struct {
/*
* Allocation types for calls to boottime->allocate_pages.
*/
-#define EFI_ALLOCATE_ANY_PAGES 0
-#define EFI_ALLOCATE_MAX_ADDRESS 1
-#define EFI_ALLOCATE_ADDRESS 2
-#define EFI_MAX_ALLOCATE_TYPE 3
+enum efi_allocate_type {
+ EFI_ALLOCATE_ANY_PAGES,
+ EFI_ALLOCATE_MAX_ADDRESS,
+ EFI_ALLOCATE_ADDRESS,
+ EFI_MAX_ALLOCATE_TYPE
+};
typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h
index 5eaf1f260d..5ec59a8a2d 100644
--- a/include/efi/efi-device.h
+++ b/include/efi/efi-device.h
@@ -45,4 +45,16 @@ int efi_connect_all(void);
void efi_register_devices(void);
struct efi_device *efi_get_bootsource(void);
+static inline bool efi_device_has_guid(struct efi_device *efidev, efi_guid_t guid)
+{
+ int i;
+
+ for (i = 0; i < efidev->num_guids; i++) {
+ if (!efi_guidcmp(efidev->guids[i], guid))
+ return true;
+ }
+
+ return false;
+}
+
#endif /* __EFI_EFI_DEVICE_H */
diff --git a/include/gpio.h b/include/gpio.h
index 4d5f2c25c7..0c0c0337e0 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -114,6 +114,11 @@ static inline int gpio_request(unsigned gpio, const char *label)
return 0;
}
+static inline int gpio_find_by_name(const char *name)
+{
+ return -ENOSYS;
+}
+
static inline int gpio_find_by_label(const char *label)
{
return -ENOSYS;
@@ -141,6 +146,7 @@ static inline void gpio_free_array(const struct gpio *array, size_t num)
}
#else
int gpio_request(unsigned gpio, const char *label);
+int gpio_find_by_name(const char *name);
int gpio_find_by_label(const char *label);
void gpio_free(unsigned gpio);
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d8125214a0..1fbb3dc5c1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -15,6 +15,7 @@ struct pci_device_id {
__u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
__u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
__u32 class, class_mask; /* (class,subclass,prog-if) triplet */
+ unsigned long driver_data; /* Data private to the driver */
};
#define SPI_NAME_SIZE 32
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 105f381ada..1c6f442866 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -116,7 +116,7 @@
#define FSR_READY BIT(7)
/* Configuration Register bits. */
-#define CR_QUAD_EN_SPAN BIT(2) /* Spansion Quad I/O */
+#define CR_QUAD_EN_SPAN BIT(1) /* Spansion Quad I/O */
/* Supported SPI protocols */
#define SNOR_PROTO_INST_MASK GENMASK(23, 16)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d92d70b6bd..c742570e36 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -115,6 +115,17 @@ struct pci_dev {
};
#define to_pci_dev(d) container_of(d, struct pci_dev, dev)
+#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
+#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
+#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
+#define pci_resource_len(dev,bar) \
+ ((pci_resource_start((dev), (bar)) == 0 && \
+ pci_resource_end((dev), (bar)) == \
+ pci_resource_start((dev), (bar))) ? 0 : \
+ \
+ (pci_resource_end((dev), (bar)) - \
+ pci_resource_start((dev), (bar)) + 1))
+
enum {
PCI_BUS_RESOURCE_IO = 0,
PCI_BUS_RESOURCE_MEM = 1,
@@ -211,6 +222,20 @@ struct pci_driver {
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
/**
+ * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem
+ * @vend: the 16 bit PCI Vendor ID
+ * @dev: the 16 bit PCI Device ID
+ * @subvend: the 16 bit PCI Subvendor ID
+ * @subdev: the 16 bit PCI Subdevice ID
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific device with subsystem information.
+ */
+#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \
+ .vendor = (vend), .device = (dev), \
+ .subvendor = (subvend), .subdevice = (subdev)
+
+/**
* PCI_DEVICE_CLASS - macro used to describe a specific pci device class
* @dev_class: the class, subclass, prog-if triple for this device
* @dev_class_mask: the class mask for this device
@@ -350,4 +375,13 @@ enum pci_fixup_pass {
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
+#ifdef CONFIG_PCI
+const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
+ struct pci_dev *dev);
+#else
+static inline const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
+ struct pci_dev *dev)
+{ return NULL; }
+#endif
+
#endif /* LINUX_PCI_H */
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index feee9ee4ee..c6264d1c0a 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -38,7 +38,6 @@ struct rproc {
void *priv;
struct rproc_ops *ops;
struct device_d dev;
- int index;
void *fw_buf;
size_t fw_buf_ofs;
diff --git a/include/of.h b/include/of.h
index 98ddf795cb..f63a3efe13 100644
--- a/include/of.h
+++ b/include/of.h
@@ -197,14 +197,12 @@ extern int of_property_read_u64(const struct device_node *np,
extern int of_property_read_string(struct device_node *np,
const char *propname,
const char **out_string);
-extern int of_property_read_string_index(struct device_node *np,
- const char *propname,
- int index, const char **output);
extern int of_property_match_string(struct device_node *np,
const char *propname,
const char *string);
-extern int of_property_count_strings(struct device_node *np,
- const char *propname);
+extern int of_property_read_string_helper(const struct device_node *np,
+ const char *propname,
+ const char **out_strs, size_t sz, int index);
extern const __be32 *of_prop_next_u32(struct property *prop,
const __be32 *cur, u32 *pu);
@@ -444,20 +442,15 @@ static inline int of_property_read_string(struct device_node *np,
return -ENOSYS;
}
-static inline int of_property_read_string_index(struct device_node *np,
- const char *propname, int index, const char **output)
-{
- return -ENOSYS;
-}
-
static inline int of_property_match_string(struct device_node *np,
const char *propname, const char *string)
{
return -ENOSYS;
}
-static inline int of_property_count_strings(struct device_node *np,
- const char *propname)
+static inline int of_property_read_string_helper(const struct device_node *np,
+ const char *propname,
+ const char **out_strs, size_t sz, int index)
{
return -ENOSYS;
}
@@ -753,6 +746,70 @@ static inline struct device_node *of_find_matching_node(
child = of_get_next_available_child(parent, child))
/**
+ * of_property_read_string_array() - Read an array of strings from a multiple
+ * strings property.
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ * @out_strs: output array of string pointers.
+ * @sz: number of array elements to read.
+ *
+ * Search for a property in a device tree node and retrieve a list of
+ * terminated string values (pointer to data, not a copy) in that property.
+ *
+ * If @out_strs is NULL, the number of strings in the property is returned.
+ */
+static inline int of_property_read_string_array(const struct device_node *np,
+ const char *propname, const char **out_strs,
+ size_t sz)
+{
+ return of_property_read_string_helper(np, propname, out_strs, sz, 0);
+}
+
+/**
+ * of_property_count_strings() - Find and return the number of strings from a
+ * multiple strings property.
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ *
+ * Search for a property in a device tree node and retrieve the number of null
+ * terminated string contain in it. Returns the number of strings on
+ * success, -EINVAL if the property does not exist, -ENODATA if property
+ * does not have a value, and -EILSEQ if the string is not null-terminated
+ * within the length of the property data.
+ */
+static inline int of_property_count_strings(const struct device_node *np,
+ const char *propname)
+{
+ return of_property_read_string_helper(np, propname, NULL, 0, 0);
+}
+
+/**
+ * of_property_read_string_index() - Find and read a string from a multiple
+ * strings property.
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ * @index: index of the string in the list of strings
+ * @out_string: pointer to null terminated return string, modified only if
+ * return value is 0.
+ *
+ * Search for a property in a device tree node and retrieve a null
+ * terminated string value (pointer to data, not a copy) in the list of strings
+ * contained in that property.
+ * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
+ * property does not have a value, and -EILSEQ if the string is not
+ * null-terminated within the length of the property data.
+ *
+ * The out_string pointer is modified only if a valid string can be decoded.
+ */
+static inline int of_property_read_string_index(const struct device_node *np,
+ const char *propname,
+ int index, const char **output)
+{
+ int rc = of_property_read_string_helper(np, propname, output, 1, index);
+ return rc < 0 ? rc : 0;
+}
+
+/**
* of_property_read_bool - Findfrom a property
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
diff --git a/include/reset_source.h b/include/reset_source.h
index 3ccd529fdd..305dde0102 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -60,6 +60,11 @@ static inline struct device_d *reset_source_get_device(void)
return NULL;
}
+static inline void reset_source_set_device(struct device_d *dev,
+ enum reset_src_type st)
+{
+}
+
static inline void reset_source_set_prinst(enum reset_src_type type,
unsigned int priority, int instance)
{
diff --git a/include/soc/fsl/fsl_fman.h b/include/soc/fsl/fsl_fman.h
index 96d61298ef..fd69fded38 100644
--- a/include/soc/fsl/fsl_fman.h
+++ b/include/soc/fsl/fsl_fman.h
@@ -348,6 +348,9 @@ struct fm_fpm {
/* FPM Flush Control Register */
#define FMFP_FLC_DISP_LIM_NONE 0x00000000 /* no dispatch limitation */
+/* FMan Reset Command Register */
+#define FMFP_RSTC_RFM 0x80000000 /* FMan Soft Reset Command */
+
/* FMFP_EE - FPM event and enable register */
#define FMFPEE_DECC 0x80000000 /* double ECC err on FPM ram */
#define FMFPEE_STL 0x40000000 /* stall of task ... */