mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
- build fix for gpio
- fix crc32 build problems - check for failed memory allocations -----BEGIN PGP SIGNATURE----- iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmJIMnYaHHRzYm9nZW5k QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHB/PQ/5AY9WAQnRnBFvDmponiIB WIDUWa3kx8OZRyLAc3+BQrPa6xAmH+Mnpl+K9vfjLl8aXcgw2HRiR1WSvNc8+M0t 3R1L1J5rR00qcSNu9IAFL1g+tEMFyNkpbVif8p1uG6nSpiQ1guvFmQ7o648FFVeW X0P/1ttZmqawl+456VQ9OD+3AxxiXNvqCslsUG0TfxjnUpncOawA/B+c2Z7U+E8S jHNdcIbwKe2cCKkHZ5dRJWKE2WSonmjlF4uEjLPEkJavk4XN0EUNA4GfRZfjZoRj qvpr2JT1CZeVu0TxBYiTUc0WEk/GwUBc9ialHHyWov7F8pAKStIlZG/DUDIu8MxV LBF67qE7lv1tU5lxZdV0GOY1q7x6K6Lk5KGIaqxUB0exakgvuBujVhi41lHulLPZ TZEuTfI0olQXzP8JAK1zcHA2aNunGCxsXpJhgMz8NF+2u2+gPgWqeAPpv94Jfv0x QYVlb9k+RG1rABaF+15F7xCKu09koAegTDH9k0EL9yRMf2vq6qmEpm5fpZgXHW4O 7GIwq3AJmTtuyhyWqwUJKoHwziyO4xGCuioCUavrsDlGyNfczfKTSakHhhu7Qyty U5mkDEJH3TDo7XEXXWPn/hJYX3HR7gr3jaF9FHAjaIfR1OBg+37qhSiUy7Bb54YS vKI+JDK5NRnm3uxmjLPAsIY= =Vpmb -----END PGP SIGNATURE----- Merge tag 'mips_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux Pull MIPS fixes from Thomas Bogendoerfer: - build fix for gpio - fix crc32 build problems - check for failed memory allocations * tag 'mips_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: crypto: Fix CRC32 code MIPS: rb532: move GPIOD definition into C-files MIPS: lantiq: check the return value of kzalloc() mips: sgi-ip22: add a check for the return of kzalloc()
This commit is contained in:
commit
0b0fa57a27
@ -28,7 +28,7 @@ enum crc_type {
|
||||
};
|
||||
|
||||
#ifndef TOOLCHAIN_SUPPORTS_CRC
|
||||
#define _ASM_MACRO_CRC32(OP, SZ, TYPE) \
|
||||
#define _ASM_SET_CRC(OP, SZ, TYPE) \
|
||||
_ASM_MACRO_3R(OP, rt, rs, rt2, \
|
||||
".ifnc \\rt, \\rt2\n\t" \
|
||||
".error \"invalid operands \\\"" #OP " \\rt,\\rs,\\rt2\\\"\"\n\t" \
|
||||
@ -37,30 +37,36 @@ _ASM_MACRO_3R(OP, rt, rs, rt2, \
|
||||
((SZ) << 6) | ((TYPE) << 8)) \
|
||||
_ASM_INSN32_IF_MM(0x00000030 | (__rs << 16) | (__rt << 21) | \
|
||||
((SZ) << 14) | ((TYPE) << 3)))
|
||||
_ASM_MACRO_CRC32(crc32b, 0, 0);
|
||||
_ASM_MACRO_CRC32(crc32h, 1, 0);
|
||||
_ASM_MACRO_CRC32(crc32w, 2, 0);
|
||||
_ASM_MACRO_CRC32(crc32d, 3, 0);
|
||||
_ASM_MACRO_CRC32(crc32cb, 0, 1);
|
||||
_ASM_MACRO_CRC32(crc32ch, 1, 1);
|
||||
_ASM_MACRO_CRC32(crc32cw, 2, 1);
|
||||
_ASM_MACRO_CRC32(crc32cd, 3, 1);
|
||||
#define _ASM_SET_CRC ""
|
||||
#define _ASM_UNSET_CRC(op, SZ, TYPE) ".purgem " #op "\n\t"
|
||||
#else /* !TOOLCHAIN_SUPPORTS_CRC */
|
||||
#define _ASM_SET_CRC ".set\tcrc\n\t"
|
||||
#define _ASM_SET_CRC(op, SZ, TYPE) ".set\tcrc\n\t"
|
||||
#define _ASM_UNSET_CRC(op, SZ, TYPE)
|
||||
#endif
|
||||
|
||||
#define _CRC32(crc, value, size, type) \
|
||||
do { \
|
||||
__asm__ __volatile__( \
|
||||
".set push\n\t" \
|
||||
_ASM_SET_CRC \
|
||||
#type #size " %0, %1, %0\n\t" \
|
||||
".set pop" \
|
||||
: "+r" (crc) \
|
||||
: "r" (value)); \
|
||||
#define __CRC32(crc, value, op, SZ, TYPE) \
|
||||
do { \
|
||||
__asm__ __volatile__( \
|
||||
".set push\n\t" \
|
||||
_ASM_SET_CRC(op, SZ, TYPE) \
|
||||
#op " %0, %1, %0\n\t" \
|
||||
_ASM_UNSET_CRC(op, SZ, TYPE) \
|
||||
".set pop" \
|
||||
: "+r" (crc) \
|
||||
: "r" (value)); \
|
||||
} while (0)
|
||||
|
||||
#define _CRC32_crc32b(crc, value) __CRC32(crc, value, crc32b, 0, 0)
|
||||
#define _CRC32_crc32h(crc, value) __CRC32(crc, value, crc32h, 1, 0)
|
||||
#define _CRC32_crc32w(crc, value) __CRC32(crc, value, crc32w, 2, 0)
|
||||
#define _CRC32_crc32d(crc, value) __CRC32(crc, value, crc32d, 3, 0)
|
||||
#define _CRC32_crc32cb(crc, value) __CRC32(crc, value, crc32cb, 0, 1)
|
||||
#define _CRC32_crc32ch(crc, value) __CRC32(crc, value, crc32ch, 1, 1)
|
||||
#define _CRC32_crc32cw(crc, value) __CRC32(crc, value, crc32cw, 2, 1)
|
||||
#define _CRC32_crc32cd(crc, value) __CRC32(crc, value, crc32cd, 3, 1)
|
||||
|
||||
#define _CRC32(crc, value, size, op) \
|
||||
_CRC32_##op##size(crc, value)
|
||||
|
||||
#define CRC32(crc, value, size) \
|
||||
_CRC32(crc, value, size, crc32)
|
||||
|
||||
|
@ -29,15 +29,6 @@
|
||||
#define DEV3TC 0x01003C
|
||||
#define BTCS 0x010040
|
||||
#define BTCOMPARE 0x010044
|
||||
#define GPIOBASE 0x050000
|
||||
/* Offsets relative to GPIOBASE */
|
||||
#define GPIOFUNC 0x00
|
||||
#define GPIOCFG 0x04
|
||||
#define GPIOD 0x08
|
||||
#define GPIOILEVEL 0x0C
|
||||
#define GPIOISTAT 0x10
|
||||
#define GPIONMIEN 0x14
|
||||
#define IMASK6 0x38
|
||||
#define LO_WPX (1 << 0)
|
||||
#define LO_ALE (1 << 1)
|
||||
#define LO_CLE (1 << 2)
|
||||
|
@ -167,6 +167,8 @@ static inline void clkdev_add_sys(const char *dev, unsigned int module,
|
||||
{
|
||||
struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
|
||||
if (!clk)
|
||||
return;
|
||||
clk->cl.dev_id = dev;
|
||||
clk->cl.con_id = NULL;
|
||||
clk->cl.clk = clk;
|
||||
|
@ -122,6 +122,8 @@ static inline void clkdev_add_gptu(struct device *dev, const char *con,
|
||||
{
|
||||
struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
|
||||
if (!clk)
|
||||
return;
|
||||
clk->cl.dev_id = dev_name(dev);
|
||||
clk->cl.con_id = con;
|
||||
clk->cl.clk = clk;
|
||||
|
@ -315,6 +315,8 @@ static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
|
||||
{
|
||||
struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
|
||||
if (!clk)
|
||||
return;
|
||||
clk->cl.dev_id = dev;
|
||||
clk->cl.con_id = con;
|
||||
clk->cl.clk = clk;
|
||||
@ -338,6 +340,8 @@ static void clkdev_add_cgu(const char *dev, const char *con,
|
||||
{
|
||||
struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
|
||||
if (!clk)
|
||||
return;
|
||||
clk->cl.dev_id = dev;
|
||||
clk->cl.con_id = con;
|
||||
clk->cl.clk = clk;
|
||||
@ -356,24 +360,28 @@ static void clkdev_add_pci(void)
|
||||
struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
|
||||
/* main pci clock */
|
||||
clk->cl.dev_id = "17000000.pci";
|
||||
clk->cl.con_id = NULL;
|
||||
clk->cl.clk = clk;
|
||||
clk->rate = CLOCK_33M;
|
||||
clk->rates = valid_pci_rates;
|
||||
clk->enable = pci_enable;
|
||||
clk->disable = pmu_disable;
|
||||
clk->module = 0;
|
||||
clk->bits = PMU_PCI;
|
||||
clkdev_add(&clk->cl);
|
||||
if (clk) {
|
||||
clk->cl.dev_id = "17000000.pci";
|
||||
clk->cl.con_id = NULL;
|
||||
clk->cl.clk = clk;
|
||||
clk->rate = CLOCK_33M;
|
||||
clk->rates = valid_pci_rates;
|
||||
clk->enable = pci_enable;
|
||||
clk->disable = pmu_disable;
|
||||
clk->module = 0;
|
||||
clk->bits = PMU_PCI;
|
||||
clkdev_add(&clk->cl);
|
||||
}
|
||||
|
||||
/* use internal/external bus clock */
|
||||
clk_ext->cl.dev_id = "17000000.pci";
|
||||
clk_ext->cl.con_id = "external";
|
||||
clk_ext->cl.clk = clk_ext;
|
||||
clk_ext->enable = pci_ext_enable;
|
||||
clk_ext->disable = pci_ext_disable;
|
||||
clkdev_add(&clk_ext->cl);
|
||||
if (clk_ext) {
|
||||
clk_ext->cl.dev_id = "17000000.pci";
|
||||
clk_ext->cl.con_id = "external";
|
||||
clk_ext->cl.clk = clk_ext;
|
||||
clk_ext->enable = pci_ext_enable;
|
||||
clk_ext->disable = pci_ext_disable;
|
||||
clkdev_add(&clk_ext->cl);
|
||||
}
|
||||
}
|
||||
|
||||
/* xway socs can generate clocks on gpio pins */
|
||||
@ -393,9 +401,15 @@ static void clkdev_add_clkout(void)
|
||||
char *name;
|
||||
|
||||
name = kzalloc(sizeof("clkout0"), GFP_KERNEL);
|
||||
if (!name)
|
||||
continue;
|
||||
sprintf(name, "clkout%d", i);
|
||||
|
||||
clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
|
||||
if (!clk) {
|
||||
kfree(name);
|
||||
continue;
|
||||
}
|
||||
clk->cl.dev_id = "1f103000.cgu";
|
||||
clk->cl.con_id = name;
|
||||
clk->cl.clk = clk;
|
||||
|
@ -37,6 +37,16 @@
|
||||
#include <asm/mach-rc32434/rb.h>
|
||||
#include <asm/mach-rc32434/gpio.h>
|
||||
|
||||
#define GPIOBASE 0x050000
|
||||
/* Offsets relative to GPIOBASE */
|
||||
#define GPIOFUNC 0x00
|
||||
#define GPIOCFG 0x04
|
||||
#define GPIOD 0x08
|
||||
#define GPIOILEVEL 0x0C
|
||||
#define GPIOISTAT 0x10
|
||||
#define GPIONMIEN 0x14
|
||||
#define IMASK6 0x38
|
||||
|
||||
struct rb532_gpio_chip {
|
||||
struct gpio_chip chip;
|
||||
void __iomem *regbase;
|
||||
|
@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
|
||||
printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
|
||||
slotno, name, id);
|
||||
gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
|
||||
if (!gio_dev)
|
||||
return;
|
||||
gio_dev->name = name;
|
||||
gio_dev->slotno = slotno;
|
||||
gio_dev->id.id = id;
|
||||
|
Loading…
Reference in New Issue
Block a user