Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107159
b: refs/heads/master
c: c49f91f
h: refs/heads/master
i:
  107157: e338b3f
  107155: 5eeec1d
  107151: 669f79e
v: v3
  • Loading branch information
Atsushi Nemoto authored and Ralf Baechle committed Jul 30, 2008
1 parent 2a4c060 commit 64ac03f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f6727fb889c664be094fa041a0fdf0f1a1caefb6
refs/heads/master: c49f91f51e3cca796494f69fd967a7f72df5d457
27 changes: 27 additions & 0 deletions trunk/arch/mips/txx9/generic/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,33 @@ void __init txx9_wdt_init(unsigned long base)
platform_device_register_simple("txx9wdt", -1, &res, 1);
}

/* 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 =
platform_device_alloc("tc35815-mac", id);
if (!pdev ||
platform_device_add_data(pdev, ethaddr, 6) ||
platform_device_add(pdev))
platform_device_put(pdev);
}

/* wrappers */
void __init plat_mem_setup(void)
{
Expand Down
16 changes: 16 additions & 0 deletions trunk/arch/mips/txx9/generic/setup_tx4938.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,19 @@ void __init tx4938_setup_serial(void)
}
#endif /* CONFIG_SERIAL_TXX9 */
}

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);

if (addr0 && (pcfg & TX4938_PCFG_ETH0_SEL))
txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH0, addr0);
if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL))
txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1);
}
34 changes: 2 additions & 32 deletions trunk/arch/mips/txx9/rbtx4938/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,7 @@ static int __init rbtx4938_ethaddr_init(void)
if (sum)
printk(KERN_WARNING "seeprom: bad checksum.\n");
}
for (i = 0; i < 2; i++) {
unsigned int id =
TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
struct platform_device *pdev;
if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
(i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
continue;
pdev = platform_device_alloc("tc35815-mac", id);
if (!pdev ||
platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
platform_device_add(pdev))
platform_device_put(pdev);
}
tx4938_ethaddr_init(&dat[4], &dat[4 + 6]);
#endif /* CONFIG_PCI */
return 0;
}
Expand Down Expand Up @@ -301,24 +289,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = {
.ngpio = 3,
};

/* SPI support */

static void __init txx9_spi_init(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", 0,
res, ARRAY_SIZE(res));
}

static int __init rbtx4938_spi_init(void)
{
struct spi_board_info srtc_info = {
Expand All @@ -341,7 +311,7 @@ static int __init rbtx4938_spi_init(void)
gpio_direction_output(16 + SEEPROM2_CS, 1);
gpio_request(16 + SEEPROM3_CS, "seeprom3");
gpio_direction_output(16 + SEEPROM3_CS, 1);
txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI);
tx4938_spi_init(0);
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-mips/txx9/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ extern int (*txx9_irq_dispatch)(int pending);
void prom_init_cmdline(void);
char *prom_getcmdline(void);
void txx9_wdt_init(unsigned long base);
void txx9_spi_init(int busid, unsigned long base, int irq);
void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);

#endif /* __ASM_TXX9_GENERIC_H */
2 changes: 2 additions & 0 deletions trunk/include/asm-mips/txx9/tx4938.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ void tx4938_wdt_init(void);
void tx4938_setup(void);
void tx4938_time_init(unsigned int tmrnr);
void tx4938_setup_serial(void);
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);
int tx4938_pciclk66_setup(void);
Expand Down

0 comments on commit 64ac03f

Please sign in to comment.