This commit is contained in:
Mark Brown
2026-07-31 14:45:17 +01:00
15 changed files with 393 additions and 262 deletions
File diff suppressed because it is too large Load Diff
-1
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/device.h>
#include <linux/mod_devicetable.h>
struct gio_device_id {
__u8 id;
+1 -8
View File
@@ -45,7 +45,6 @@ extern int (*txx9_irq_dispatch)(int pending);
const char *prom_getenv(const char *name);
void txx9_wdt_init(unsigned long base);
void txx9_wdt_now(unsigned long base);
void txx9_spi_init(int busid, unsigned long base, int irq);
void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
void txx9_sio_init(unsigned long baseaddr, int irq,
unsigned int line, unsigned int sclk, int nocts);
@@ -80,15 +79,9 @@ static inline unsigned int __fls8(unsigned char x)
return r;
}
void txx9_iocled_init(unsigned long baseaddr,
int basenum, unsigned int num, int lowactive,
void txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers);
/* 7SEG LED */
void txx9_7segled_init(unsigned int num,
void (*putc)(unsigned int pos, unsigned char val));
int txx9_7segled_putc(unsigned int pos, char c);
void __init txx9_aclc_init(unsigned long baseaddr, int irq,
unsigned int dmac_id,
unsigned int dma_chan_out,
-1
View File
@@ -281,7 +281,6 @@ void tx4938_wdt_init(void);
void tx4938_setup(void);
void tx4938_time_init(unsigned int tmrnr);
void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
void tx4938_spi_init(int busid);
void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
int tx4938_report_pciclk(void);
void tx4938_report_pci1clk(void);
+1 -2
View File
@@ -23,7 +23,6 @@ struct txx9_pio_reg {
__u32 maskext;
};
int txx9_gpio_init(unsigned long baseaddr,
unsigned int base, unsigned int num);
int txx9_gpio_init(unsigned long baseaddr, unsigned int num);
#endif /* __ASM_TXX9PIO_H */
+2 -3
View File
@@ -76,13 +76,12 @@ static struct gpio_chip txx9_gpio_chip = {
.label = "TXx9",
};
int __init txx9_gpio_init(unsigned long baseaddr,
unsigned int base, unsigned int num)
int __init txx9_gpio_init(unsigned long baseaddr, unsigned int num)
{
txx9_pioptr = ioremap(baseaddr, sizeof(struct txx9_pio_reg));
if (!txx9_pioptr)
return -ENODEV;
txx9_gpio_chip.base = base;
txx9_gpio_chip.base = -1;
txx9_gpio_chip.ngpio = num;
return gpiochip_add_data(&txx9_gpio_chip, NULL);
}
+2 -2
View File
@@ -109,7 +109,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_puts(m, " mips64r5");
if (cpu_has_mips64r6)
seq_puts(m, " mips64r6");
seq_puts(m, "\n");
seq_putc(m, '\n');
seq_puts(m, "ASEs implemented\t:");
if (cpu_has_mips16)
@@ -273,7 +273,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_puts(m, " mm_sysad");
if (cpu_has_mm_full)
seq_puts(m, " mm_full");
seq_puts(m, "\n");
seq_putc(m, '\n');
seq_printf(m, "shadow register sets\t: %d\n",
cpu_data[n].srsets);
-1
View File
@@ -37,7 +37,6 @@ config SOC_TX4927
select IRQ_TXX9
select PCI_TX4927
select GPIO_TXX9
select GPIOLIB_LEGACY
config SOC_TX4938
bool
+17 -28
View File
@@ -19,6 +19,7 @@
#include <linux/clkdev.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
#include <linux/platform_data/txx9/ndfmc.h>
#include <linux/serial_core.h>
@@ -341,23 +342,6 @@ void txx9_wdt_now(unsigned long base)
&tmrptr->tcr);
}
/* SPI support */
void __init txx9_spi_init(int busid, unsigned long base, int irq)
{
struct resource res[] = {
{
.start = base,
.end = base + 0x20 - 1,
.flags = IORESOURCE_MEM,
}, {
.start = irq,
.flags = IORESOURCE_IRQ,
},
};
platform_device_register_simple("spi_txx9", busid,
res, ARRAY_SIZE(res));
}
void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
{
struct platform_device *pdev =
@@ -586,7 +570,7 @@ void __init txx9_ndfmc_init(unsigned long baseaddr,
#if IS_ENABLED(CONFIG_LEDS_GPIO)
static DEFINE_SPINLOCK(txx9_iocled_lock);
#define TXX9_IOCLED_MAXLEDS 8
#define TXX9_IOCLED_MAXLEDS 3 /* rbtx4927 */
struct txx9_iocled_data {
struct gpio_chip chip;
@@ -632,8 +616,16 @@ static int txx9_iocled_dir_out(struct gpio_chip *chip, unsigned int offset,
return 0;
}
void __init txx9_iocled_init(unsigned long baseaddr,
int basenum, unsigned int num, int lowactive,
static struct gpiod_lookup_table txx9_iocled_table = {
.table = {
GPIO_LOOKUP_IDX("iocled", 0, NULL, 0, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("iocled", 1, NULL, 1, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("iocled", 2, NULL, 2, GPIO_ACTIVE_LOW),
{ },
},
};
void __init txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers)
{
struct txx9_iocled_data *iocled;
@@ -659,14 +651,12 @@ void __init txx9_iocled_init(unsigned long baseaddr,
iocled->chip.direction_input = txx9_iocled_dir_in;
iocled->chip.direction_output = txx9_iocled_dir_out;
iocled->chip.label = "iocled";
iocled->chip.base = basenum;
iocled->chip.base = -1;
iocled->chip.ngpio = num;
if (gpiochip_add_data(&iocled->chip, iocled))
goto out_unmap;
if (basenum < 0)
basenum = iocled->chip.base;
pdev = platform_device_alloc("leds-gpio", basenum);
pdev = platform_device_alloc("leds-gpio", iocled->chip.base);
if (!pdev)
goto out_gpio;
iocled->pdata.num_leds = num;
@@ -676,14 +666,14 @@ void __init txx9_iocled_init(unsigned long baseaddr,
snprintf(iocled->names[i], sizeof(iocled->names[i]),
"iocled:%s:%u", color, i);
led->name = iocled->names[i];
led->gpio = basenum + i;
led->active_low = lowactive;
if (deftriggers && *deftriggers)
led->default_trigger = *deftriggers++;
}
pdev->dev.platform_data = &iocled->pdata;
if (platform_device_add(pdev))
goto out_pdev;
txx9_iocled_table.dev_id = dev_name(&pdev->dev);
gpiod_add_lookup_table(&txx9_iocled_table);
return;
out_pdev:
@@ -696,8 +686,7 @@ out_free:
kfree(iocled);
}
#else /* CONFIG_LEDS_GPIO */
void __init txx9_iocled_init(unsigned long baseaddr,
int basenum, unsigned int num, int lowactive,
void __init txx9_iocled_init(unsigned long baseaddr, unsigned int num,
const char *color, char **deftriggers)
{
}
-6
View File
@@ -301,12 +301,6 @@ void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask)
}
}
void __init tx4938_spi_init(int busid)
{
txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL,
TXX9_IRQ_BASE + TX4938_IR_SPI);
}
void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
{
u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
+32 -9
View File
@@ -49,6 +49,7 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/leds.h>
#include <asm/io.h>
#include <asm/reboot.h>
@@ -157,18 +158,27 @@ static inline void tx4927_pci_setup(void) {}
static inline void tx4937_pci_setup(void) {}
#endif /* CONFIG_PCI */
/* TX4927-SIO DTR on (PIO[15]) */
GPIO_LOOKUP_SINGLE(sio_gpio_table, NULL, "TXx9", 15, "sio-dtr",
GPIO_ACTIVE_HIGH);
static void __init rbtx4927_gpio_init(void)
{
/* TX4927-SIO DTR on (PIO[15]) */
gpio_request(15, "sio-dtr");
gpio_direction_output(15, 1);
struct gpio_desc *d;
gpiod_add_lookup_table(&sio_gpio_table);
d = gpiod_get(NULL, "sio-dtr", GPIOD_OUT_HIGH);
if (IS_ERR(d))
pr_err("Unable to get sio-dtr GPIO descriptor\n");
else
gpiod_put(d);
tx4927_sio_init(0, 0);
}
static void __init rbtx4927_arch_init(void)
{
txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, TX4927_NUM_PIO);
rbtx4927_gpio_init();
@@ -177,7 +187,7 @@ static void __init rbtx4927_arch_init(void)
static void __init rbtx4937_arch_init(void)
{
txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, TX4938_NUM_PIO);
rbtx4927_gpio_init();
@@ -317,11 +327,19 @@ static void __init rbtx4927_mtd_init(void)
tx4927_mtd_init(i);
}
static struct gpiod_lookup_table rbtx4927_gpioled_table = {
.table = {
GPIO_LOOKUP_IDX("TXx9", 0, NULL, 0, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("TXx9", 1, NULL, 1, GPIO_ACTIVE_LOW),
{ },
},
};
static void __init rbtx4927_gpioled_init(void)
{
static const struct gpio_led leds[] = {
{ .name = "gpioled:green:0", .gpio = 0, .active_low = 1, },
{ .name = "gpioled:green:1", .gpio = 1, .active_low = 1, },
{ .name = "gpioled:green:0", },
{ .name = "gpioled:green:1", },
};
static struct gpio_led_platform_data pdata = {
.num_leds = ARRAY_SIZE(leds),
@@ -332,8 +350,13 @@ static void __init rbtx4927_gpioled_init(void)
if (!pdev)
return;
pdev->dev.platform_data = &pdata;
if (platform_device_add(pdev))
if (platform_device_add(pdev)) {
platform_device_put(pdev);
return;
}
rbtx4927_gpioled_table.dev_id = dev_name(&pdev->dev);
gpiod_add_lookup_table(&rbtx4927_gpioled_table);
}
static void __init rbtx4927_device_init(void)
@@ -350,7 +373,7 @@ static void __init rbtx4927_device_init(void)
tx4938_aclc_init();
}
platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, 3, "green", NULL);
rbtx4927_gpioled_init();
}
+37 -6
View File
@@ -19,6 +19,11 @@
#define BCMA_GPIO_MAX_PINS 32
const struct software_node bcma_gpio_swnode = {
.name = "bcma-gpio",
};
EXPORT_SYMBOL_GPL(bcma_gpio_swnode);
static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
{
struct bcma_drv_cc *cc = gpiochip_get_data(chip);
@@ -190,7 +195,20 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
chip->direction_input = bcma_gpio_direction_input;
chip->direction_output = bcma_gpio_direction_output;
chip->parent = bus->dev;
chip->fwnode = dev_fwnode(&cc->core->dev);
/*
* Register software node only for the host SoC bus, unless there is
* already a firmware node assigned. There is only one SoC instance
* in the system, so there are no concerns with registration conflicts.
*/
if (bus->hosttype == BCMA_HOSTTYPE_SOC && !dev_fwnode(&cc->core->dev)) {
err = software_node_register(&bcma_gpio_swnode);
if (err)
return err;
chip->fwnode = software_node_fwnode(&bcma_gpio_swnode);
} else {
chip->fwnode = dev_fwnode(&cc->core->dev);
}
switch (bus->chipinfo.id) {
case BCMA_CHIP_ID_BCM4707:
@@ -219,20 +237,33 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
err = bcma_gpio_irq_init(cc);
if (err)
return err;
goto err_unregister_swnode;
err = gpiochip_add_data(chip, cc);
if (err) {
bcma_gpio_irq_exit(cc);
return err;
}
if (err)
goto err_irq_exit;
return 0;
err_irq_exit:
bcma_gpio_irq_exit(cc);
err_unregister_swnode:
if (bus->hosttype == BCMA_HOSTTYPE_SOC &&
chip->fwnode && is_software_node(chip->fwnode)) {
software_node_unregister(&bcma_gpio_swnode);
chip->fwnode = NULL;
}
return err;
}
int bcma_gpio_unregister(struct bcma_drv_cc *cc)
{
bcma_gpio_irq_exit(cc);
gpiochip_remove(&cc->gpio);
if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC &&
cc->gpio.fwnode && is_software_node(cc->gpio.fwnode)) {
software_node_unregister(&bcma_gpio_swnode);
cc->gpio.fwnode = NULL;
}
return 0;
}
+41 -7
View File
@@ -15,8 +15,14 @@
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/export.h>
#include <linux/property.h>
#include <linux/ssb/ssb.h>
const struct software_node ssb_gpio_swnode = {
.name = "ssb-gpio",
};
EXPORT_SYMBOL_GPL(ssb_gpio_swnode);
/**************************************************
* Shared
@@ -232,6 +238,8 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus)
chip->to_irq = ssb_gpio_to_irq;
#endif
chip->ngpio = 16;
if (bus->bustype == SSB_BUSTYPE_SSB)
chip->fwnode = software_node_fwnode(&ssb_gpio_swnode);
/* There is just one SoC in one device and its GPIO addresses should be
* deterministic to address them more easily. The other buses could get
* a random base number.
@@ -433,10 +441,12 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
* deterministic to address them more easily. The other buses could get
* a random base number.
*/
if (bus->bustype == SSB_BUSTYPE_SSB)
chip->base = 0;
else
chip->base = -1;
if (bus->bustype == SSB_BUSTYPE_SSB) {
chip->base = 0;
chip->fwnode = software_node_fwnode(&ssb_gpio_swnode);
} else {
chip->base = -1;
}
err = ssb_gpio_irq_extif_domain_init(bus);
if (err)
@@ -464,11 +474,33 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
int ssb_gpio_init(struct ssb_bus *bus)
{
int err = 0;
/*
* Register software node only for the host SoC bus. There is only
* one SoC instance in the system, so there are no concerns with
* registration conflicts.
*/
if (bus->bustype == SSB_BUSTYPE_SSB) {
err = software_node_register(&ssb_gpio_swnode);
if (err)
return err;
}
if (ssb_chipco_available(&bus->chipco))
return ssb_gpio_chipco_init(bus);
err = ssb_gpio_chipco_init(bus);
else if (ssb_extif_available(&bus->extif))
return ssb_gpio_extif_init(bus);
return -1;
err = ssb_gpio_extif_init(bus);
else
err = -ENODEV;
if (err) {
if (bus->bustype == SSB_BUSTYPE_SSB)
software_node_unregister(&ssb_gpio_swnode);
return err;
}
return 0;
}
int ssb_gpio_unregister(struct ssb_bus *bus)
@@ -476,6 +508,8 @@ int ssb_gpio_unregister(struct ssb_bus *bus)
if (ssb_chipco_available(&bus->chipco) ||
ssb_extif_available(&bus->extif)) {
gpiochip_remove(&bus->gpio);
if (bus->bustype == SSB_BUSTYPE_SSB)
software_node_unregister(&ssb_gpio_swnode);
return 0;
}
return -1;
+2
View File
@@ -486,4 +486,6 @@ extern u32 bcma_core_dma_translation(struct bcma_device *core);
extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
extern const struct software_node bcma_gpio_swnode;
#endif /* LINUX_BCMA_H_ */
+2
View File
@@ -671,4 +671,6 @@ int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
#endif /* CONFIG_SSB_EMBEDDED */
extern const struct software_node ssb_gpio_swnode;
#endif /* LINUX_SSB_H_ */